@yozora/html-markdown
TypeScript icon, indicating that this package has built-in type declarations

2.0.0-alpha.9 • Public • Published

@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>

Related

Readme

Keywords

Package Sidebar

Install

npm i @yozora/html-markdown

Weekly Downloads

5

Version

2.0.0-alpha.9

License

MIT

Unpacked Size

41.2 kB

Total Files

9

Last publish

Collaborators

  • lemonclown