1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
//! # 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
//!
//! ```rust
//! use treemd::{parse_markdown, Document};
//!
//! let markdown = r#"
//! # Introduction
//! 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));
//! }
//! ```
/// Configuration module for persisting user preferences.
///
/// Provides configuration management for theme choices, UI settings, and terminal preferences.
/// Input handling module for stdin and file sources.
///
/// Provides robust input reading, format detection, and tree output parsing.
/// Parser module for markdown documents.
///
/// Provides functions to parse markdown files and content into structured documents.
/// TUI module for interactive terminal interface.
///
/// Provides the App and UI rendering functionality for building interactive
/// markdown viewers.
/// Query language module for jq-like markdown querying.
///
/// Provides a powerful query language for navigating and extracting
/// markdown structure, similar to jq for JSON.
///
/// ## Example
///
/// ```rust
/// use treemd::{parse_markdown, query};
///
/// let doc = parse_markdown("# Hello\n## World");
/// let results = query::execute(&doc, ".h2 | .text").unwrap();
/// assert_eq!(results.len(), 1);
/// ```
/// Keybindings module for customizable keyboard shortcuts.
///
/// Provides a flexible keybinding system that allows users to customize
/// keyboard shortcuts via configuration files.
// Re-export commonly used types for convenience
pub use Config;
pub use ;
pub use App;