Skip to content

Conversation

Fro-Q
Copy link

@Fro-Q Fro-Q commented Apr 24, 2025

Description

Use transformerMetaHighlight()

Use shiki's transformer to do meta highlight.

Support for multi-key line numbers notation in meta

Modified highlightLinePlugin() to support multi-key meta notation like add={1} remove={2}.

In details, markdown-it-attrs plugin will parse and remove the last {0} notation in meta string, e.g. js add={1} remove={2} => js add={1} remove=. The original handling add the line numbers back to token but without braces {}, causing transformerMetaHighlight() unable to match the notations. So the braces is added in this PR. Also make sure there is a space between language name and {0} notations.

Linked Issues

#4704

@brc-dd brc-dd force-pushed the main branch 2 times, most recently from c5a8428 to 8abbe29 Compare August 14, 2025 03:45
@brc-dd brc-dd force-pushed the main branch 2 times, most recently from 084cf43 to d3a1567 Compare August 20, 2025 14:41
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.

1 participant