ratatui_toolkit/widgets/markdown_widget/foundation/elements/
mod.rs

1//! Markdown element for markdown rendering.
2//!
3//! Represents a single markdown element that can be rendered to ratatui.
4
5pub mod constants;
6pub mod constructors;
7pub mod enums;
8pub mod methods;
9
10pub use constants::{
11    get_language_icon, get_link_icon, heading_bg_color, heading_fg_color, CodeBlockColors,
12    CodeBlockTheme, BLOCKQUOTE_MARKER, BULLET_MARKERS, CHECKBOX_CHECKED, CHECKBOX_TODO,
13    CHECKBOX_UNCHECKED, HEADING_ICONS, HORIZONTAL_RULE_CHAR,
14};
15pub use enums::{
16    CheckboxState, CodeBlockBorderKind, ColumnAlignment, ElementKind, TableBorderKind, TextSegment,
17};
18pub use methods::{render, render_with_options, RenderOptions};
19
20/// A single markdown element that can be rendered to ratatui.
21#[derive(Debug, Clone, Default)]
22pub struct MarkdownElement {
23    /// The kind of element content.
24    pub kind: ElementKind,
25    /// The section this element belongs to (for collapse/expand).
26    /// None means this element is not part of any collapsible section.
27    pub section_id: Option<usize>,
28    /// The source line number (1-indexed) in the original markdown.
29    /// Used for double-click reporting. Default is 0 (unknown).
30    pub source_line: usize,
31}