Skip to content

Latest commit

 

History

History
67 lines (48 loc) · 1.15 KB

README.md

File metadata and controls

67 lines (48 loc) · 1.15 KB

markdown-it-markmap

Markmap plugin for markdown-it markdown parser.

With this plugin you can create mindmap using markmap.

It adds a named fence mindmap to the markdown parser.

Installation

$ yarn add https://github.com/deiv/markdown-it-markmap.git

Usage

Configure the plugin in markdown-it:

var markdownIt = require('markdown-it');
var markdownItMarkmap = require('../build/index');

const mdi = markdownIt();
mdi.use(markdownItMarkmap);

let mindmapContent = `
\`\`\`mindmap
# root
## child1
  - child3
## child2
  - child3
\`\`\``;


console.log(mdi.render(mindmapContent));

Add needed libraries in browser:

<script src="https://cdn.jsdelivr.net/npm/d3@5"></script>
<script src="https://cdn.jsdelivr.net/npm/markmap-lib@0.7.4/dist/browser/view.min.js"></script>
<script>
    const mindmaps = document.querySelectorAll('.markmap-svg');

    for(const mindmap of mindmaps) {
        markmap.markmap(mindmap, JSON.parse(mindmap.innerHTML));
    }
</script>

Example

Markdown example:

```mindmap
# root
## child1
  - child3
## child2
  - child3

License

MIT