1. 修改hexo-prism-plugin\src\index.js
找到hexo-prism-plugin\src\index.js
用记事本打开
const map = {
''': '\'',
'&': '&',
'>': '>',
'<': '<',
'"': '"'
};
把上面这段改成下面这段
const map = {
''': '\'',
'&': '&',
'>': '>',
'<': '<',
'"': '"',
'{': '{',
'}': '}'
};
2. 更改渲染器
npm un hexo-math
npm un hexo-renderer-marked
npm install hexo-renderer-markdown-it-plus
在根目录下的_config.yml里添加
markdown_it_plus:
highlight: true
html: true
xhtmlOut: true
breaks: true
langPrefix:
linkify: true
typographer:
quotes: “”‘’
plugins:
- plugin:
name: markdown-it-mark
enable: false
把hexo-renderer-markdown-it-plus\lib
这个目录下的renderer.js
这个文件里的下面几行代码删掉应该就可以了,大约在50行左右。
var pre_class = config['pre_class'];
if(!pre_class) pre_class = 'highlight';
checkValue(config, _res, 'highlight', function(str, lang) {
if (lang && hljs.getLanguage(lang)) {
try {
return '<pre class="' + pre_class + '"><code class="' + lang + '">' + hljs.highlight(lang, str, true).value + '</code></pre>';
} catch (__) {}
}
return '<pre class="' + pre_class + '"><code class="' + lang + '">' + utils.escapeHtml(str) + '</code></pre>';
}, function(str, lang) {
return '<pre class="' + pre_class + '"><code class="' + lang + '">' + utils.escapeHtml(str) + '</code></pre>';
});