Markdown
保持型の Markdown を描画し、ストリーミング内容向けの差分更新にも対応します。
デモを読み込み中…
let mut markdown = Markdown::with_text("Build **native** interfaces.");
markdown.element("note").w(290.0)#インポート
cargo add quickgui --features markdownuse quickgui::Markdown;#使い方
let mut markdown = Markdown::with_text("Build **native** interfaces.");
markdown.element("note").w(290.0)#API リファレンス
項目を展開すると説明と完全なシグネチャが表示されます。ダッシュは宣言に既定値が記載されていないことを示します。
Markdown
ソースを見るpub 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—
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>) -> ElementRender 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, ) -> 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.
