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

TagParseRule

Parse rule targeting a DOM element.

interface TagParseRule extends GenericParseRule {
contentElement?: string | HTMLElement | ((node: DOMNode) => HTMLElement);
getAttrs?: (node: HTMLElement) => Attrs | false | null;
getContent?: (node: DOMNode, schema: Schema) => Fragment;
namespace?: string;
node?: string;
preserveWhitespace?: boolean | "full";
tag: string;
}

§Extends

§Properties

§
contentElement?: string | HTMLElement | ((node: DOMNode) => HTMLElement)
[src]

For rules that produce non-leaf nodes, by default the content of the DOM element is parsed as content of the node. If the child nodes are in a descendent node, this may be a CSS selector string that the parser must use to find the actual content element, or a function that returns the actual content element to the parser.

§
getAttrs?: (node: HTMLElement) => Attrs | false | null
[src]

A function used to compute the attributes for the node or mark created by this rule. Can also be used to describe further conditions the DOM element or style must match. When it returns false, the rule won't match. When it returns null or undefined, that is interpreted as an empty/default set of attributes.

§
getContent?: (node: DOMNode, schema: Schema) => Fragment
[src]

Can be used to override the content of a matched node. When present, instead of parsing the node's child nodes, the result of this function is used.

§
namespace?: string
[src]

The namespace to match. Nodes are only matched when the namespace matches or this property is null.

§
node?: string
[src]

The name of the node type to create when this rule matches. Each rule should have either a node, mark, or ignore property (except when it appears in a node or mark spec, in which case the node or mark property will be derived from its position).

§
preserveWhitespace?: boolean | "full"
[src]

Controls whether whitespace should be preserved when parsing the content inside the matched element. false means whitespace may be collapsed, true means that whitespace should be preserved but newlines normalized to spaces, and "full" means that newlines should also be preserved.

§
tag: string
[src]

A CSS selector describing the kind of DOM elements to match.