From b88ae8d4a11a20104b2007c2631eb7aeb123d965 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Thu, 23 Jan 2025 05:05:50 +0800 Subject: [PATCH] feat: allow `markdown.config` and `markdown.preConfig` to accept async function (#4512) --- src/node/markdown/markdown.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/node/markdown/markdown.ts b/src/node/markdown/markdown.ts index 378b54c183ae..8bfad0b5c197 100644 --- a/src/node/markdown/markdown.ts +++ b/src/node/markdown/markdown.ts @@ -53,11 +53,11 @@ export interface MarkdownOptions extends Options { /** * Setup markdown-it instance before applying plugins */ - preConfig?: (md: MarkdownIt) => void + preConfig?: (md: MarkdownIt) => Awaited /** * Setup markdown-it instance */ - config?: (md: MarkdownIt) => void + config?: (md: MarkdownIt) => Awaited /** * Disable cache (experimental) */ @@ -229,7 +229,7 @@ export async function createMarkdownRenderer( md.use(restoreEntities) if (options.preConfig) { - options.preConfig(md) + await options.preConfig(md) } // custom plugins @@ -322,7 +322,7 @@ export async function createMarkdownRenderer( // apply user config if (options.config) { - options.config(md) + await options.config(md) } return md