Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(javascript) comma is allowed in a "value container" #2403

Merged
merged 2 commits into from Feb 17, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/languages/javascript.js
Expand Up @@ -189,6 +189,9 @@ export default function(hljs) {
}
]
},
{ // could be a comma delimited list of params to a function call
begin: /,/, relevance: 0,
},
{
className: '',
begin: /\s/,
Expand Down Expand Up @@ -229,6 +232,7 @@ export default function(hljs) {
{
begin: /\$[(.]/ // relevance booster for a pattern common to JS libs: `$(something)` and `$.something`
},

hljs.METHOD_GUARD,
{ // ES6 class
className: 'class',
Expand Down
5 changes: 5 additions & 0 deletions test/markup/javascript/method-call.expect.txt
@@ -1 +1,6 @@
x.continue(<span class="hljs-number">0</span>);

x = [
hljs.COMMENT(<span class="hljs-regexp">/\{%\s*comment\s*%}/</span>, <span class="hljs-regexp">/\{%\s*endcomment\s*%}/</span>),
hljs.COMMENT(<span class="hljs-regexp">/\{#/</span>, <span class="hljs-regexp">/#}/</span>),
]
6 changes: 6 additions & 0 deletions test/markup/javascript/method-call.txt
@@ -1 +1,7 @@
x.continue(0);

x = [
hljs.COMMENT(/\{%\s*comment\s*%}/, /\{%\s*endcomment\s*%}/),
hljs.COMMENT(/\{#/, /#}/),
]