File tree 3 files changed +33
-1
lines changed
packages/slidev/node/plugins
3 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ export function transformSlotSugar(md: string) {
144
144
if ( isLineInsideCodeblocks ( idx ) )
145
145
return
146
146
147
- const match = line . trimEnd ( ) . match ( / ^ : : \s * ( \w + ) \s * : : $ / )
147
+ const match = line . trimEnd ( ) . match ( / ^ : : \s * ( [ \w \. \- \: ] + ) \s * : : $ / )
148
148
if ( match ) {
149
149
lines [ idx ] = `${ prevSlot ? '\n\n</template>\n' : '\n' } <template v-slot:${ match [ 1 ] } ="slotProps">\n`
150
150
prevSlot = true
Original file line number Diff line number Diff line change @@ -103,5 +103,25 @@ Right Slot
103
103
Default Slot
104
104
105
105
106
+ </template>"
107
+ `;
108
+
109
+ exports[`markdown transform > slot-sugar with symbols in name 1`] = `
110
+ "
111
+ # Page
112
+
113
+ Default Slot
114
+
115
+ <template v-slot:slot::1=\\"slotProps\\">
116
+
117
+ First Slot
118
+
119
+
120
+ </template>
121
+ <template v-slot:slot.2=\\"slotProps\\">
122
+
123
+ Second Slot
124
+
125
+
106
126
</template>"
107
127
`;
Original file line number Diff line number Diff line change @@ -45,6 +45,18 @@ Slot Usage
45
45
::left::
46
46
\`\`\`
47
47
48
+ ` ) ) . toMatchSnapshot ( )
49
+ } )
50
+
51
+ it ( 'slot-sugar with symbols in name' , ( ) => {
52
+ expect ( transformSlotSugar ( `
53
+ # Page
54
+
55
+ Default Slot
56
+ ::slot::1::
57
+ First Slot
58
+ ::slot.2::
59
+ Second Slot
48
60
` ) ) . toMatchSnapshot ( )
49
61
} )
50
62
You can’t perform that action at this time.
0 commit comments