Expand description
Markdown shortcut, special-character, and inline-mark matchers for the devup editor input-rule pipeline.
Every matcher is a pure function of (block_text, cursor_offset):
no DOM, no editor handle, no commands. The React layer calls into
these matchers, inspects the returned [Match] payload, and
synthesises the appropriate dispatchBatch sequence on the JS
side. This keeps command dispatch (which needs an EditorHandle)
in React and confines the hot-path string work to Rust.
The regex patterns, delimiter rules, and skip-~~ reservation are
mirrored byte-for-byte from the TypeScript source so behaviour is
identical under typical clipboard / keyboard interactions.
Structs§
- Inline
Match - Match payload for the seven delimiter-pair marks (bold, italic *2, strike, underline, highlight, code).
- Link
Match - Match payload specifically for
[text](url). Carries both the text and the URL so the React side can storehrefon the mark. - Markdown
Match - Result of a successful markdown-shortcut match. The dispatch side
(React + WASM) turns this into
setSelection(0..prefix_len)+Backspace+SetBlockType(block_type, props). - Special
Char Match - Matched trigger and its replacement, ready for the React side to
dispatch
setSelection(start..start+trigger_len)+Backspace+InsertText(replacement).
Enums§
- Mark
Kind - The eight kinds of inline-mark matchers exposed to callers. Using an enum (rather than eight separate free functions) keeps the WASM boundary narrow — JS passes a tag string, Rust dispatches.
Functions§
- match_
inline_ mark - Run the matcher associated with
kindagainstblock_textup tocursor_offset(UTF-16 units). ReturnsNonewhen no match. - match_
markdown_ shortcut - Match a markdown shortcut against
block_textup tocursor_offset(UTF-16 code-unit offset, same unit the engine uses for selections). - match_
special_ char - Scan
block_text[..cursor_offset]for a trailing trigger and return the replacement info, orNonewhen nothing matched.