Documentation
¶
Overview ¶
Package mindmap turns a note's Markdown outline (its headings and nested list items) into a Mermaid `mindmap` diagram. It's the terminal/agent counterpart to the web app's interactive mind map: `nt mindmap <note>` (and the MCP nt_mindmap tool) emit a ```mermaid``` fence an agent can drop straight into a note — where nt's own web viewer, Obsidian, or GitHub render it.
The parser is a deliberately small line scanner (headings + lists, skipping fenced code) rather than a full Markdown AST: notes are simple, the mapping is the markmap model (H1 trunk → headings branches → bullets leaves), and a pure function is trivially unit-tested.
Index ¶
Constants ¶
const MaxNodes = 400
MaxNodes bounds a single map so a pathological note can't produce a runaway diagram (mirrors the web view's cap).
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Node ¶
Node is one entry in the outline tree (the root carries the note title).
func Outline ¶
Outline parses a note body into a tree rooted at the title. Headings nest by level; a list under a heading (or before the first heading, under the root) contributes its items, with sub-lists nested by indentation. Fenced code blocks and plain paragraphs are ignored — a mind map is the skeleton.
func WikiTree ¶
WikiTree builds a breadth-first mind-map tree rooted at `root`, radiating along resolved [[wikilinks]] between notes (undirected, up to maxDepth hops). It's the terminal/agent counterpart to the web app's "Links" map: notes only, each note appears once at its shortest distance, neighbors visited in title order.