mirror of
https://github.com/pengzhanbo/vuepress-theme-plume.git
synced 2026-04-23 10:58:13 +08:00
* feat(plugin-md-power): add support `npm-to` container * chore: tweak * chore: tweak * chore: tweak
36 lines
1014 B
TypeScript
36 lines
1014 B
TypeScript
import type { App } from 'vuepress'
|
|
import type { Markdown } from 'vuepress/markdown'
|
|
import type { MarkdownPowerPluginOptions } from '../../shared/index.js'
|
|
import { isPlainObject } from '@vuepress/helper'
|
|
import { alignPlugin } from './align.js'
|
|
import { codeTabs } from './codeTabs.js'
|
|
import { fileTreePlugin } from './fileTree.js'
|
|
import { langReplPlugin } from './langRepl.js'
|
|
import { npmToPlugins } from './npmTo.js'
|
|
import { tabs } from './tabs.js'
|
|
|
|
export async function containerPlugin(
|
|
app: App,
|
|
md: Markdown,
|
|
options: MarkdownPowerPluginOptions,
|
|
) {
|
|
// ::: left / right / center / justify
|
|
alignPlugin(md)
|
|
// ::: tabs
|
|
tabs(md)
|
|
// ::: code-tabs
|
|
codeTabs(md, options.codeTabs)
|
|
|
|
if (options.npmTo) {
|
|
npmToPlugins(md, typeof options.npmTo === 'boolean' ? {} : options.npmTo)
|
|
}
|
|
|
|
if (options.repl)
|
|
await langReplPlugin(app, md, options.repl)
|
|
|
|
if (options.fileTree) {
|
|
// ::: file-tree
|
|
fileTreePlugin(md, isPlainObject(options.fileTree) ? options.fileTree : {})
|
|
}
|
|
}
|