Skip to content

prosekit/extensions/mark-rule

MarkRuleOptions

The options for defineMarkRule.

Properties

attrs?

optional attrs: null | Attrs | (match) => null | Attrs

Attributes to set on the mark. If a function is provided, it will be called with the matched result from the regular expression.

Default
ts
null

regex

regex: RegExp

The regular expression to match against. It must has a g flag to match all instances of the mark.

type

type: string | MarkType

The mark type to apply to the matched text.


defineMarkRule()

defineMarkRule(options): Extension<ExtensionTyping<any, any, any>>

A mark rule is something that can automatically apply marks to text if it matches a certain pattern, and remove them if it doesn't match anymore.

Parameters

options: MarkRuleOptions

Returns

Extension<ExtensionTyping<any, any, any>>