Skip to main content

markdown

Function markdown 

Source
pub fn markdown(
    source: impl Into<SharedString>,
    cx: &mut App,
) -> MarkdownElement
Expand description

Create a markdown element from source text.

This is a convenience function that creates the entity and element in one step. For more control, use Markdown::new() and MarkdownElement::new() separately.

Note that this mints a new entity on every call. Called from a render, the document gets a new element id every frame, which a screen reader reads as the whole document being replaced. Hold an Entity<Markdown> — which text selection needs anyway — for anything longer-lived than a one-shot.