@@ -10,10 +10,10 @@ const codeblockReg = /(`{3,})[\s\S]+?\1/g;
10
10
const inlineCodeblockReg = / ` [ ^ \n ` ] + ?` / g;
11
11
const latexBlockReg = / ( \$ { 2 , } ) [ \s \S ] + ?\1/ g;
12
12
const scriptSetupReg = / \\ < [ \s \S ] + ?> \n ? / g;
13
+ const codeSnippetImportReg = / ^ \s * < < < \s * .+ / gm;
14
+ const sfcBlockReg = / < ( s c r i p t | s t y l e ) \b [ \s \S ] * ?> ( [ \s \S ] * ?) < \/ \1> / g;
13
15
const angleBracketReg = / < \S * : \S * > / g;
14
16
const linkReg = / \[ [ \s \S ] * ?\] \( [ \s \S ] * ?\) / g;
15
- const sfcBlockReg = / < ( s c r i p t | s t y l e ) \b [ \s \S ] * ?> ( [ \s \S ] * ?) < \/ \1> / g;
16
- const codeSnippetImportReg = / ^ \s * < < < \s * .+ / gm;
17
17
18
18
const plugin : VueLanguagePlugin = ( { vueCompilerOptions } ) => {
19
19
return {
@@ -46,11 +46,7 @@ const plugin: VueLanguagePlugin = ({ vueCompilerOptions }) => {
46
46
// # \<script setup>
47
47
. replace ( scriptSetupReg , match => ' ' . repeat ( match . length ) )
48
48
// <<< https://vitepress.dev/guide/markdown#import-code-snippets
49
- . replace ( codeSnippetImportReg , match => ' ' . repeat ( match . length ) )
50
- // angle bracket: <http://foo.com>
51
- . replace ( angleBracketReg , match => ' ' . repeat ( match . length ) )
52
- // [foo](http://foo.com)
53
- . replace ( linkReg , match => ' ' . repeat ( match . length ) ) ;
49
+ . replace ( codeSnippetImportReg , match => ' ' . repeat ( match . length ) ) ;
54
50
55
51
const codes : Segment [ ] = [ ] ;
56
52
@@ -62,6 +58,12 @@ const plugin: VueLanguagePlugin = ({ vueCompilerOptions }) => {
62
58
+ content . slice ( match . index + matchText . length ) ;
63
59
}
64
60
61
+ content = content
62
+ // angle bracket: <http://foo.com>
63
+ . replace ( angleBracketReg , match => ' ' . repeat ( match . length ) )
64
+ // [foo](http://foo.com)
65
+ . replace ( linkReg , match => ' ' . repeat ( match . length ) ) ;
66
+
65
67
codes . push ( '<template>\n' ) ;
66
68
codes . push ( [ content , undefined , 0 ] ) ;
67
69
codes . push ( '\n</template>' ) ;
0 commit comments