Skip to content

[BUGFIX] Let node transformers visit nodes kept outside the children - #1426

Open
linawolf wants to merge 1 commit into
mainfrom
task/definition-list-term-transformers
Open

linawolf wants to merge 1 commit into
mainfrom
task/definition-list-term-transformers

Conversation

@linawolf

@linawolf linawolf commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

[BUGFIX] Let node transformers visit nodes kept outside the children

A role or a substitution in a definition-list term is rendered exactly
as the parser created it, while the same role in a paragraph is
transformed. The compiler builds its shadow tree from getChildren()
only, and DefinitionListItemNode keeps its term and classifiers in
properties of their own. Each transformer that works on inline nodes
has to walk them itself, as the TYPO3 theme does.

The term is not the only such node. Code and menu captions, admonition
and sidebar titles, the type, default and options of a confval, the
argument of a general directive, the cells of a table, the image and
caption of a figure, the target of an image and the parts of a
bootstrap card or accordion item are kept the same way, and were just
as invisible. A substitution in a table cell, for example, was
rendered as "|known|".

Such nodes now implement HasAttachedNodes and name the nodes they keep
beside their children. The shadow tree visits attached nodes before
the children. A change inside an attached node is made in the attached
node itself, as its parent keeps it in a readonly property and cannot
take a copy. The attached node itself cannot be replaced or removed.

Admonitions, sidebars, confvals and cards are built by
DirectiveProcessPass at priority 100, after most built-in transformers,
so only transformers that run later reach their attached nodes.

Resolves #1425

Signed-off-by: linawolf
Assisted-By: Claude Opus 5.5 (1M context) noreply@anthropic.com

A role or a substitution in a definition-list term is rendered exactly
as the parser created it, while the same role in a paragraph is
transformed. The compiler builds its shadow tree from getChildren()
only, and DefinitionListItemNode keeps its term and classifiers in
properties of their own. Each transformer that works on inline nodes
has to walk them itself, as the TYPO3 theme does.

The term is not the only such node. Code and menu captions, admonition
and sidebar titles, the type, default and options of a confval, the
argument of a general directive, the cells of a table, the image and
caption of a figure, the target of an image and the parts of a
bootstrap card or accordion item are kept the same way, and were just
as invisible. A substitution in a table cell, for example, was
rendered as "|known|".

Such nodes now implement HasAttachedNodes and name the nodes they keep
beside their children. The shadow tree visits attached nodes before
the children. A change inside an attached node is made in the attached
node itself, as its parent keeps it in a readonly property and cannot
take a copy. The attached node itself cannot be replaced or removed.

Admonitions, sidebars, confvals and cards are built by
DirectiveProcessPass at priority 100, after most built-in transformers,
so only transformers that run later reach their attached nodes.

Resolves #1425

Signed-off-by: linawolf
Assisted-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@linawolf
linawolf force-pushed the task/definition-list-term-transformers branch from 7660c69 to 2fe982a Compare October 10, 2026 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Node transformers do not visit inline nodes in definition-list terms

1 participant