Closed ideagay closed 6 years ago
const hljs = require('highlight.js'); const markdown = require('markdown-it')({ html: true, breaks: true, wrapper: 'section', preprocess: function (MarkdownIt, Source) { return Source; }, highlight: function (str, lang) { if (lang && hljs.getLanguage(lang)) { try { return '
' + hljs.highlight(lang, str, true).value + '
' + markdown.utils.escapeHtml(str) + '
...{ test: /.md$/, loader: 'vue-markdown-loader', options: markdown }
but the wrapper was undefined and the hightlight was not worked
markdown-it-emoji怎么在Vue CLI 3的vue.config.js file中配置
webpack.config.js
const hljs = require('highlight.js'); const markdown = require('markdown-it')({ html: true, breaks: true, wrapper: 'section', preprocess: function (MarkdownIt, Source) { return Source; }, highlight: function (str, lang) { if (lang && hljs.getLanguage(lang)) { try { return '
'; } catch (__) {} } return ' '; } }); markdown.use(require('markdown-it-emoji'));...{ test: /.md$/, loader: 'vue-markdown-loader', options: markdown }
but the wrapper was undefined and the hightlight was not worked