本文へスキップ

Markdown

保持型の Markdown を描画し、ストリーミング内容向けの差分更新にも対応します。

デモを読み込み中…

#インポート

cargo add quickgui --features markdown
use quickgui::Markdown;

#使い方

let mut markdown = Markdown::with_text("Build **native** interfaces.");
markdown.element("note").w(290.0)

#API リファレンス

項目を展開すると説明と完全なシグネチャが表示されます。ダッシュは宣言に既定値が記載されていないことを示します。

pub fn new() -> Self
with_textpub fn with_text(text: &str) -> Self—

Configures with text for this part.

pub fn with_text(text: &str) -> Self
ソースを見る
textpub fn text(&self) -> &str—

Configures text for this part.

pub fn text(&self) -> &str
ソースを見る
block_countpub fn block_count(&self) -> usize—

Configures block count for this part.

pub fn block_count(&self) -> usize
ソースを見る
is_streamingpub const fn is_streaming(&self) -> bool—

Configures is streaming for this part.

pub const fn is_streaming(&self) -> bool
ソースを見る
is_truncatedpub const fn is_truncated(&self) -> bool—

Configures is truncated for this part.

pub const fn is_truncated(&self) -> bool
ソースを見る
stylepub const fn style(&self) -> MarkdownStyle—

Configures style for this part.

pub 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) -> bool
ソースを見る
set_streamingpub fn set_streaming(&mut self, streaming: bool) -> bool—

Configures set streaming for this part.

pub fn set_streaming(&mut self, streaming: bool) -> bool
ソースを見る
set_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) -> MarkdownUpdate
ソースを見る

Markdown::element

ソースを見る
pub fn element(&mut self, id: impl Into<ElementId>) -> Element

Render the document as ordinary native QuickGUI elements.

Markdown::element_with_code_blocks

ソースを見る
pub 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

ソースを見る
pub fn element_with_highlighted_code_blocks( &mut self, id: impl Into<ElementId>, style: CodeBlockStyle, max_height: f32, ) -> Element

Render 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.