Skip to content

Commit

Permalink
feat: allow markdown.config and markdown.preConfig to accept asyn…
Browse files Browse the repository at this point in the history
…c function (#4512)
  • Loading branch information
antfu authored Jan 22, 2025
1 parent e035027 commit b88ae8d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/node/markdown/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ export interface MarkdownOptions extends Options {
/**
* Setup markdown-it instance before applying plugins
*/
preConfig?: (md: MarkdownIt) => void
preConfig?: (md: MarkdownIt) => Awaited<void>
/**
* Setup markdown-it instance
*/
config?: (md: MarkdownIt) => void
config?: (md: MarkdownIt) => Awaited<void>
/**
* Disable cache (experimental)
*/
Expand Down Expand Up @@ -229,7 +229,7 @@ export async function createMarkdownRenderer(
md.use(restoreEntities)

if (options.preConfig) {
options.preConfig(md)
await options.preConfig(md)
}

// custom plugins
Expand Down Expand Up @@ -322,7 +322,7 @@ export async function createMarkdownRenderer(

// apply user config
if (options.config) {
options.config(md)
await options.config(md)
}

return md
Expand Down

0 comments on commit b88ae8d

Please sign in to comment.