ratatui_toolkit/widgets/markdown_widget/state/collapse_state/methods/register_section.rs
1//! Register section method for CollapseState.
2
3use crate::widgets::markdown_widget::state::collapse_state::CollapseState;
4
5impl CollapseState {
6 /// Register section hierarchy (called during parsing).
7 ///
8 /// # Arguments
9 ///
10 /// * `section_id` - The ID of the section.
11 /// * `level` - The heading level (1-6).
12 /// * `parent_section_id` - The parent section's ID, if any.
13 pub fn register_section(
14 &mut self,
15 section_id: usize,
16 level: u8,
17 parent_section_id: Option<usize>,
18 ) {
19 self.hierarchy
20 .insert(section_id, (level, parent_section_id));
21 }
22}