From b80f0a4e8fe6d8b2cec54a7e68b991612a68f734 Mon Sep 17 00:00:00 2001 From: FunkyZc Date: Sat, 3 Apr 2021 19:30:06 -0500 Subject: [PATCH] fix(@vant/markdown-loader): improve highlight API (#8455) --- packages/vant-markdown-loader/src/highlight.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/vant-markdown-loader/src/highlight.js b/packages/vant-markdown-loader/src/highlight.js index 9adb9eecf..c5fed8c16 100644 --- a/packages/vant-markdown-loader/src/highlight.js +++ b/packages/vant-markdown-loader/src/highlight.js @@ -2,7 +2,8 @@ const hljs = require('highlight.js'); module.exports = function highlight(str, lang) { if (lang && hljs.getLanguage(lang)) { - return hljs.highlight(lang, str, true).value; + // https://github.com/highlightjs/highlight.js/issues/2277 + return hljs.highlight(str, { language: lang, ignoreIllegals: true }).value; } return '';