@yozora/html-markdown
v2.0.0-alpha.9
Published
<header> <h1 align="center"> <a href="https://github.com/guanghechen/yozora-html/tree/main/packages/html-markdown#readme">@yozora/html-markdown</a> </h1> <div align="center"> <a href="https://www.npmjs.com/package/@yozora/html-markdown">
Downloads
39
Readme
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>