mermaid-it-markdown
TypeScript icon, indicating that this package has built-in type declarations

1.0.8 • Public • Published

MermaidItMarkdown

一个将让 markdown-it 支持 mermaid 语法的插件

安装

本插件依赖 mermaid 库,所以同时需要安装 mermaid

npm install mermaid-it-markdown mermaid --save

# or

yarn add mermaid-it-markdown mermaid

使用

  • 在 markdown-it 中使用
const md = require('markdown-it')()
const mermaidItMarkdown = require('mermaid-it-markdown')
md.use(mermaidItMarkdown)
  • 在 mavon-editor 中使用
import MavonEditor from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'
import mermaidItMarkdown from 'mermaid-it-markdown'

const markdownIt = MavonEditor.mavonEditor.getMarkdownIt();
markdownIt.use(mermaidItMarkdown)
  • markdown 语法
    ```mermaid
    flowchart TD
        A[Hard] -->|Text| B(Round)
        B --> C{Decision}
        C -->|One| D[Result 1]
        C -->|Two| E[Result 2]
    ```

更多语法请参考 mermaid在线示例

Package Sidebar

Install

npm i mermaid-it-markdown

Weekly Downloads

198

Version

1.0.8

License

MIT

Unpacked Size

9.15 kB

Total Files

8

Last publish

Collaborators

  • fangjc1986