From 920252956f60377b8aa593c217830391dfa344ff Mon Sep 17 00:00:00 2001 From: AutumnVN Date: Thu, 7 Dec 2023 05:42:40 +0700 Subject: [PATCH] shikiCodeBlocks: support file preview (#1977) --- src/plugins/shikiCodeblocks.desktop/index.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/plugins/shikiCodeblocks.desktop/index.ts b/src/plugins/shikiCodeblocks.desktop/index.ts index f358497d2..ef1b5d3df 100644 --- a/src/plugins/shikiCodeblocks.desktop/index.ts +++ b/src/plugins/shikiCodeblocks.desktop/index.ts @@ -42,6 +42,13 @@ export default definePlugin({ match: /codeBlock:\{react\((\i),(\i),(\i)\)\{/, replace: "$&return $self.renderHighlighter($1,$2,$3);" } + }, + { + find: ".PREVIEW_NUM_LINES", + replacement: { + match: /(?<=function \i\((\i)\)\{)(?=let\{text:\i,language:)/, + replace: "return $self.renderHighlighter({lang:$1.language,content:$1.text});" + } } ], start: async () => {