File tree 2 files changed +22
-2
lines changed
packages/transformers/src/shared
2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -177,6 +177,13 @@ console.log('Highlighted')
177
177
console.log('Highlighted')
178
178
console.log('Not highlighted')
179
179
```
180
+
181
+ ```ts
182
+ console.log('Not highlighted')
183
+ // [\!code highlight:1]
184
+ console.log('Highlighted')
185
+ console.log('Not highlighted')
186
+ ```
180
187
````
181
188
182
189
Renders:
@@ -188,6 +195,13 @@ console.log('Highlighted')
188
195
console .log (' Not highlighted' )
189
196
```
190
197
198
+ ``` ts
199
+ console .log (' Not highlighted' )
200
+ // [!code highlight:1]
201
+ console .log (' Highlighted' )
202
+ console .log (' Not highlighted' )
203
+ ```
204
+
191
205
---
192
206
193
207
### ` transformerNotationWordHighlight `
Original file line number Diff line number Diff line change @@ -97,8 +97,14 @@ export function createCommentNotationTransformer(
97
97
}
98
98
}
99
99
100
- for ( const line of linesToRemove )
101
- code . children . splice ( code . children . indexOf ( line ) , 1 )
100
+ for ( const line of linesToRemove ) {
101
+ const index = code . children . indexOf ( line )
102
+ const nextLine = code . children [ index + 1 ]
103
+ let removeLength = 1
104
+ if ( nextLine ?. type === 'text' && nextLine ?. value === '\n' )
105
+ removeLength = 2
106
+ code . children . splice ( index , removeLength )
107
+ }
102
108
} ,
103
109
}
104
110
}
You can’t perform that action at this time.
0 commit comments