2.0.0-alpha.2 • Published 2 years ago

@yozora/html-image 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 IImage produced by @yozora/tokenizer-image into HTML string.

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

Install

  • npm

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

    yarn add @yozora/html-image

Usage

  • Basic:

    import type { IImage } from '@yozora/ast'
    import renderImage from '@yozora/html-image'
    
    const image: IImage = {
      "type": "image",
      "url": "https://github.com/favicon.svg/",
      "alt": "github favicon",
      "title": "github favicon"
    }
    renderImage(image)
    // => <img class="yozora-image" alt="github favicon src="https://github.com/favicon.svg/" title="github favicon"

Related