From f47478f73014a63f71c99efd1774f53377c78a56 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Mon, 4 Oct 2021 16:58:26 +0100 Subject: [PATCH] Chore: Fixed highlight.js syntax Ref: https://github.com/highlightjs/highlight.js/issues/2277 --- packages/renderer/MdToHtml.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/renderer/MdToHtml.ts b/packages/renderer/MdToHtml.ts index 042a6ad90a..6a81c04e8a 100644 --- a/packages/renderer/MdToHtml.ts +++ b/packages/renderer/MdToHtml.ts @@ -467,7 +467,8 @@ export default class MdToHtml { hlCode = this.cachedHighlightedCode_[cacheKey]; } else { if (lang && hljs.getLanguage(lang)) { - hlCode = hljs.highlight(lang, trimmedStr, true).value; + // hlCode = hljs.highlight(lang, trimmedStr, true).value; + hlCode = hljs.highlight(trimmedStr, { language: lang, ignoreIllegals: true }).value; } else { hlCode = hljs.highlightAuto(trimmedStr).value; }