R
I

ParseRule

A rule for parsing DOM (paste / HTML import) into a block or mark. `getAttrs` receives a real `HTMLElement` (only ever called by the view); the type reference is compile-time only and introduces no runtime DOM dependency.

Signature

ts
interface ParseRule

Properties

PropertyTypeDescription
tag?readonlystring | undefinedCSS selector to match, e.g. `'a[href]'`, `'strong'`, `'h1'`.
style?readonlystring | undefinedInline-style match, e.g. `'font-weight=700'` (reserved for M2).
attrs?readonlyReadonly<Record<string, import("..").AttrValue>> | undefinedStatic attrs applied when the rule matches.
getAttrs?readonly((el: HTMLElement) => Attrs | false | null) | undefinedDerive attrs from the matched element; `false`/`null` rejects the match.
priority?readonlynumber | undefinedHigher priority rules are tried first.