markdown-it-markmap

0.1.0 • Public • Published

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

Package Sidebar

Install

npm i markdown-it-markmap

Weekly Downloads

2

Version

0.1.0

License

MIT

Unpacked Size

7.3 kB

Total Files

5

Last publish

Collaborators

  • deiv