1- import MarkdownIt from 'markdown-it'
2- import anchorPlugin from 'markdown-it-anchor'
3- import attrsPlugin from 'markdown-it-attrs'
4- import emojiPlugin from 'markdown-it-emoji'
51import { componentPlugin } from '@mdit-vue/plugin-component'
62import {
73 frontmatterPlugin ,
@@ -15,15 +11,20 @@ import { sfcPlugin, type SfcPluginOptions } from '@mdit-vue/plugin-sfc'
1511import { titlePlugin } from '@mdit-vue/plugin-title'
1612import { tocPlugin , type TocPluginOptions } from '@mdit-vue/plugin-toc'
1713import { slugify } from '@mdit-vue/shared'
14+ import MarkdownIt from 'markdown-it'
15+ import anchorPlugin from 'markdown-it-anchor'
16+ import attrsPlugin from 'markdown-it-attrs'
17+ import emojiPlugin from 'markdown-it-emoji'
1818import type { IThemeRegistration } from 'shiki'
19+ import type { Logger } from 'vite'
20+ import { containerPlugin } from './plugins/containers'
1921import { highlight } from './plugins/highlight'
2022import { highlightLinePlugin } from './plugins/highlightLines'
23+ import { imagePlugin } from './plugins/image'
2124import { lineNumberPlugin } from './plugins/lineNumbers'
22- import { containerPlugin } from './plugins/containers'
23- import { snippetPlugin } from './plugins/snippet'
24- import { preWrapperPlugin } from './plugins/preWrapper'
2525import { linkPlugin } from './plugins/link'
26- import { imagePlugin } from './plugins/image'
26+ import { preWrapperPlugin } from './plugins/preWrapper'
27+ import { snippetPlugin } from './plugins/snippet'
2728
2829export type { Header } from '../shared'
2930
@@ -55,14 +56,15 @@ export type MarkdownRenderer = MarkdownIt
5556export const createMarkdownRenderer = async (
5657 srcDir : string ,
5758 options : MarkdownOptions = { } ,
58- base = '/'
59+ base = '/' ,
60+ logger : Pick < Logger , 'warn' > = console
5961) : Promise < MarkdownRenderer > => {
6062 const md = MarkdownIt ( {
6163 html : true ,
6264 linkify : true ,
6365 highlight :
6466 options . highlight ||
65- ( await highlight ( options . theme , options . defaultHighlightLang ) ) ,
67+ ( await highlight ( options . theme , options . defaultHighlightLang , logger ) ) ,
6668 ...options
6769 } ) as MarkdownRenderer
6870
0 commit comments