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
//! Table of Contents widget for markdown document navigation.
//!
//! Provides a compact or expanded view of document headings for quick navigation.
//! In compact mode, shows heading indicators as horizontal lines.
//! In expanded mode, shows full heading text with indentation.
//!
//! # Features
//!
//! - Compact mode: horizontal lines indicating heading positions and levels
//! - Expanded mode: full heading text with hierarchy indentation
//! - Current heading highlight (blue in expanded, bright in compact)
//! - Hover highlight for items
//! - Click-to-scroll navigation
//!
//! # Mouse Capture Requirement
//!
//! For TOC click navigation and hover interactions to work, you must enable
//! mouse capture with crossterm:
//!
//! ```rust,ignore
//! use crossterm::event::{EnableMouseCapture, DisableMouseCapture};
//! execute!(stdout, EnterAlternateScreen, EnableMouseCapture)?;
//! ```
//!
//! Without `EnableMouseCapture`, click events will not be received.
//!
//! # Architecture
//!
//! The Toc extension is a UI widget only - it receives `&TocState` as a parameter
//! and ONLY handles rendering. State mutations happen through TocState methods.
pub use *;
pub use TocConfig;
pub use *;
use crateTocState;
/// Table of Contents widget for markdown navigation.
///
/// Shows document headings in either compact (lines) or expanded (text) mode.
/// Supports hover interactions and click-to-scroll navigation.
///
/// This is a UI-only widget that receives `&TocState` for state access.
/// State mutations happen through `TocState` methods, not here.
///
/// # Example
///
/// ```rust,no_run
/// use ratatui_toolkit::markdown_widget::extensions::toc::{Toc, TocConfig};
/// use ratatui_toolkit::markdown_widget::state::toc_state::TocState;
///
/// let mut toc_state = TocState::new();
/// let toc = Toc::new(&toc_state)
/// .config(TocConfig::default())
/// .expanded(true);
/// ```