Skip to main content

match_markdown_shortcut

Function match_markdown_shortcut 

Source
pub fn match_markdown_shortcut(
    block_text: &str,
    cursor_offset: usize,
) -> Option<MarkdownMatch>
Expand description

Match a markdown shortcut against block_text up to cursor_offset (UTF-16 code-unit offset, same unit the engine uses for selections).

Returns None when nothing matches — the caller should NOT dispatch anything. Returns Some(MarkdownMatch) describing the selection + conversion to apply.

The block_text is expected to already be the entire paragraph’s text; we slice off ..cursor_offset here to match the TS loop.