1.0.1 • Published 2 years ago

markdown-it-diagrams v1.0.1

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

markdown-it-diagrams

Diagrams renderer for markdown-it, using svgbob, and mermaidjs.

Example code

An example svgbob diagram:

``` bob 
     .---.
    /-o-/--
 .-/ / /->
( *  \/
 '-.  \
    \ /
     '
```

And a mermaid diagram:

``` mermaid 
graph TD;
    A-->B;
    A-->C;
    B-->D;
    C-->D;
```

API

The svgbob-wasm dependency which provides svgbob support is a wasm module. In order to load the dependency asynchronously, this plugin exposes an async function loadPluginFactory which should be awaited to provide the plugin factory:

import {loadPluginFactory} from "markdown-it-diagrams";
import * as MarkdownIt from "markdown-it";

loadPluginFactory().then((plugin) => {
    let md = new MarkdownIt({
      html: true,
    }).use(plugin);
    
    let someMarkdown = "``` bob \n" +
            "     .---.\n" +
            "    /-o-/--\n" +
            " .-/ / /->\n" +
            "( *  \\/\n" +
            " '-.  \\\n" +
            "    \\ /\n" +
            "     '\n" +
            "```";
    let html = md.render(someMarkdown);
    console.log(html);
})
1.0.1

2 years ago

1.0.0

2 years ago

0.2.0-alpha.0

3 years ago

0.1.2

4 years ago

0.1.0

4 years ago

0.1.1

4 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago