From 59c907dfd08ea0da32aaa7193a67920fd2684b40 Mon Sep 17 00:00:00 2001 From: KazariEX <1364035137@qq.com> Date: Tue, 28 Jan 2025 22:24:56 +0800 Subject: [PATCH] fix: ignore latex block content --- packages/language-core/lib/plugins/file-md.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/language-core/lib/plugins/file-md.ts b/packages/language-core/lib/plugins/file-md.ts index b3705ce88a..b0afb41ab4 100644 --- a/packages/language-core/lib/plugins/file-md.ts +++ b/packages/language-core/lib/plugins/file-md.ts @@ -7,6 +7,7 @@ import { parse } from '../utils/parseSfc'; const codeblockReg = /(`{3,})[\s\S]+?\1/g; const inlineCodeblockReg = /`[^\n`]+?`/g; +const latexBlockReg = /(\${2,})[\s\S]+?\1/g; const scriptSetupReg = /\\\<[\s\S]+?\>\n?/g; const sfcBlockReg = /\<(script|style)\b[\s\S]*?\>([\s\S]*?)\<\/\1\>/g; const angleBracketReg = /\<\S*\:\S*\>/g; @@ -39,6 +40,8 @@ const plugin: VueLanguagePlugin = ({ vueCompilerOptions }) => { .replace(codeblockReg, (match, quotes) => quotes + ' '.repeat(match.length - quotes.length * 2) + quotes) // inline code block .replace(inlineCodeblockReg, match => `\`${' '.repeat(match.length - 2)}\``) + // latex block + .replace(latexBlockReg, (match, quotes) => quotes + ' '.repeat(match.length - quotes.length * 2) + quotes) // # \