1.6.11 • Published 2 years ago

@vanillawc/wc-markdown v1.6.11

Weekly downloads
135
License
MIT
Repository
github
Last release
2 years ago

Setup

Install and import from NPM

npm i @vanillawc/wc-markdown
<script type="module" src="[node_modules]/@vanillawc/wc-markdown/index.js"></script>

Import from SkyPack CDN

<script type="module" src="https://cdn.skypack.dev/@vanillawc/wc-markdown"></script>

Demo

Try it on WebComponents.dev

Usage

Attributes

  • src - load an external source file
  • highlight - when present, syntax highlighting is applied to code

Properties

  • value - get/set the source code

External Source

<wc-markdown src="sample.md"></wc-markdown>

Inline Source

<wc-markdown>
  <script type="wc-content">
    ## Inline Markdown

    This some sample markdown.
  </script>
</wc-markdown>

Note: The </script> word cannot be used inside here, you'll have to use the escaped &lt;/script&gt; version instead, you may also use &lt;script&gt; for the opening <script> tag if you wish to

Syntax Highlighting

To apply syntax highlighting, add the highlight attribute.

<wc-markdown src="sample2.md" highlight></wc-markdown>

Syntax Highlighting - Theming

Highlighting requires the import of a CSS theme. Themes can be found under themes/.

<link rel="stylesheet" href="/node_modules/@vanillawc/wc-markdown/themes/prism-okaidia.css">

Syntax Highlighting - Languages

The PrismJS core includes the following languages [html, xml, svg, mathml, css, javascript].

Additional language modules can be imported from components/.

<script type="module" src="/node_modules/@vanillawc/wc-markdown/index.js"></script>
<script type="module" src="/node_modules/@vanillawc/wc-markdown/components/prism-typescript.js"></script>

Some languages extend others. Ex, C++ extends C so both need to be imported in the correct order.

<script type="module" src="/node_modules/@vanillawc/wc-markdown/index.js"></script>
<script type="module" src="/node_modules/@vanillawc/wc-markdown/components/prism-c.js"></script>
<script type="module" src="/node_modules/@vanillawc/wc-markdown/components/prism-cpp.js"></script>

Contributing

See CONTRIBUTING.md

Similar Projects

1.6.11

2 years ago

1.6.10

3 years ago

1.6.9

3 years ago

1.6.4

3 years ago

1.6.8

3 years ago

1.6.7

3 years ago

1.6.6

3 years ago

1.6.5

3 years ago

1.6.3

4 years ago

1.6.2

4 years ago

1.6.1

4 years ago

1.6.0

4 years ago

1.5.13

4 years ago

1.5.12

4 years ago

1.5.11

4 years ago

1.5.10

4 years ago

1.5.9

4 years ago

1.5.8

4 years ago

1.5.7

4 years ago

1.5.6

4 years ago

1.5.5

4 years ago

1.5.4

4 years ago

1.5.3

4 years ago

1.5.2

4 years ago

1.5.1

4 years ago

1.5.0

4 years ago

1.4.3

4 years ago

1.4.2

4 years ago

1.4.1

4 years ago

1.4.0

4 years ago

1.3.14

4 years ago

1.3.15

4 years ago

1.3.13

4 years ago

1.3.12

4 years ago

1.3.11

4 years ago

1.3.10

4 years ago

1.3.9

4 years ago

1.3.8

4 years ago

1.3.7

4 years ago

1.3.6

4 years ago

1.3.5

4 years ago

1.3.4

4 years ago

1.3.3

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

1.0.0-rc6

5 years ago

1.0.0-rc4

5 years ago

1.0.0-rc3

5 years ago

1.0.0-rc2

5 years ago

1.0.0-rc1

5 years ago

1.0.0-rc0

5 years ago