treemd
A markdown navigator with tree-based structural navigation. Like tree, but interactive—navigate markdown documents using an expandable/collapsible heading tree with a synchronized content view.
Interactive TUI Mode
Navigate, edit, and interact with markdown documents in a beautiful dual-pane interface.
Dual-Pane Interface
Navigate outline while viewing synchronized content
Link Following
Follow markdown links with visual popup, supports anchors, files, wikilinks, and external URLs
Live Editing
Edit files in your default editor with auto-reload
Syntax Highlighting
50+ languages with full syntect integration
Fuzzy Search
Filter headings in real-time with press of /
Bookmarks
Mark positions and jump back with vim-style navigation
Powerful Query Language
jq-like syntax for extracting and filtering markdown elements. 50+ built-in functions for powerful document processing.
Element Selectors
.hAll headings.h2Level 2 headings.code[rust]Rust code blocks.linkAll links.tableTablesPipes & Functions
.h2 | textGet heading text[.h2] | countCount elements.link | urlGet URLs.h | select(contains("API"))Filter by content. | statsDocument statisticsCLI Examples
$ treemd -q '.h2' doc.md
Extract all h2 headings
$ cat doc.md | treemd -q '.code[python]'
Pipe markdown and extract Python code blocks
$ treemd -q '.h1[Features] > .h2' --query-output json doc.md
Get h2s under Features section as JSON
CLI Mode for Scripting
Non-interactive commands for pipelines and automation.
-l, --listList all headings
--treeTree visualization
-s, --sectionExtract section by name
--filterFilter headings by text
-L, --levelFilter by heading level
--countCount headings by level
-o jsonJSON output format
-q, --queryExecute query expression
--query-helpQuery language docs
Vim-Style Navigation
Navigate up/down
Jump to top/bottom
Jump to parent
Page down/up
Toggle expand
Follow links
Interactive mode
Search/filter
Set bookmark
Jump to bookmark
Edit in $EDITOR
Cycle theme
Install treemd
From crates.io
$ cargo install treemd
NetBSD
$ pkgin install treemd
Launch TUI
$ treemd README.md
Pre-built binaries available for Linux (x86_64, ARM64), macOS (Intel & Apple Silicon), and Windows.
Why treemd?
Unlike other tools...
- Tree-based navigation (like tree command)
- Expandable/collapsible heading outline
- Interactive TUI + CLI modes
- Query language for scripting
- Rich rendering with syntax highlighting
Perfect for...
- Exploring large documentation files
- Extracting sections from README files
- Scripting markdown transformations
- Comfortable terminal reading
- Claude Code CLAUDE.md workflows
Navigate Markdown Like Never Before
Tree-based exploration + interactive navigation + CLI scriptability.
Get Started on GitHub