Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@polymer/marked-element

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@polymer/marked-element - npm Package Compare versions

Comparing version 1.2.0-pre.3 to 3.0.0-pre.1

.github/ISSUE_TEMPLATE.md

7

package.json
{
"name": "@polymer/marked-element",
"flat": true,
"version": "1.2.0-pre.3",
"version": "3.0.0-pre.1",
"description": "Element wrapper for the marked library",

@@ -22,8 +22,7 @@ "contributors": [

},
"license": "SEE LICENSE IN https://polymer.github.io/LICENSE.txt",
"license": "https://polymer.github.io/LICENSE.txt",
"dependencies": {
"marked": "~0.3.3",
"@polymer/polymer": "preview"
"@polymer/polymer": "^3.0.0-pre.1"
},
"devDependencies": {}
}

@@ -18,3 +18,3 @@

##<marked-element>
## <marked-element>

@@ -24,20 +24,22 @@ Element wrapper for the [marked](https://github.com/chjj/marked) library.

`<marked-element>` accepts Markdown source, and renders it to a child
element with the class `markdown-html`. This child element can be styled
element with the slot `markdown-html`. This child element can be styled
as you would a normal DOM element. If you do not provide a child element
with the `markdown-html` class, the Markdown source will still be rendered,
with the `markdown-html` slot, the Markdown source will still be rendered,
but to a shadow DOM child that cannot be styled.
The Markdown source can be specified either via the `markdown` attribute:
The Markdown source can be specified several ways:
### Use the `markdown` attribute to bind markdown
```html
<marked-element markdown="`Markdown` is _awesome_!">
<div class="markdown-html"></div>
<div slot="markdown-html"></div>
</marked-element>
```
Or, you can provide it via a `<script type="text/markdown">` element child:
### Use `<script type="text/markdown">` element child to inline markdown
```html
<marked-element>
<div class="markdown-html"></div>
<div slot="markdown-html"></div>
<script type="text/markdown">

@@ -58,20 +60,41 @@ Check out my markdown!

### Use `<script type="text/markdown" src="URL">` element child to specify remote markdown
```html
<marked-element>
<div slot="markdown-html"></div>
<script type="text/markdown" src="../guidelines.md"></script>
</marked-element>
```
Note that the `<script type="text/markdown">` approach is *static*. Changes to
the script content will *not* update the rendered markdown!
Though, you can data bind to the `src` attribute to change the markdown.
```html
<marked-element>
<div slot="markdown-html"></div>
<script type="text/markdown" src$="[[source]]"></script>
</marked-element>
...
<script>
...
this.source = '../guidelines.md';
</script>
```
### Styling
If you are using a child with the `markdown-html` class, you can style it
If you are using a child with the `markdown-html` slot, you can style it
as you would a regular DOM element:
```css
.markdown-html p {
[slot="markdown-html"] p {
color: red;
}
.markdown-html td:first-child {
[slot="markdown-html"] td:first-child {
padding-left: 24px;
}
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc