Skip to content

deiv/markdown-it-markmap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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