Skip to main content

MarkdownPlugin

Trait MarkdownPlugin 

Source
pub trait MarkdownPlugin:
    Send
    + Sync
    + 'static {
    // Required methods
    fn name(&self) -> &str;
    fn parse(
        &self,
        node: &Node,
        cx: &MarkdownParseContext<'_>,
    ) -> Option<MarkdownNode>;
    fn render(
        &self,
        node: &MarkdownNode,
        window: &mut Window,
        cx: &mut App,
    ) -> impl IntoElement;

    // Provided method
    fn is_block(&self) -> bool { ... }
}
Expand description

A reusable Markdown extension that parses and renders one custom node.

Required Methods§

Source

fn name(&self) -> &str

Stable name for nodes produced by this plugin.

Source

fn parse( &self, node: &Node, cx: &MarkdownParseContext<'_>, ) -> Option<MarkdownNode>

Convert an mdast node into a custom Markdown node.

Source

fn render( &self, node: &MarkdownNode, window: &mut Window, cx: &mut App, ) -> impl IntoElement

Render a custom Markdown node produced by this plugin.

Provided Methods§

Source

fn is_block(&self) -> bool

Whether this plugin produces block-level nodes.

Plugins are inline by default. TextView does not support inline custom Markdown rendering yet, so block plugins should return true.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§