https://github.com/agoose77/markdown-it-svgbob
https://github.com/agoose77/markdown-it-svgbob
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/agoose77/markdown-it-svgbob
- Owner: agoose77
- Created: 2022-04-14T11:19:25.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-08-15T10:47:23.000Z (over 2 years ago)
- Last Synced: 2025-02-16T22:16:43.032Z (2 months ago)
- Language: TypeScript
- Size: 94.7 KB
- Stars: 0
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# markdown-it-svgbob
[![npm-badge][]][npm][npm-badge]: https://img.shields.io/npm/v/@agoose77/markdown-it-svgbob?style=for-the-badge
[npm]: https://www.npmjs.com/package/@agoose77/markdown-it-svgbob[svgbob](https://github.com/ivanceras/svgbob) renderer for [markdown-it](https://github.com/markdown-it/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 factory from "@agoose77markdown-it-svgbob";
import * as MarkdownIt from "markdown-it";factory().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);
})
```