Represents a ProseMirror document node. It holds a type, optional attributes, a content Fragment, marks, and (for text nodes) text.
Summary
Functions
Test whether the given node's content can be appended to this node. If that node's content is not empty, this is equivalent to checking whether the content can be inserted at the end.
Test whether replacing the range from..to (child indices) in this
node with the given replacement fragment would leave the node's
content valid. start and end_val optionally restrict which part
of the replacement is considered.
Test whether replacing the range from..to (child indices) with a
node of the given type would leave the node's content valid.
Check that this node's content is valid for its type.
Get the child node at the given index. Raises on out-of-range.
Find the child node after the given position. Returns {node, index, offset}.
Find the child node before the given position. Returns {node, index, offset}.
The number of children that this node has.
The list of children of this node.
Return a content match state that represents the match after the
first index children of this node.
Create a copy of this node with the given content.
Cut the text or content of this node between the given positions.
A human-readable debug representation of this node (equivalent to JS toString).
Call the given function for all descendant nodes.
Test whether this node is the same as another node (structurally equal).
Get the first child of this node, or nil.
Fold over all descendant nodes, threading an accumulator.
Call f for each child node, passing (node, offset, index).
Deserialize a node from its JSON representation.
Test whether this node has the given type, attributes, and marks.
True when this node allows inline content.
True when this is an atom node (a leaf node that is treated as a single unit).
True when this is a block node.
True when this is an inline node.
True when this is a leaf node.
True when this is a text node.
True when this is a textblock node (a block that contains inline content).
Get the last child of this node, or nil.
Create a copy of this node with a different set of marks.
Get the child node at the given index, or nil if out of range.
Find the node at the given position.
The size of this node as counted by the indexing scheme. For text nodes this is the text length, for leaf nodes it is 1, and for non-leaf nodes it is the content size + 2 (for the open and close tokens).
Invoke a callback for all descendant nodes between the given positions (relative to the start of this node's content). Passes the node, its absolute position, its parent node, and its index into the parent's child list.
Test whether the given range contains a mark of the given type.
Replace a range of the document with the given slice.
Resolve the given position in this document, returning a ResolvedPos.
Test whether the markup (type, attributes, marks) of this node is the same as that of another.
Extract a slice of the document between the given positions.
Get the text between from and to positions within this node.
Get the text content of this node.
Serialize this node to JSON.
Create a text node with the same type, attributes, and marks but different text.
Types
Functions
Test whether the given node's content can be appended to this node. If that node's content is not empty, this is equivalent to checking whether the content can be inserted at the end.
Test whether replacing the range from..to (child indices) in this
node with the given replacement fragment would leave the node's
content valid. start and end_val optionally restrict which part
of the replacement is considered.
Test whether replacing the range from..to (child indices) with a
node of the given type would leave the node's content valid.
Check that this node's content is valid for its type.
Validates content against the content expression, checks that all attributes are valid, and recursively checks children. Raises on any validation error.
Get the child node at the given index. Raises on out-of-range.
Find the child node after the given position. Returns {node, index, offset}.
Find the child node before the given position. Returns {node, index, offset}.
The number of children that this node has.
The list of children of this node.
Return a content match state that represents the match after the
first index children of this node.
Create a copy of this node with the given content.
Cut the text or content of this node between the given positions.
A human-readable debug representation of this node (equivalent to JS toString).
Call the given function for all descendant nodes.
Test whether this node is the same as another node (structurally equal).
Get the first child of this node, or nil.
Fold over all descendant nodes, threading an accumulator.
f receives (node, pos, parent, index, acc) and returns either:
acc— descend into children with updated accumulator{:skip, acc}— skip children, continue with updated accumulator
Call f for each child node, passing (node, offset, index).
Deserialize a node from its JSON representation.
Takes a schema and a JSON map. Handles text nodes specially.
Test whether this node has the given type, attributes, and marks.
True when this node allows inline content.
True when this is an atom node (a leaf node that is treated as a single unit).
True when this is a block node.
True when this is an inline node.
True when this is a leaf node.
True when this is a text node.
True when this is a textblock node (a block that contains inline content).
Get the last child of this node, or nil.
Create a copy of this node with a different set of marks.
Get the child node at the given index, or nil if out of range.
Find the node at the given position.
The size of this node as counted by the indexing scheme. For text nodes this is the text length, for leaf nodes it is 1, and for non-leaf nodes it is the content size + 2 (for the open and close tokens).
Invoke a callback for all descendant nodes between the given positions (relative to the start of this node's content). Passes the node, its absolute position, its parent node, and its index into the parent's child list.
When the callback returns false, descending into that node is skipped.
Test whether the given range contains a mark of the given type.
Replace a range of the document with the given slice.
Resolve the given position in this document, returning a ResolvedPos.
Test whether the markup (type, attributes, marks) of this node is the same as that of another.
Extract a slice of the document between the given positions.
Get the text between from and to positions within this node.
Get the text content of this node.
Serialize this node to JSON.
Create a text node with the same type, attributes, and marks but different text.