prismjs

@vuepress/plugin-prismjs

This plugin will enable syntax highlighting for markdown code fence with Prism.jsOpen in a new window.

This plugin has been integrated into the default theme.

Notice that this plugin would only tokenize the code fence without adding styles. When using it with a custom theme, you may need to choose and import Prism.js style theme yourself.

Usage

npm i -D @vuepress/plugin-prismjs@next
import { prismjsPlugin } from '@vuepress/plugin-prismjs'

export default {
  plugins: [
    prismjsPlugin({
      // options
    }),
  ],
}

Options

preloadLanguages

  • Type: string[]

  • Default: ['markdown', 'jsdoc', 'yaml']

  • Details:

    Languages to preload.

    By default, languages will be loaded on demand when parsing markdown files.

    However, Prism.js has some potential issuesOpen in a new window about loading languages dynamically. To avoid them, you can preload languages via this option.

last update:
contributor: ahong18s