prismjs

@vuepress/plugin-prismjs

This plugin will enable syntax highlighting for markdown code fence with Prism.jsopen in 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
const { prismjsPlugin } = require('@vuepress/plugin-prismjs')

module.exports = {
  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 new window about loading languages dynamically. To avoid them, you can preload languages via this option.