diff --git a/app/assets/javascripts/discourse/app/lib/highlight-syntax.js b/app/assets/javascripts/discourse/app/lib/highlight-syntax.js index 1e2f405cf1d..279f0069832 100644 --- a/app/assets/javascripts/discourse/app/lib/highlight-syntax.js +++ b/app/assets/javascripts/discourse/app/lib/highlight-syntax.js @@ -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) {