Markdown Navigator

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.

50+
Languages
jq-like
Query Language
Vim
Keybindings
v0.4.1
Current Version

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
.tableTables

Pipes & Functions

.h2 | textGet heading text
[.h2] | countCount elements
.link | urlGet URLs
.h | select(contains("API"))Filter by content
. | statsDocument statistics

CLI 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, --list

List all headings

--tree

Tree visualization

-s, --section

Extract section by name

--filter

Filter headings by text

-L, --level

Filter by heading level

--count

Count headings by level

-o json

JSON output format

-q, --query

Execute query expression

--query-help

Query language docs

Vim-Style Navigation

j/k

Navigate up/down

g/G

Jump to top/bottom

p

Jump to parent

d/u

Page down/up

Space

Toggle expand

f

Follow links

i

Interactive mode

/

Search/filter

m

Set bookmark

'

Jump to bookmark

e

Edit in $EDITOR

t

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