markmap-cli
raw JSON → 0.18.12 verified Sat Apr 25 auth: no javascript
markmap-cli v0.18.12 is a command-line tool to convert Markdown files into interactive mind maps (markmaps). It uses the markmap library to parse Markdown and generate HTML output. This version requires Node.js >=18 and is ESM-only (no CommonJS support). Drop-in replacement for generating mindmap HTML from Markdown files. Frequently updated, with breaking changes in recent versions including async setData, INode type changes, and migration from Prism.js to highlight.js.
Common errors
error Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'markmap-cli' ↓
cause Attempting to require the ESM-only package using CommonJS require()
fix
Use import syntax: import markmap from 'markmap-cli' instead of require().
error TypeError: Cannot read properties of undefined (reading 'props') ↓
cause Using setData without await after v0.18.0
fix
Add await before mm.setData() call.
error Option '--offline' is not supported ↓
cause Using an older version of markmap-cli that did not have the offline option (added in v0.15.0)
fix
Update to v0.15.0 or later to use --offline flag.
Warnings
breaking Node data type changed to INode (breaking in v0.18.0) ↓
fix Update code to use INode type from markmap-common instead of FlextreeNode<INode>.
breaking setData is now asynchronous (breaking in v0.18.0) ↓
fix Await the promise returned by mm.setData() before accessing rendered DOM.
breaking Switched from Prism.js to highlight.js (breaking in v0.15.0) ↓
fix Update any syntax highlighting plugins or configuration to use highlight.js instead of Prism.
breaking Dropped CJS support (breaking in v0.15.0) ↓
fix Use ESM imports (import syntax) instead of require(). Project must have type: module or use .mjs extensions.
deprecated Prism.js removed in v0.15.0, highlighting is now highlight.js ↓
fix Use highlight.js compatible themes and configuration. Prism-specific plugins will not work.
gotcha Script must be run as a module or with top-level await for async operations ↓
fix Ensure your environment supports ESM (e.g., type:module in package.json).
Install
npm install markmap-cli yarn add markmap-cli pnpm add markmap-cli Imports
- default (CLI) wrong
npx markmap input.mdcorrectnpx markmap-cli input.md - default (programmatic) wrong
const markmap = require('markmap-cli')correctimport markmap from 'markmap-cli' - INode wrong
import { INode } from 'markmap-cli'correctimport { INode } from 'markmap-common'
Quickstart
npx markmap-cli@0.18.12 README.md -o mindmap.html