From 074ade93a114fbe47c81d8f5d8f80acfd0d20dd9 Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Wed, 26 Jun 2024 00:44:14 +0800 Subject: [PATCH] feat(plugin-shikiji): remove notation escape --- plugins/plugin-shikiji/src/node/highlight.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/plugins/plugin-shikiji/src/node/highlight.ts b/plugins/plugin-shikiji/src/node/highlight.ts index 158047897..2e7176d03 100644 --- a/plugins/plugin-shikiji/src/node/highlight.ts +++ b/plugins/plugin-shikiji/src/node/highlight.ts @@ -15,6 +15,7 @@ import { transformerNotationFocus, transformerNotationHighlight, transformerNotationWordHighlight, + transformerRemoveNotationEscape, transformerRenderWhitespace, } from '@shikijs/transformers' import type { HighlighterOptions, ThemeOptions } from './types.js' @@ -25,7 +26,6 @@ const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz', 10) const cache = new LRUCache(64) const vueRE = /-vue$/ -const RE_ESCAPE = /\[\\\!code/g const mustacheRE = /\{\{.*?\}\}/g const decorationsRE = /^\/\/ @decorations:(.*?)\n/ @@ -85,10 +85,7 @@ export async function highlight( return code }, }, - { - name: 'vuepress:remove-escape', - postprocess: code => code.replace(RE_ESCAPE, '[!code'), - }, + transformerRemoveNotationEscape(), ] const loadedLanguages = highlighter.getLoadedLanguages()