Markdown
Renders retained Markdown, including an incremental mode for streaming content.
Loading interactive demo…
let mut markdown = Markdown::with_text("Build **native** interfaces.");
markdown.element("note").w(290.0)#Import
cargo add quickgui --features markdownuse quickgui::Markdown;#Usage
let mut markdown = Markdown::with_text("Build **native** interfaces.");
markdown.element("note").w(290.0)#API reference
Expand an entry for its description and complete signature. A dash means no declaration default is documented.
Markdown
View sourcepub fn new() -> Selfwith_textpub fn with_text(text: &str) -> Self—
textpub fn text(&self) -> &str—
block_countpub fn block_count(&self) -> usize—
is_streamingpub const fn is_streaming(&self) -> bool—
is_truncatedpub const fn is_truncated(&self) -> bool—
stylepub const fn style(&self) -> MarkdownStyle—
set_stylepub fn set_style(&mut self, style: MarkdownStyle) -> bool—
Configures set style for this part.
pub fn set_style(&mut self, style: MarkdownStyle) -> boolView sourceset_streamingpub fn set_streaming(&mut self, streaming: bool) -> bool—
Configures set streaming for this part.
pub fn set_streaming(&mut self, streaming: bool) -> boolView sourceset_textpub fn set_text(&mut self, text: &str) -> MarkdownUpdate—
Point the retained document at new controlled source. Append-only changes reuse the settled prefix. Rewrites and link reference definitions fall back to a bounded full parse. Input beyond [`MAX_MARKDOWN_SOURCE_BYTES`] is truncated at a UTF-8 boundary.
pub fn set_text(&mut self, text: &str) -> MarkdownUpdateView sourceMarkdown::element
View sourcepub fn element(&mut self, id: impl Into<ElementId>) -> ElementRender the document as ordinary native QuickGUI elements.
Markdown::element_with_code_blocks
View sourcepub fn element_with_code_blocks<R>( &mut self, id: impl Into<ElementId>, mut renderer: R, ) -> Element where R: for<'source> FnMut(MarkdownCodeBlock<'source>) -> Element,Render code blocks with a caller-supplied component factory. Parsing remains owned by this retained Markdown model; the callback only replaces the element for each parsed code block. Keep any component state used by the callback in the owning view and key it by [`MarkdownCodeBlock::element_id`].
Markdown::element_with_highlighted_code_blocks
View sourcepub fn element_with_highlighted_code_blocks( &mut self, id: impl Into<ElementId>, style: CodeBlockStyle, max_height: f32, ) -> ElementRender parsed code blocks through retained [`CodeBlock`] components. This convenience is available when both `markdown` and `editor` are enabled. Each parsed block keeps independent virtual-scroll state. `max_height` is sanitized to a finite value; shorter blocks use their natural logical-line height.
