@yozora/html-markdown
This component is for rendering the Yozora Markdown AST node Root
produced by [@yozora/parser][] into HTML string.
Install
-
npm
npm install --save @yozora/html-markdown
-
yarn
yarn add @yozora/html-markdown
Usage
-
Basic:
import type { Root } from '@yozora/ast' import { renderMarkdown, defaultRendererMap } from '@yozora/html-markdown' import '@yozora/html-markdown/lib/index.css' // load preset styles. const root = { "type": "root", "children": [ { "type": "markdown", "children": [ { "type": "text", "value": "yozora is cool!" } ] } ] } renderMarkdown( markdown as Root, {}, // definitionMap {}, // footnoteDefinitionMap defaultRendererMap ) // => <markdown class="yozora-markdown"><span class="yozora-text">yozora is cool!</span></markdown>