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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
//! Markdown rendering widget for ratatui applications.
//!
//! Provides a feature-rich markdown viewer with optional extensions:
//! - Table of contents (TOC)
//! - Syntax highlighting
//! - Text selection
//! - Click-to-highlight line selection
//!
//! # Mouse Capture Requirement
//!
//! For mouse interactions (click, drag, hover) to work, you must enable
//! mouse capture with crossterm:
//!
//! ```rust,ignore
//! use crossterm::event::{EnableMouseCapture, DisableMouseCapture};
//!
//! // On startup:
//! execute!(stdout, EnterAlternateScreen, EnableMouseCapture)?;
//!
//! // On cleanup:
//! execute!(stdout, LeaveAlternateScreen, DisableMouseCapture)?;
//! ```
//!
//! Without `EnableMouseCapture`, scroll wheel may still work (terminal-dependent),
//! but click events will not be received.
//!
//! # Example (Recommended - Unified State)
//!
//! ```rust,ignore
//! use ratatui_toolkit::{MarkdownWidget, MarkdownState};
//!
//! // Create unified state
//! let mut state = MarkdownState::default();
//! state.source.set_content("# Hello World\n\nWelcome!");
//!
//! // Create widget from state
//! let content = state.content().to_string();
//! let widget = MarkdownWidget::from_state(&content, &mut state)
//! .show_toc(true)
//! .show_statusline(true)
//! .show_scrollbar(true);
//! ```
//!
//! # Example (Individual State Modules)
//!
//! ```rust,ignore
//! use ratatui_toolkit::markdown_widget::{MarkdownWidget, state::*};
//!
//! // Create state modules
//! let mut scroll = ScrollState::default();
//! let mut source = SourceState::default();
//! let mut cache = CacheState::default();
//! let display = DisplaySettings::default();
//! let mut collapse = CollapseState::default();
//! let mut expandable = ExpandableState::default();
//! let mut git_stats = GitStatsState::default();
//! let mut vim = VimState::default();
//! let mut selection = SelectionState::default();
//! let mut double_click = DoubleClickState::default();
//!
//! // Create widget with individual state modules
//! let widget = MarkdownWidget::new(
//! content,
//! &mut scroll,
//! &mut source,
//! &mut cache,
//! &display,
//! &mut collapse,
//! &mut expandable,
//! &mut git_stats,
//! &mut vim,
//! &mut selection,
//! &mut double_click,
//! )
//! .show_toc(true)
//! .show_statusline(true)
//! .show_scrollbar(true);
//! ```
// Core modules
// Internal re-exports for cross-module use
// ============================================================================
// Foundation (always available)
// ============================================================================
// Elements
pub use ;
// Element methods
pub use ;
// Parser
pub use render_markdown_to_elements;
// Source
pub use MarkdownSource;
// Events
pub use ;
// Types
pub use ;
// Functions
pub use ;
// ============================================================================
// Widget
// ============================================================================
pub use MarkdownWidgetMode;
pub use MarkdownWidget;
// ============================================================================
// State (always required)
// ============================================================================
pub use ;
// ============================================================================
// Extensions (toggleable)
// ============================================================================
// TOC
pub use ;
// Theme
pub use ;
// Selection handlers
pub use ;