This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

markdown-it-diagrams
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

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);
})

Package Sidebar

Install

npm i markdown-it-diagrams

Weekly Downloads

3

Version

1.0.1

License

MIT

Unpacked Size

7.03 kB

Total Files

6

Last publish

Collaborators

  • agoose77