Skip to content

refactor/use shiki's transformerMetaHighlight() and add support for multi-key meta notation like add={1} remove={2} #4718

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

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

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