Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(markdown): remove codePlugin and add vPrePlugin (close #1550) #1556

Merged
merged 13 commits into from
May 27, 2024
6 changes: 5 additions & 1 deletion packages/markdown/src/markdown.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { slugify as defaultSlugify } from '@mdit-vue/shared'
import { logger } from '@vuepress/utils'
import MarkdownIt from 'markdown-it'
import {
anchorPlugin,
Expand Down Expand Up @@ -82,7 +83,10 @@ export const createMarkdown = ({
}

// process code fence
if (code !== false) {
if (code) {
logger.warn(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have we updated the docs? Or maybe we need to link to plugin docs?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I will open a pr for this, note a route related pr is open a few days ago not not being merged.

`\`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`,
)
md.use<CodePluginOptions>(codePlugin, code)
}

Expand Down
4 changes: 4 additions & 0 deletions packages/markdown/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ export type { MarkdownSfcBlocks }
export interface MarkdownOptions extends Options {
anchor?: false | AnchorPluginOptions
assets?: false | AssetsPluginOptions

/**
* @deprecated This feature has been deprecated. Please use `@vuepress/prismjs` or `@vuepress/shiki` to instead it.
pengzhanbo marked this conversation as resolved.
Show resolved Hide resolved
*/
code?: false | CodePluginOptions
component?: false
emoji?: false | EmojiPluginOptions
Expand Down
Loading