Skip to content

fix(bash): correctly highlight doctags in comments again (#4234) #4239

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 1 commit into
base: main
Choose a base branch
from

Conversation

wolfgang42
Copy link

Changes

Previously, because whitespace needed to be detected as part of the comment, but not highlighted that way, the match was split and only the second part of the match was assigned a scope. However, for reasons I couldn’t figure out, it seems that the presence of multiple scope values breaks the contains highlighting logic for a mode. (Or something to that effect.)

Rather than resolving whatever’s causing that problem, this PR changes the regex to use a lookbehind assertion, thus requiring the whitespace to be there without capturing it as part of the match.

I think this is a breaking change: #3890 says that negative lookbehinds aren’t allowed in Highlight.js until v12 because of Safari support; it seems like the same is true of positive lookbehind, in which case merging this requires a major version bump.

Closes #4234.

Checklist

  • Added markup tests, or they don't apply here because...
  • Updated the changelog at CHANGES.md

(Full disclosure: this patch was prepared with the assistance of an LLM. However I have prepared this PR description myself, and am confident that the changes are correct.)

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.

(bash) regression: “TODO” in comments no longer highlighted
2 participants