Description
Describe the issue
Diff is looking for hunk header that looks like this:
@@ -<num>,<num> +<num>,<num> @@
However, it's OK to omit the second number of each pair in some cases, see https://www.gnu.org/software/diffutils/manual/html_node/Detailed-Unified.html
If a hunk contains just one line, only its start line number appears. Otherwise its line numbers look like ‘start,count’. An empty hunk is considered to start at the line that follows the hunk.
If a hunk and its context contain two or more lines, its line numbers look like ‘start,count’. Otherwise only its end line number appears. An empty hunk is considered to end at the line that precedes the hunk.
So these should also be valid, for example:
@@ -<num> +<num> @@
@@ -<num>,<num> +<num> @@
Which language seems to have the issue?
This is using diff.
Are you using highlight
or highlightAuto
?
highlight
Sample Code to Reproduce
See above
Expected behavior
The above examples should also be highlighted as hljs-meta
.
Additional context
I can see the exact regexp causing this at
highlight.js/src/languages/diff.js
Line 20 in 85b2042
It can probably be simply replaced with this:
/^@@ +-\d+(?:,\d+)? +\+\d+(?:,\d+)? +@@/