Expand description
§treemd
A markdown navigator library with tree-based structural navigation and syntax highlighting.
This library provides tools for parsing markdown documents, extracting their heading structure, and building hierarchical trees. It’s designed to power both interactive TUI applications and programmatic markdown analysis.
§Features
- Parse markdown and extract heading hierarchy
- Build tree structures from flat heading lists
- Filter and search headings
- Extract sections by heading name
- Interactive TUI with dual-pane interface
- Syntax-highlighted code blocks (50+ languages)
§Example
use treemd::{parse_markdown, Document};
let markdown = r#"
Some content here.
# Background
More details.
# Methodology
Research approach.
"#;
let doc = parse_markdown(markdown);
println!("Found {} headings", doc.headings.len());
// Filter headings by text
let filtered = doc.filter_headings("method");
for heading in filtered {
println!("{} {}", "#".repeat(heading.level), heading.text);
}
// Build a tree structure
let tree = doc.build_tree();
for node in &tree {
println!("{}", node.render_box_tree("", true));
}Re-exports§
pub use config::Config;pub use parser::Document;pub use parser::Heading;pub use parser::HeadingNode;pub use parser::parse_file;pub use parser::parse_markdown;pub use tui::App;