You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the issue
Using highlightBlock API in the web editor, some content similar to the following will make the browser unresponsive. After analysis, such content may trigger a disastrous regular expression backtracking
Which language seems to have the issue?
javascript
Are you using highlight or highlightAuto?
use highlightBlock actually uses highlightAuto
hljs.highlightBlock(document.querySelector('#test'));
**Expected behavior**
Although the code is not actually javascript, I hope to highlight the corresponding keywords correctly, at least not to block the browser.
**Additional context**
version 10.1.2
javascript language actually use regexp is `const reg = /(^#![ ]*\/.*\bnode\b.*)|(^\s*['"]use (strict|asm)['"])|(')|(")|(html`)|(css`)|(`)|(\/\/)|(\/\*\*)|(\/\*)|(\b(0[bB][01]+)n?)|(\b(0[oO][0-7]+)n?)|((-?)(\b0[xX][a-fA-F0-9]+|(\b\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?)n?)|([{,\n]\s*(?=(((\/\/.*)|(\/\*(.|\n)*\*\/))\s*)*[A-Za-z$_][0-9A-Za-z$_]*\s*:))|((!|!=|!==|%|%=|&|&&|&=|\*|\*=|\+|\+=|,|-|-=|\/=|\/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\?|\[|\{|\(|\^|\^=|\||\|=|\|\||~|\b(case|return|throw)\b)\s*)|(\b(function)(?=\b|\s))|(\$[(.])|(\.\s*[a-zA-Z_]\w*)|(\b(class)(?=\b|\s))|(\b(constructor)(?=\b|\s))|((get|set)\s+(?=[A-Za-z$_][0-9A-Za-z$_]*\())|(#(?!!))/gm`
reg.exec above content can reproduce
The text was updated successfully, but these errors were encountered:
Describe the issue
Using highlightBlock API in the web editor, some content similar to the following will make the browser unresponsive. After analysis, such content may trigger a disastrous regular expression backtracking
Which language seems to have the issue?
javascript
Are you using
highlight
orhighlightAuto
?use highlightBlock actually uses highlightAuto
Sample Code to Reproduce
The text was updated successfully, but these errors were encountered: