bug-fix: fix code block highlight issues

add ignore_illegals parameter to hljs.highlight().
This commit is contained in:
Le Tan 2018-02-22 19:43:49 +08:00
parent 3ce7ef28c1
commit faff0cd8f6
3 changed files with 3 additions and 3 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}