Mermaid Tool for Editor.js
npm install editorjs-mermaid!Version of EditorJS that the plugin is compatible with
Provides Mermaid Blocks for the Editor.js.
Get the package
``shell`
npm i --save editorjs-mermaid
Include module at your application
`javascript`
const MermaidTool = require('editorjs-mermaid');
1. Upload folder dist from repositorydist/bundle.js
2. Add file to your page.
You can load specific version of package from jsDelivr CDN.
https://cdn.jsdelivr.net/npm/@editorjs/header@latest
Then require this script on page with Editor.js through the tag.
Add a new Tool to the tools property of the Editor.js initial config.
If you want to configure mermaid, use the onReady property of Editor.js.
`javascript
var editor = EditorJS({
...
tools: {
...
mermaid: MermaidTool,
},
...
onReady: () => {
MermaidTool.config({ 'theme': 'neutral' })
}
...
});
`
| Field | Type | Description |
| ------- | -------- | ------------------ |
| caption | string | caption |string
| code | | mermaid code |
`json``
{
"type": "header",
"data": {
"caption": "flowchart sample",
"code": "flowchart LR\nA-->B"
}
}