Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

wrappingInputRule

Build an input rule for automatically wrapping a textblock when a given string is typed. The regexp argument is directly passed through to the InputRule constructor. You'll probably want the regexp to start with ^, so that the pattern can only occur at the start of a textblock.

nodeType is the type of node to wrap in. If it needs attributes, you can either pass them directly, or pass a function that will compute them from the regular expression match.

By default, if there's a node with the same type above the newly wrapped node, the rule will try to join those two nodes. You can pass a join predicate, which takes a regular expression match and the node before the wrapped node, and can return a boolean to indicate whether a join should happen.

function wrappingInputRule(
regexp: RegExp,
nodeType: NodeType,
getAttrs?: Attrs | null | ((matches: RegExpMatchArray) => Attrs | null),
joinPredicate?: (match: RegExpMatchArray, node: Node) => boolean,
): InputRule;
§
wrappingInputRule(regexp: RegExp, nodeType: NodeType, getAttrs?: Attrs | null | ((matches: RegExpMatchArray) => Attrs | null), joinPredicate?: (match: RegExpMatchArray, node: Node) => boolean): InputRule
[src]

§Parameters

§
regexp: RegExp
[src]
§
nodeType: NodeType
[src]
§
getAttrs?: Attrs | null | ((matches: RegExpMatchArray) => Attrs | null) optional
[src]
§
joinPredicate?: (match: RegExpMatchArray, node: Node) => boolean optional
[src]