mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
bugfix: fix Marked highlihgt option
This commit is contained in:
parent
a154e568de
commit
df40ac2db0
@ -1,10 +1,14 @@
|
||||
var placeholder = document.getElementById('placeholder');
|
||||
|
||||
// Use Marked to highlight code blocks.
|
||||
// Use Marked to highlight code blocks in edit mode.
|
||||
marked.setOptions({
|
||||
highlight: function(code) {
|
||||
highlight: function(code, lang) {
|
||||
if (lang && hljs.getLanguage(lang)) {
|
||||
return hljs.highlight(lang, code).value;
|
||||
} else {
|
||||
return hljs.highlightAuto(code).value;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var updateHtml = function(html) {
|
||||
|
@ -46,7 +46,6 @@ var mdit = window.markdownit({
|
||||
} else {
|
||||
return hljs.highlightAuto(str).value;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -16,9 +16,13 @@ renderer.heading = function(text, level) {
|
||||
|
||||
// Highlight.js to highlight code block
|
||||
marked.setOptions({
|
||||
highlight: function(code) {
|
||||
highlight: function(code, lang) {
|
||||
if (lang && hljs.getLanguage(lang)) {
|
||||
return hljs.highlight(lang, code).value;
|
||||
} else {
|
||||
return hljs.highlightAuto(code).value;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var markdownToHtml = function(markdown, needToc) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user