mirror of
https://github.com/wahyd4/vuepress.git
synced 2026-08-11 22:36:59 +10:00
34 lines
692 B
JavaScript
34 lines
692 B
JavaScript
'use strict'
|
|
|
|
/**
|
|
* Module dependencies.
|
|
*/
|
|
|
|
const createMarkdown = require('@vuepress/markdown')
|
|
|
|
/**
|
|
* Expose createMarkdown.
|
|
*/
|
|
|
|
module.exports = function (ctx) {
|
|
const { markdown: markdownConfig = {}} = ctx.siteConfig
|
|
const { chainMarkdown, extendMarkdown } = markdownConfig
|
|
|
|
const beforeInstantiate = config => {
|
|
chainMarkdown && chainMarkdown(config)
|
|
ctx.pluginAPI.options.chainMarkdown.syncApply(config)
|
|
}
|
|
|
|
const afterInstantiate = md => {
|
|
extendMarkdown && extendMarkdown(md)
|
|
ctx.pluginAPI.options.extendMarkdown.syncApply(md)
|
|
}
|
|
|
|
return createMarkdown(
|
|
Object.assign(markdownConfig, {
|
|
beforeInstantiate,
|
|
afterInstantiate
|
|
})
|
|
)
|
|
}
|