1
0
mirror of https://github.com/maximebf/php-debugbar.git synced 2025-01-17 05:18:32 +01:00

Check if hljs has language (#699)

This commit is contained in:
Barry vd. Heuvel 2024-12-15 20:19:03 +01:00 committed by GitHub
parent f622fa5ed5
commit f3b0022b54
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -53,7 +53,7 @@ if (typeof(PhpDebugBar) == 'undefined') {
if (typeof(hljs) === 'undefined') { if (typeof(hljs) === 'undefined') {
return htmlize(code); return htmlize(code);
} }
if (lang) { if (lang && hljs.getLanguage(lang)) {
return hljs.highlight(code, {language: lang}).value; return hljs.highlight(code, {language: lang}).value;
} }
return hljs.highlightAuto(code).value; return hljs.highlightAuto(code).value;