diff --git a/CHANGES.md b/CHANGES.md index e0b3e0ab7a..ad618eaedc 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,7 @@ New Grammars: Core Grammars: +- fix(bash) resolve regression in comment doctag highlighting [wolfgang42][] - enh(csp) add missing directives / keywords from MDN (7 more) [Max Liashuk][] - enh(ada) add new `parallel` keyword, allow `[]` for Ada 2022 [Max Reznik][] diff --git a/src/languages/bash.js b/src/languages/bash.js index 44f9beba97..064befd7a7 100644 --- a/src/languages/bash.js +++ b/src/languages/bash.js @@ -38,18 +38,7 @@ export default function(hljs) { end: /\)/, contains: [ hljs.BACKSLASH_ESCAPE ] }; - const COMMENT = hljs.inherit( - hljs.COMMENT(), - { - match: [ - /(^|\s)/, - /#.*$/ - ], - scope: { - 2: 'comment' - } - } - ); + const COMMENT = hljs.COMMENT(/(?<=^|\s)#/, /$/); const HERE_DOC = { begin: /<<-?\s*(?=\w+)/, starts: { contains: [ diff --git a/test/markup/bash/not-comments.expect.txt b/test/markup/bash/not-comments.expect.txt index ab12864283..33e706c30c 100644 --- a/test/markup/bash/not-comments.expect.txt +++ b/test/markup/bash/not-comments.expect.txt @@ -1,3 +1,5 @@ echo asdf#qwert yuiop echo asdf #qwert yuiop + +# TODO: this *is* a comment diff --git a/test/markup/bash/not-comments.txt b/test/markup/bash/not-comments.txt index b8f6f88383..da763be887 100644 --- a/test/markup/bash/not-comments.txt +++ b/test/markup/bash/not-comments.txt @@ -1,3 +1,5 @@ echo asdf#qwert yuiop echo asdf #qwert yuiop + +# TODO: this *is* a comment