2
0
mirror of https://github.com/Ionaru/easy-markdown-editor synced 2025-07-23 01:44:31 -06:00

adhere to language ascription in highlightjs

This commit is contained in:
johannes karoff 2020-06-10 11:55:45 +02:00
parent 9dbb1dbe8a
commit 36d9b238cf

View File

@ -1886,8 +1886,12 @@ EasyMDE.prototype.markdown = function (text) {
/* Check if HLJS loaded */ /* Check if HLJS loaded */
if (hljs) { if (hljs) {
markedOptions.highlight = function (code) { markedOptions.highlight = function (code, language) {
if (language && hljs.getLanguage(language)) {
return hljs.highlight(language, code).value;
} else {
return hljs.highlightAuto(code).value; return hljs.highlightAuto(code).value;
}
}; };
} }
} }