File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import markdown from 'shiki/langs/markdown.mjs'
6
6
import catppuccinLatte from ' shiki/themes/catppuccin-latte.mjs'
7
7
import catppuccinMocha from ' shiki/themes/catppuccin-mocha.mjs'
8
8
import { onBeforeUnmount , ref , watch } from ' vue'
9
+ import { transformPlaceholder } from ' ./shikiTransforms'
9
10
10
11
defineOptions ({
11
12
name: ' PromptEditor' ,
@@ -50,7 +51,10 @@ watch(model, (str) => {
50
51
dark: themesResolved [themesResolved .length > 1 ? 1 : 0 ].name ! ,
51
52
},
52
53
lang: ' markdown' ,
53
- transformers: [transformerColorizedBrackets ()],
54
+ transformers: [
55
+ transformerColorizedBrackets (),
56
+ transformPlaceholder (),
57
+ ],
54
58
})
55
59
}, {
56
60
immediate: true ,
Original file line number Diff line number Diff line change
1
+ import type { ShikiTransformer } from 'shiki'
2
+
3
+ export function transformPlaceholder ( ) {
4
+ return ( {
5
+ name : 'placeholder' ,
6
+ preprocess ( code ) {
7
+ return code . split ( '\n' ) . map ( ( str ) => {
8
+ return str || '\u00A0'
9
+ } ) . join ( '\n' )
10
+ } ,
11
+ } ) as ShikiTransformer
12
+ }
You can’t perform that action at this time.
0 commit comments