Skip to content

Commit

Permalink
fix(javascript/typescript) allow empty block-comments (#2897)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hirse committed Dec 2, 2020
1 parent 612a551 commit 6a0c9f8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Grammar improvements:
- Type suffixes: 123UI (unsigned integer)
- Improves directives detection and adds support for `Enable`, `Disable`, and `Then` keywords
- Adds more markup tests
- fix(javascript) Empty block-comments break highlighting (#2896) [Jan Pilzer][]
- enh(dart) Fix empty block-comments from breaking highlighting (#2898) [Jan Pilzer][]
- enh(dart) Fix empty doc-comment eating next line [Jan Pilzer][]

Expand Down
2 changes: 1 addition & 1 deletion src/languages/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export default function(hljs) {
]
};
const JSDOC_COMMENT = hljs.COMMENT(
'/\\*\\*',
/\/\*\*(?!\/)/,
'\\*/',
{
relevance: 0,
Expand Down
9 changes: 9 additions & 0 deletions test/markup/javascript/block-comments.expect.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<span class="hljs-comment">/* Block-Comment */</span>

<span class="hljs-comment">/* Can
Be
Multi-
Line
*/</span>

<span class="hljs-comment">/**/</span>
9 changes: 9 additions & 0 deletions test/markup/javascript/block-comments.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* Block-Comment */

/* Can
Be
Multi-
Line
*/

/**/

0 comments on commit 6a0c9f8

Please sign in to comment.