0.1.0-a0 • Published 2 years ago

@agoose77/markdown-it-svgbob v0.1.0-a0

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

markdown-it-svgbob

svgbob renderer for markdown-it.

Example code

An example svgbob diagram:

``` bob 
     .---.
    /-o-/--
 .-/ / /->
( *  \/
 '-.  \
    \ /
     '
```
or using the sphinx-svgbob language name:
``` svgbob 
     .---.
    /-o-/--
 .-/ / /->
( *  \/
 '-.  \
    \ /
     '
```

## 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:
```typescript
import {loadPluginFactory} from "markdown-it-svgbob";
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);
})
```