@yozora/html-emphasis
v2.0.0-alpha.2
Published
render Yozora Markdown AST node `IEmphasis` into HTML string
Downloads
10
Maintainers
Readme
This component is for rendering the Yozora Markdown AST node IEmphasis
produced by @yozora/tokenizer-emphasis into HTML string.
This component has been built into [@yozora/html-markdown][], you can use it directly.
Install
npm
npm install --save @yozora/html-emphasis
yarn
yarn add @yozora/html-emphasis
Usage
Basic:
import type { IEmphasis, IYastNode } from '@yozora/ast' import renderEmphasis from '@yozora/html-emphasis' // The implementation of the following function has been omitted. const renderChildren: (nodes: IYastNode[]) => string = function () {} const emphasis = { "type": "emphasis", "children": [ { "type": "text", "value": "yozora is cool!" } ] } renderEmphasis(emphasis as IEmphasis, renderChildren) // => <em class="yozora-emphasis"><span class="yozora-text">yozora is cool!</span></em>