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
fix(javascript) comma is allowed in a "value container" #2403
Conversation
- fixes case where a regex would not be detected if it was anything other than the first parameter of a function call - in some cases this could actually cause the whole snippet to be flagged as illegal if the regex contained characters that were invalid at the top level (such as #) This complexity is because we only detect regexs inside "value containers" to prevent false positivies. This issue was found when asking Highlight.js to highlight it's own non-minified 1.2mb browser build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 this works correctly even when there's a comma in the regex too.
hljs.COMMENT(/,\{#/, /,#}/),
Yeah, our regex regex should be decently good... the problem was just that it wasn't expecting the regex at all so then it would see the I'm pretty impressed that it could highlight the whole 1.2mb source of itself without choking on anything else... |
If you're going to approve please actually click the Review/Approve button so it's counted as an official review so it'll trigger the ability to merge. :) |
I did approve, that's how it appears for me 😅 |
Now it's approved. :) Thanks. |
Hmmm, seems Github doesn't like it much when you remove reviewers, lol. |
I think it's because I approved as a triager, but GitHub wants an approval from someone with commit access. See how my approvals show up grey instead of green? |
Ah, hmmm... |
other than the first parameter of a function call
be flagged as illegal if the regex contained characters that
were invalid at the top level (such as #)
This complexity is because we only detect regexs inside "value
containers" to prevent false positivies.
This issue was found when asking Highlight.js to highlight it's
own non-minified 1.2mb browser build.
Example of failing code (this was flagged illegal):