FIX: bypass highlighths for long code in auto mode (#28399)
Long code is considered 1000 characters atm. 10000+ characters would take seconds due to how highlightjs will consider every installed lang before choosing the best candidate.
This commit is contained in:
parent
6cc100abe0
commit
a59c89211b
|
@ -42,6 +42,10 @@ export default async function highlightSyntax(elem, siteSettings, session) {
|
|||
}
|
||||
}
|
||||
|
||||
if (lang === "auto" && e.innerHTML.length > 1000) {
|
||||
return;
|
||||
}
|
||||
|
||||
const canHighlight = lang && (lang === "auto" || hljs.getLanguage(lang));
|
||||
|
||||
if (canHighlight) {
|
||||
|
|
Loading…
Reference in New Issue