ratatui_toolkit/widgets/markdown_widget/state/collapse_state/
mod.rs

1//! Collapse state for markdown widget.
2//!
3//! Manages section collapse/expand state with hierarchical support.
4
5pub mod constructors;
6pub mod methods;
7pub mod traits;
8
9pub use constructors::*;
10pub use methods::*;
11pub use traits::*;
12
13use std::collections::HashMap;
14
15/// Collapse state for markdown sections.
16///
17/// Tracks which sections are collapsed and their hierarchy.
18#[derive(Debug, Clone)]
19pub struct CollapseState {
20    /// Section collapse state: section_id -> is_collapsed.
21    sections: HashMap<usize, bool>,
22    /// Section hierarchy: section_id -> (level, parent_section_id).
23    hierarchy: HashMap<usize, (u8, Option<usize>)>,
24}