JSON Options

JSON options are a group of options that can be serialized as JSON and embedded in Markdown.

Usage

Markdown Frontmatter

JSON options can be added to the frontmatter of your Markdown file as the value of markmap.

For example:

---
markmap:
  color:
    - blue
  # other options
---

Markdown content here

Markmap for VSCode

JSON options can be set as Default Options in gera2ld.markmap-vscode, so you don't have to modify frontmatter of each file.

For example:

{
	"color": ["blue"]
}

Option List

color

Type: string | string[], default: d3.schemeCategory10

A list of colors to use as the branch and circle colors for each node.

If none is provided, d3.schemeCategory10 will be used.

colorFreezeLevel

Type: number, default: 0

Freeze color at the specified level of branches, i.e. all child branches will use the color of their ancestor node at the freeze level.

0 for no freezing at all.

duration

Type: number, default: 500

The animation duration when folding/unfolding a node.

maxWidth

Type: number, default: 0

The max width of each node content. 0 for no limit.

initialExpandLevel

Type: number, default: -1

The maximum level of nodes to expand on initial render.

-1 for expanding all levels.

extraJs

Type: string[], default: none

A list of JavaScript URLs. This is useful to add more features like Katex plugins.

If a URL starts with npm:, it's treated as an npm package and resolved to a URL of the selected CDN based on the current network conditions.

extraCss

Type: string[], default: none

A list of CSS URLs. This is useful to add more features like Katex plugins.

If a URL starts with npm:, it's treated as an npm package and resolved to a URL of the selected CDN based on the current network conditions.

zoom

Type: boolean, default: true

Whether to allow zooming the markmap.

pan

Type: boolean, default: true

Whether to allow panning the markmap.

htmlParser

Type: { selector: string }

Pass options to the internal HTML parser, for example to override the default selectors for elements to display.

spacingHorizontal

Type: number, default: 80

spacingVertical

Type: number, default: 5

activeNode

Type: { placement: 'center' | 'visible' }, default: { placement: 'visible' }

Only available in markmap.js.org and gera2ld.markmap-vscode.

  • placement
    • visible - ensure the active node is in the viewport
    • center - center the active node

lineWidth

Type: number, since v0.18.8

The stroke width of lines between nodes.

Markmap Options

The JSON options represent a subset of the low-level options of Markmap as a tradeoff for portability.

If you are a developer and require more flexibility, you may check the low-level Markmap Options.