Skip to content

Products / Developer tools

treemd

treemd is like tree, but interactive: navigate markdown documents through an expandable and collapsible heading tree with a synchronized content view. It also has a jq-like query language and a non-interactive CLI mode for scripting.

GitHub Talk to usRustTUICLIOpen source
From crates.io
cargo install treemd
50+
Languages syntax highlighted
50+
Built-in query functions

Features

Built for production

01

Dual-pane interface

Navigate the heading outline while viewing synchronized content.

02

Link following

Follow markdown links with a visual popup. Anchors, files, wikilinks and external URLs are supported.

03

Live editing

Edit files in your default editor with automatic reload.

04

Syntax highlighting

50+ languages with full syntect integration.

05

Fuzzy search

Filter headings in real time by pressing /.

06

Bookmarks

Mark positions and jump back with vim-style navigation.

07

jq-like query language

Extract and filter markdown elements such as headings, code blocks, links and tables, with pipes and 50+ built-in functions.

08

CLI mode for scripting

Non-interactive flags for listing headings, tree output, section extraction, filtering, counting and JSON output, for use in pipelines and automation.

In code

See it work

Install and launch
cargo install treemd
treemd README.md
Query examples
treemd -q '.h2' doc.md
cat doc.md | treemd -q '.code[python]'
treemd -q '.h1[Features] > .h2' --query-output json doc.md

Query language

Element selectors: `.h` (all headings), `.h2` (level 2 headings), `.code[rust]` (Rust code blocks), `.link` (all links) and `.table` (tables).

Pipes and functions: `.h2 | text` returns heading text, `[.h2] | count` counts elements, `.link | url` returns URLs, `.h | select(contains("API"))` filters by content and `. | stats` reports document statistics.

CLI flags

- `-l, --list`: list all headings - `--tree`: tree visualization - `-s, --section`: extract a 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 a query expression - `--query-help`: query language documentation

Vim-style navigation

- `j/k`: move up and down - `g/G`: jump to top or bottom - `p`: jump to parent - `d/u`: page down or up - `Space`: toggle expand - `f`: follow links - `/`: search and filter - `m` and `'`: set and jump to a bookmark - `e`: edit in $EDITOR - `t`: cycle theme

Installation options

Install from crates.io with `cargo install treemd`, or on NetBSD with `pkgin install treemd`. Pre-built binaries are available for Linux (x86_64, ARM64), macOS (Intel and Apple Silicon) and Windows.

Where it fits

treemd suits exploring large documentation files, extracting sections from README files, scripting markdown transformations, comfortable terminal reading and AI-assisted documentation workflows.

Putting treemd to work?

We help teams design, build and operate production systems on this stack.