File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
Expand file tree Collapse file tree 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) {
107107 } = options
108108
109109 raw = raw . trimStart ( )
110- raw = transforms . before ?.( raw , id ) ?? raw
110+ raw = await transforms . before ?.( raw , id ) ?? raw
111111
112112 const env : MarkdownEnv = { id }
113113 let html = await markdown . renderAsync ( raw , env )
@@ -138,7 +138,7 @@ export function createMarkdown(options: ResolvedOptions) {
138138 html = `<${ wrapperComponentName } ${ attrs } >${ html } </${ wrapperComponentName } >`
139139 }
140140
141- html = transforms . after ?.( html , id ) ?? html
141+ html = await transforms . after ?.( html , id ) ?? html
142142
143143 if ( options . escapeCodeTagInterpolation ) {
144144 // escape curly brackets interpolation in <code>, #14
@@ -194,7 +194,7 @@ export function createMarkdown(options: ResolvedOptions) {
194194 scriptLines . push ( 'useHead(head)' )
195195 }
196196
197- scriptLines . push ( ...transforms . extraScripts ?.( frontmatter , id ) || [ ] )
197+ scriptLines . push ( ...await transforms . extraScripts ?.( frontmatter , id ) || [ ] )
198198 }
199199
200200 if ( options . excerpt ) {
Original file line number Diff line number Diff line change @@ -187,12 +187,12 @@ export interface Options {
187187 * Custom tranformations apply before and after the markdown transformation
188188 */
189189 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 >
192192 /**
193193 * Return extra code to be injected into the `<script>` tag
194194 */
195- extraScripts ?: ( frontmatter : Record < string , any > , id : string ) => string [ ]
195+ extraScripts ?: ( frontmatter : Record < string , any > , id : string ) => string [ ] | Promise < string [ ] >
196196 }
197197
198198 include ?: FilterPattern
You can’t perform that action at this time.
0 commit comments