Skip to content
QuireKit MSFE
Developer docs
v0.0.0 · Experimental

Input and paste rules

Transform new input explicitly while preserving composition, bounded work and undo.

When rules are appropriate

Parser plugins interpret source. Input rules mutate newly typed text, such as replacing ::ok with [[done]] . Paste rules can translate a legacy [STATUS:DONE] token. Applications should enable such normalization explicitly and retain undo.

Install this complete module alongside the status node. Without that node, the replacement remains ordinary source.

recipes/rules.tsts

Handler coordinates and output

find is a regular expression. handler({ match, range, document }) receives a match and UTF-16 range after native input entered the text. Return exact replacement text or null to preserve input. Do not dispatch commands, perform I/O or mutate DOM inside the handler.

Use bounded document context when required. The example intentionally performs a global literal transformation, including matching text in code. A prose-only rule needs accurate syntax context and a policy for unconfirmed parsing; a regex alone is not Markdown semantic recognition.

Current work limits

  • Input rules inspect at most 512 logical units at the current line suffix. Matches must end at the input position; the first applicable rule wins.
  • Paste rules scan only newly inserted text. Individual inserted spans over 65,536 units remain unchanged.
  • Overlapping paste matches are not applied twice, and edits are sorted by source position.
  • Multiple selections, readonly and native composition bypass normal rule transformation. Programmatic commands are not keyboard-input triggers.

These are current bounded-work policies. Large imports need a separate reviewable import command, not assumptions about automatic normalization.

Verify scope and undo

Assert exact transformed source and one-step undo. Cover no match, empty matches, competing rules, multiple clipboard matches, identical text already in the document, oversized clipboard data, composition and readonly. Returning the original matched string does not add a redundant edit.

See Extension API. For display-only behavior use Markdown plugins rather than rewriting existing files.

MSFE · QuireKitYour Markdown source stays yours.