File tree 2 files changed +6
-6
lines changed
2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ export function createMarkdown(options: ResolvedOptions) {
107
107
} = options
108
108
109
109
raw = raw . trimStart ( )
110
- raw = transforms . before ?.( raw , id ) ?? raw
110
+ raw = await transforms . before ?.( raw , id ) ?? raw
111
111
112
112
const env : MarkdownEnv = { id }
113
113
let html = await markdown . renderAsync ( raw , env )
@@ -138,7 +138,7 @@ export function createMarkdown(options: ResolvedOptions) {
138
138
html = `<${ wrapperComponentName } ${ attrs } >${ html } </${ wrapperComponentName } >`
139
139
}
140
140
141
- html = transforms . after ?.( html , id ) ?? html
141
+ html = await transforms . after ?.( html , id ) ?? html
142
142
143
143
if ( options . escapeCodeTagInterpolation ) {
144
144
// escape curly brackets interpolation in <code>, #14
@@ -194,7 +194,7 @@ export function createMarkdown(options: ResolvedOptions) {
194
194
scriptLines . push ( 'useHead(head)' )
195
195
}
196
196
197
- scriptLines . push ( ...transforms . extraScripts ?.( frontmatter , id ) || [ ] )
197
+ scriptLines . push ( ...await transforms . extraScripts ?.( frontmatter , id ) || [ ] )
198
198
}
199
199
200
200
if ( options . excerpt ) {
Original file line number Diff line number Diff line change @@ -187,12 +187,12 @@ export interface Options {
187
187
* Custom tranformations apply before and after the markdown transformation
188
188
*/
189
189
transforms ?: {
190
- before ?: ( code : string , id : string ) => string
191
- after ?: ( code : string , id : string ) => string
190
+ before ?: ( code : string , id : string ) => string | Promise < string >
191
+ after ?: ( code : string , id : string ) => string | Promise < string >
192
192
/**
193
193
* Return extra code to be injected into the `<script>` tag
194
194
*/
195
- extraScripts ?: ( frontmatter : Record < string , any > , id : string ) => string [ ]
195
+ extraScripts ?: ( frontmatter : Record < string , any > , id : string ) => string [ ] | Promise < string [ ] >
196
196
}
197
197
198
198
include ?: FilterPattern
You can’t perform that action at this time.
0 commit comments