Closed iFreilicht closed 8 months ago
We'd prefer to do this with a multi-matcher rather than nesting, see an example:
https://github.com/highlightjs/highlight.js/blob/main/src/languages/ruby.js#L247
And you could just use inherit to update the existing rule...
hljs.inherit(HASH_COMMENT_MODE,
// the changes you want to merge in
{
match: // ...
}
Okay, done! I had to set begin and end to undefined
, they seems to be incompatible with match.
Changes to minified artifacts in /build
, after gzip compression.
Total change +75 B
Changes to minified artifacts in /build
, after gzip compression.
Total change +69 B
In POSIX shells, the
#
needs to be after a whitespace or start-of-line to delimit a comment. Compare:This is fixed with this PR.
I checked a few other languages as well that use #-delimited comments, but it seems this behaviour is unique to bash and other POSIX shells.
Fixes #3917
Changes
Inside the bash mode,
HASH_COMMENT_MODE
was wrapped in another mode that prevents a match if the#
is not after the start of the line or a whitespace character.Checklist
CHANGES.md