Skip to content

Commit

Permalink
Merge 395d63c into 32cacb3
Browse files Browse the repository at this point in the history
  • Loading branch information
pengzhanbo committed May 19, 2024
2 parents 32cacb3 + 395d63c commit fa50a23
Show file tree
Hide file tree
Showing 17 changed files with 324 additions and 1,205 deletions.
17 changes: 13 additions & 4 deletions packages/markdown/src/markdown.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { slugify as defaultSlugify } from '@mdit-vue/shared'
import { logger } from '@vuepress/utils'
import MarkdownIt from 'markdown-it'
import {
anchorPlugin,
assetsPlugin,
codePlugin,
componentPlugin,
emojiPlugin,
frontmatterPlugin,
Expand All @@ -13,18 +13,19 @@ import {
sfcPlugin,
titlePlugin,
tocPlugin,
vPrePlugin,
} from './plugins.js'
import type {
AnchorPluginOptions,
AssetsPluginOptions,
CodePluginOptions,
EmojiPluginOptions,
FrontmatterPluginOptions,
HeadersPluginOptions,
ImportCodePluginOptions,
LinksPluginOptions,
SfcPluginOptions,
TocPluginOptions,
VPrePluginOptions,
} from './plugins.js'
import type { Markdown, MarkdownOptions } from './types.js'

Expand All @@ -35,6 +36,7 @@ export const createMarkdown = ({
anchor,
assets,
code,
vPre,
component,
emoji,
frontmatter,
Expand Down Expand Up @@ -82,8 +84,15 @@ export const createMarkdown = ({
}

// process code fence
if (code !== false) {
md.use<CodePluginOptions>(codePlugin, code)
if (code) {
logger.warn(
`\`markdown.code\` option is deprecated, use '@vuepress/plugin-shiki' or '@vuepress/plugin-prismjs' instead.\n See https://v2.vuepress.vuejs.org/reference/config.html#markdown-code`,
)
}

// add v-pre to `<pre>` and `<code>`
if (vPre !== false) {
md.use<VPrePluginOptions>(vPrePlugin, vPre)
}

// treat unknown html tags as components
Expand Down
9 changes: 5 additions & 4 deletions packages/markdown/src/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ export {
assetsPlugin,
type AssetsPluginOptions,
} from './plugins/assetsPlugin/assetsPlugin.js'
export {
codePlugin,
type CodePluginOptions,
} from './plugins/codePlugin/codePlugin.js'
export { emojiPlugin, type EmojiPluginOptions } from './plugins/emojiPlugin.js'
export {
importCodePlugin,
Expand All @@ -35,3 +31,8 @@ export {
linksPlugin,
type LinksPluginOptions,
} from './plugins/linksPlugin/linksPlugin.js'

export {
vPrePlugin,
type VPrePluginOptions,
} from './plugins/vPrePlugin/vPrePlugin.js'
151 changes: 0 additions & 151 deletions packages/markdown/src/plugins/codePlugin/codePlugin.ts

This file was deleted.

105 changes: 0 additions & 105 deletions packages/markdown/src/plugins/codePlugin/languages.ts

This file was deleted.

12 changes: 0 additions & 12 deletions packages/markdown/src/plugins/codePlugin/resolveAttr.ts

This file was deleted.

34 changes: 0 additions & 34 deletions packages/markdown/src/plugins/codePlugin/resolveHighlightLines.ts

This file was deleted.

Loading

0 comments on commit fa50a23

Please sign in to comment.