fix: stop single-line string rules at line ends - #21
Merged
davatron5000 merged 2 commits intoSep 2, 2026
Merged
Conversation
# Conflicts: # test/highlight.spec.pw.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change?
I split this out from #18 for ease of reviewing
the context is something like some.css (which I was trying to highlight).
a single stray apostrophe highlights the rest of the file as a string. for example, in:
everything from the
'inDon'tto the one inWon'tcomes out asstring, and similarly in yaml.the issue was that single-line string rules didn't exclude line breaks. elsewhere,
javascript.jsandpython.jsalready use[^"\\\r\n], andtoml's single-quoted rule does too, so this adds the same behaviour to grammars that were missing it(I've left alone the languages where a raw newline inside a quoted string is legal, assuming it was deliberate)
yaml does allow quoted scalars to fold over lines (I learned), but only onto more-indented ones, so I handle that case as well ...
and one more (unrelated) issue, which I'm happy to split out into further PR if you like: a number of block at-rules were missing and being highlighted as selectors.
happy to make any and all changes, or feel free to directly push changes 🙏
Checklist
npm testpasses locallydocs/index.html) if behavior changedCONTRIBUTING.mdSize impact
none