File tree 1 file changed +3
-7
lines changed
1 file changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -181,8 +181,6 @@ export default definePreparserSetup(() => {
181
181
182
182
And that's it.
183
183
184
-
185
-
186
184
### Use case 3: using custom frontmatter to transform note
187
185
188
186
Imagine a case where you want to replace the slides default notes with custom notes.
@@ -210,9 +208,8 @@ Here we used an underscore in `_note` to avoid possible conflicts with existing
210
208
To handle this ` _note: ... ` syntax in the frontmatter, create a ` ./setup/preparser.ts ` file with the following content:
211
209
212
210
``` ts twoslash
211
+ import fs , { promises as fsp } from ' node:fs'
213
212
import { definePreparserSetup } from ' @slidev/types'
214
- import fs from ' fs'
215
- import { promises as fsp } from ' fs'
216
213
217
214
export default definePreparserSetup (() => {
218
215
return [
@@ -222,7 +219,8 @@ export default definePreparserSetup(() => {
222
219
try {
223
220
const newNote = await fsp .readFile (frontmatter ._note , ' utf8' )
224
221
return newNote
225
- } catch (err ) {
222
+ }
223
+ catch (err ) {
226
224
}
227
225
}
228
226
@@ -232,5 +230,3 @@ export default definePreparserSetup(() => {
232
230
]
233
231
})
234
232
```
235
-
236
- And that's it.
You can’t perform that action at this time.
0 commit comments