JSPM

  • Created
  • Published
  • Downloads 25808
  • Score
    100M100P100Q148271F
  • License MIT

Package Exports

  • svelte-exmarkdown
  • svelte-exmarkdown/ExtensibleSvelteMarkdown.svelte
  • svelte-exmarkdown/contexts
  • svelte-exmarkdown/gfm
  • svelte-exmarkdown/gfm/TableCell.svelte
  • svelte-exmarkdown/package.json
  • svelte-exmarkdown/renderer
  • svelte-exmarkdown/renderer/Children.svelte
  • svelte-exmarkdown/renderer/Renderer.svelte
  • svelte-exmarkdown/renderer/Text.svelte
  • svelte-exmarkdown/renderer/html
  • svelte-exmarkdown/renderer/html/Default.svelte
  • svelte-exmarkdown/types
  • svelte-exmarkdown/utils

Readme

svelte-exmarkdown

Svelte component to render markdown.

Motivation

svelte-markdown is a good component package. However, it is not extensible. You cannot use custom syntax(e.g. KaTeX).

MDsveX is another good package. However, it is a preprocessor. Not suitable for dynamic rendering.

We need pluggable and dynamic markdown renderer in svelte like react-markdown.

Usage

You must use svelte@3.47 or higher version. This library is use <svelte:element />.

<script>
    import Markdown from 'svelte-exmarkdown';
    let md = '# Hello world!';
</script>

<textarea bind:value={md} />
<Markdown {md} />

with GFM

<script>
    import Markdown from 'svelte-exmarkdown';
    import { gfmPlugin } from 'svelte-exmarkdown/gfm';
    let md = '# Hello world!';
</script>

<textarea bind:value={md} />
<Markdown {md} plugins={[gfmPlugin]} />

Playground & Documents

https://ssssota.github.io/svelte-exmarkdown