ratatui_toolkit/widgets/markdown_widget/widget/constructors/with_toc_state.rs
1//! TOC state constructor for MarkdownWidget.
2
3use crate::widgets::markdown_widget::state::toc_state::TocState;
4use crate::widgets::markdown_widget::widget::MarkdownWidget;
5
6impl<'a> MarkdownWidget<'a> {
7 /// Set the TOC state for the widget.
8 ///
9 /// When a TOC state is provided, the widget can use it for TOC rendering
10 /// and navigation.
11 ///
12 /// # Arguments
13 ///
14 /// * `toc_state` - The TOC state containing entries and hover information
15 ///
16 /// # Returns
17 ///
18 /// Self for method chaining.
19 pub fn with_toc_state(mut self, toc_state: &'a TocState) -> Self {
20 self.toc_state = Some(toc_state);
21 self
22 }
23}