2.0.0-alpha.2 • Published 2 years ago

@yozora/html-blockquote v2.0.0-alpha.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

This component is for rendering the Yozora Markdown AST node IBlockquote produced by @yozora/tokenizer-blockquote into HTML string.

This component has been built into @yozora/html-markdown, you can use it directly.

Install

  • npm

    npm install --save @yozora/html-blockquote
  • yarn

    yarn add @yozora/html-blockquote

Usage

  • Basic:

    import type { IBlockquote, IYastNode } from '@yozora/ast'
    import renderBlockquote from '@yozora/html-blockquote'
    
    // The implementation of the following function has been omitted.
    const renderChildren: (nodes: IYastNode[]) => string = function () {}
    
    const blockquote = {
      "type": "blockquote",
      "children": [
        {
          "type": "text",
          "value": "yozora is cool!"
        }
      ]
    }
    renderBlockquote(blockquote as IBlockquote, renderChildren)
    // => <blockquote class="yozora-blockquote"><span class="yozora-text">yozora is cool!</span></blockquote>

Related