Przeglądaj źródła

bug-fix: fix code block highlight issues

add ignore_illegals parameter to hljs.highlight().
Le Tan 7 lat temu
rodzic
commit
faff0cd8f6

+ 1 - 1
src/resources/hoedown.js

@@ -5,7 +5,7 @@ marked.setOptions({
     highlight: function(code, lang) {
         if (lang) {
             if (hljs.getLanguage(lang)) {
-                return hljs.highlight(lang, code).value;
+                return hljs.highlight(lang, code, true).value;
             } else {
                 return hljs.highlightAuto(code).value;
             }

+ 1 - 1
src/resources/markdown-it.js

@@ -49,7 +49,7 @@ var mdit = window.markdownit({
             && (!VEnableMermaid || lang != 'mermaid')
             && (!VEnableFlowchart || lang != 'flowchart')) {
             if (hljs.getLanguage(lang)) {
-                return hljs.highlight(lang, str).value;
+                return hljs.highlight(lang, str, true).value;
             } else {
                 return hljs.highlightAuto(str).value;
             }

+ 1 - 1
src/resources/marked.js

@@ -22,7 +22,7 @@ marked.setOptions({
             && (!VEnableMermaid || lang != 'mermaid')
             && (!VEnableFlowchart || lang != 'flowchart')) {
             if (hljs.getLanguage(lang)) {
-                return hljs.highlight(lang, code).value;
+                return hljs.highlight(lang, code, true).value;
             } else {
                 return hljs.highlightAuto(code).value;
             }