pub trait InlineParser: Debug {
// Required methods
fn trigger(&self) -> &[u8] ⓘ;
fn parse(
&self,
arena: &mut Arena,
parent_ref: NodeRef,
reader: &mut BlockReader<'_>,
ctx: &mut Context,
) -> Option<NodeRef>;
// Provided method
fn close_block(
&self,
_arena: &mut Arena,
_node_ref: NodeRef,
_reader: &mut BlockReader<'_>,
_ctx: &mut Context,
) { ... }
}Expand description
A trait that parses an inline level element like CodeSpan, Link etc.
Required Methods§
Sourcefn trigger(&self) -> &[u8] ⓘ
fn trigger(&self) -> &[u8] ⓘ
Returns a list of characters that triggers Parse method of this parser. Trigger characters must be a punctuation or a halfspace. Halfspaces triggers this parser when character is any spaces characters or a head of line
Sourcefn parse(
&self,
arena: &mut Arena,
parent_ref: NodeRef,
reader: &mut BlockReader<'_>,
ctx: &mut Context,
) -> Option<NodeRef>
fn parse( &self, arena: &mut Arena, parent_ref: NodeRef, reader: &mut BlockReader<'_>, ctx: &mut Context, ) -> Option<NodeRef>
Parses the given block into an inline node.
Parse can parse beyond the current line. If Parse has been able to parse the current line, it must advance a reader position by consumed byte length.
Provided Methods§
Sourcefn close_block(
&self,
_arena: &mut Arena,
_node_ref: NodeRef,
_reader: &mut BlockReader<'_>,
_ctx: &mut Context,
)
fn close_block( &self, _arena: &mut Arena, _node_ref: NodeRef, _reader: &mut BlockReader<'_>, _ctx: &mut Context, )
close_block will be called when a block is closed.