Skip to content

Function: markInputRule() ​

ts
function markInputRule(pattern, markType): InputRule;

Apply a mark when text matching pattern is typed, e.g. **bold**.

The pattern must end with $ and have two groups: group 1 is the whole delimited part (**bold**), group 2 the text that keeps the mark (bold). Anything matched before group 1 (such as a leading space) is left alone. Lookbehind is avoided on purpose: Safari before 16.4 does not support it.

Parameters ​

ParameterType
patternRegExp
markTypeMarkType

Returns ​

InputRule