Transform Markdown to data used by markmap.


$ yarn add markmap-lib


Parse Markdown and create a node tree, return the root node and a features object containing the active features during parsing.

Transform Markdown to markmap data:

import { Transformer } from 'markmap-lib';

const transformer = new Transformer();

// 1. transform Markdown
const { root, features } = transformer.transform(markdown);

// 2. get assets
// either get assets required by used features
const { styles, scripts } = transformer.getUsedAssets(features);

// or get all possible assets that could be used later
const { styles, scripts } = transformer.getAssets(features);

Now we have the data for rendering. See markmap-view for how to use them.