2.0.0-alpha.2 • Published 3 years ago

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

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

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

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

Install

  • npm

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

    yarn add @yozora/html-delete

Usage

  • Basic:

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

Related