Skip to content

Commit 408e97a

Browse files
authored
fix(language-core): ignore latex block content (#5151)
1 parent 1e84c6a commit 408e97a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/language-core/lib/plugins/file-md.ts

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { parse } from '../utils/parseSfc';
77

88
const codeblockReg = /(`{3,})[\s\S]+?\1/g;
99
const inlineCodeblockReg = /`[^\n`]+?`/g;
10+
const latexBlockReg = /(\${2,})[\s\S]+?\1/g;
1011
const scriptSetupReg = /\\\<[\s\S]+?\>\n?/g;
1112
const sfcBlockReg = /\<(script|style)\b[\s\S]*?\>([\s\S]*?)\<\/\1\>/g;
1213
const angleBracketReg = /\<\S*\:\S*\>/g;
@@ -39,6 +40,8 @@ const plugin: VueLanguagePlugin = ({ vueCompilerOptions }) => {
3940
.replace(codeblockReg, (match, quotes) => quotes + ' '.repeat(match.length - quotes.length * 2) + quotes)
4041
// inline code block
4142
.replace(inlineCodeblockReg, match => `\`${' '.repeat(match.length - 2)}\``)
43+
// latex block
44+
.replace(latexBlockReg, (match, quotes) => quotes + ' '.repeat(match.length - quotes.length * 2) + quotes)
4245
// # \<script setup>
4346
.replace(scriptSetupReg, match => ' '.repeat(match.length))
4447
// <<< https://vitepress.dev/guide/markdown#import-code-snippets

0 commit comments

Comments
 (0)