Skip to content

[FEATURE] Introduce new code highlight default - #1410

Merged
jaapio merged 1 commit into
mainfrom
feature/highlight-node
Oct 6, 2026
Merged

jaapio merged 1 commit into
mainfrom
feature/highlight-node

Conversation

@jaapio

@jaapio jaapio commented Oct 4, 2026 •

Copy link
Copy Markdown
Member

Before code highlight default could only be set with a directive in RST or via the default setting in the project config. This change introduces a new system to set the default language using a none printable node HightlightNode

The added compiler pass will update all codenodes in the AST to have the default value which starts at the moment the highlightnode is detected.

For backward compatibility the highlight directive still sets the default language on the parser context, but this will be removed in the future. Consumers of this method are recommented to switch to the new system by implementing the ConsumesDefaultHighlightLanguage interface. Nodes implementing this interface will automatically get the default language when one is set.

See: #1411

@jaapio jaapio changed the title Introduce new code highlight default [FEATURE] Introduce new code highlight default Oct 4, 2026
@jaapio
jaapio requested a review from linawolf October 4, 2026 19:58
@jaapio
jaapio force-pushed the feature/highlight-node branch from b972209 to f5391e5 Compare October 4, 2026 20:08
@jaapio
jaapio marked this pull request as ready for review October 4, 2026 20:09
@jaapio
jaapio force-pushed the feature/highlight-node branch from f5391e5 to 509a388 Compare October 4, 2026 20:09
@linawolf

linawolf commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

I think it would be good to add an integration test demonstrating the highlighter directive

Before code highlight default could only be set with a directive in
RST or via the default setting in the project config. This change introduces
a new system to set the default language using a none printable node `HightlightNode`

The added compiler pass will update all codenodes in the AST to have the default value
which starts at the moment the highlightnode is detected.

For backward compatibility the highlight directive still sets the default language on the
parser context, but this will be removed in the future. Consumers of this method are recommented
to switch to the new system by implementing the ConsumesDefaultHighlightLanguage interface.
Nodes implementing this interface will automatically get the default language when one is set.
@jaapio
jaapio force-pushed the feature/highlight-node branch from 509a388 to 5ab75d3 Compare October 6, 2026 19:22
@jaapio
jaapio enabled auto-merge October 6, 2026 19:22
@jaapio
jaapio merged commit 7de5f07 into main Oct 6, 2026
57 checks passed
@jaapio
jaapio deleted the feature/highlight-node branch October 6, 2026 19:26
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.

2 participants