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

2.0.0-alpha.2 • Public • Published

@yozora/html-paragraph


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

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

Install

  • npm

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

    yarn add @yozora/html-paragraph

Usage

  • Basic:

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

Related

Package Sidebar

Install

npm i @yozora/html-paragraph

Weekly Downloads

1

Version

2.0.0-alpha.2

License

MIT

Unpacked Size

6.39 kB

Total Files

6

Last publish

Collaborators

  • lemonclown