Exception thrown when a rewrite rule replaced an element with a new element that does not comply with the contract of its parent container.
Exception thrown when a rewrite rule replaced an element with a new element that does not comply with the contract of its parent container.
The element
property holds the offending element.
Collects elements by applying the partial function to all elements it is defined for, in depth-first traversal, including this element itself.
Collects elements by applying the partial function to all elements it is defined for, in depth-first traversal, including this element itself.
Extracts the text from the spans of this container, removing any formatting or links.
Extracts the text from the spans of this container, removing any formatting or links.
Defines a fallback for this element in case the renderer does not know how to deal with it.
Defines a fallback for this element in case the renderer does not know how to deal with it.
Invokes the specified function for each child of this element container, including children of children, and this element itself, in depth-first traversal.
Invokes the specified function for each child of this element container, including children of children, and this element itself, in depth-first traversal.
Returns a new, rewritten tree model based on the specified rule.
Returns a new, rewritten tree model based on the specified rule.
The rule is a partial function that takes an Element
and returns an Option[Element]
.
If the function is not defined for a specific element the old element remains
in the tree unchanged. If it returns None
then the node gets removed from the tree,
if it returns an element it will replace the old one. Of course the function may
also return the old element.
The rewriting is performed in a way that only branches of the tree that contain new or removed elements will be replaced. It is processed bottom-up, therefore any element container passed to the rule only contains children which have already been processed.
In case multiple rewrite rules need to be applied it may be more efficient to
first combine them with orElse
.
Selects all elements satisfying the specified predicate, collecting in depth-first traversal, including this element itself.
Selects all elements satisfying the specified predicate, collecting in depth-first traversal, including this element itself.
A special type of paragraph that serves as a render hint. Some renderers simplify the rendering of block elements containing only a single paragraph and render the span content inline (e.g. a
<li>
tag without a nested<p>
tag for the paragraph). Using this element as mandated by some edge cases in both the Markdown and reStructuredText markup definitions prevents this.