Merge branch 'main' into perf/markdown-it-async

pull/4507/head
Anthony Fu 8 months ago
commit 5b9cd2eebe
No known key found for this signature in database
GPG Key ID: 179936958CD423FF

@ -24,7 +24,7 @@ import { MarkdownItAsync } from 'markdown-it-async'
import anchorPlugin from 'markdown-it-anchor'
import attrsPlugin from 'markdown-it-attrs'
import { full as emojiPlugin } from 'markdown-it-emoji'
import type { BuiltinTheme, Highlighter } from 'shiki'
import type { BuiltinLanguage, BuiltinTheme, Highlighter } from 'shiki'
import type { Logger } from 'vite'
import { containerPlugin, type ContainerOptions } from './plugins/containers'
import { gitHubAlertsPlugin } from './plugins/githubAlerts'
@ -53,11 +53,11 @@ export interface MarkdownOptions extends Options {
/**
* Setup markdown-it instance before applying plugins
*/
preConfig?: (md: MarkdownItAsync) => void
preConfig?: (md: MarkdownItAsync) => Awaited<void>
/**
* Setup markdown-it instance
*/
config?: (md: MarkdownItAsync) => void
config?: (md: MarkdownItAsync) => Awaited<void>
/**
* Disable cache (experimental)
*/
@ -81,10 +81,10 @@ export interface MarkdownOptions extends Options {
*/
theme?: ThemeOptions
/**
* Languages for syntax highlighting.
* Custom languages for syntax highlighting or pre-load built-in languages.
* @see https://shiki.style/languages
*/
languages?: LanguageInput[]
languages?: (LanguageInput | BuiltinLanguage)[]
/**
* Custom language aliases.
*
@ -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

Loading…
Cancel
Save