ratatui_toolkit/widgets/markdown_widget/state/collapse_state/methods/
toggle_section.rs

1//! Toggle section collapse method for CollapseState.
2
3use crate::widgets::markdown_widget::state::collapse_state::CollapseState;
4
5impl CollapseState {
6    /// Toggle the collapse state of a section.
7    ///
8    /// # Arguments
9    ///
10    /// * `section_id` - The ID of the section to toggle.
11    pub fn toggle_section(&mut self, section_id: usize) {
12        let is_collapsed = self.sections.entry(section_id).or_insert(false);
13        *is_collapsed = !*is_collapsed;
14    }
15}