File tree Expand file tree Collapse file tree 3 files changed +33
-1
lines changed
packages/slidev/node/plugins Expand file tree Collapse file tree 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) {
144144 if ( isLineInsideCodeblocks ( idx ) )
145145 return
146146
147- const match = line . trimEnd ( ) . match ( / ^ : : \s * ( \w + ) \s * : : $ / )
147+ const match = line . trimEnd ( ) . match ( / ^ : : \s * ( [ \w \. \- \: ] + ) \s * : : $ / )
148148 if ( match ) {
149149 lines [ idx ] = `${ prevSlot ? '\n\n</template>\n' : '\n' } <template v-slot:${ match [ 1 ] } ="slotProps">\n`
150150 prevSlot = true
Original file line number Diff line number Diff line change @@ -103,5 +103,25 @@ Right Slot
103103Default Slot
104104
105105
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+
106126</template>"
107127`;
Original file line number Diff line number Diff line change @@ -45,6 +45,18 @@ Slot Usage
4545::left::
4646\`\`\`
4747
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
4860` ) ) . toMatchSnapshot ( )
4961 } )
5062
You can’t perform that action at this time.
0 commit comments