pub trait MarkdownPlugin:
Send
+ Sync
+ 'static {
// Required methods
fn name(&self) -> &str;
fn parse(
&self,
node: &Node,
cx: &MarkdownParseContext<'_>,
) -> Option<MarkdownNode>;
// Provided methods
fn is_block(&self) -> bool { ... }
fn render(
&self,
node: &MarkdownNode,
_window: &mut Window,
_cx: &mut App,
) -> impl IntoElement { ... }
fn render_inline(
&self,
node: &MarkdownNode,
_context: &InlineRenderContext,
window: &mut Window,
cx: &mut App,
) -> Option<InlineElement> { ... }
}Expand description
A reusable Markdown extension that parses and renders one custom node.
Required Methods§
Sourcefn parse(
&self,
node: &Node,
cx: &MarkdownParseContext<'_>,
) -> Option<MarkdownNode>
fn parse( &self, node: &Node, cx: &MarkdownParseContext<'_>, ) -> Option<MarkdownNode>
Convert an mdast node into a custom Markdown node.
Provided Methods§
Sourcefn is_block(&self) -> bool
fn is_block(&self) -> bool
Whether this plugin produces block-level nodes.
Plugins are inline by default. Block plugins should return true.
Sourcefn render(
&self,
node: &MarkdownNode,
_window: &mut Window,
_cx: &mut App,
) -> impl IntoElement
fn render( &self, node: &MarkdownNode, _window: &mut Window, _cx: &mut App, ) -> impl IntoElement
Render a custom Markdown node produced by this plugin.
Sourcefn render_inline(
&self,
node: &MarkdownNode,
_context: &InlineRenderContext,
window: &mut Window,
cx: &mut App,
) -> Option<InlineElement>
fn render_inline( &self, node: &MarkdownNode, _context: &InlineRenderContext, window: &mut Window, cx: &mut App, ) -> Option<InlineElement>
Render an inline node using the existing render implementation.
Override this only when inherited layout context or an explicit baseline is needed.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".