The document is only used for theme display, please go to the official site for the latest Vuepress documentation
Config
Reference of VuePress config, which can be set via config file. The conventional config files are (in order of precedence):
- In current working directory
cwd:vuepress.config.tsvuepress.config.js
- In source directory
sourceDir:.vuepress/config.ts.vuepress/config.js
You can also specify the config file via --config option of CLI.
Site Config
base
Type:
stringDefault:
/Details:
The base URL the site will be deployed at.
You will need to set this if you plan to deploy your site under a sub path. It should always start and end with a slash. For example, if you plan to deploy your site to GitHub pages at
https://foo.github.io/bar/, then you should setbaseto"/bar/".The
baseis automatically prepended to all the URLs that start with/in other options, so you only need to specify it once.Also see:
lang
Type:
stringDefault:
en-USDetails:
Language for the site.
This will be the
langattribute of the<html>tag in the rendered HTML.This can be specified in different locales.
Also see:
title
Type:
stringDefault:
''Details:
Title for the site.
This will be the suffix for all page titles, and displayed in the navbar in the default theme.
This can be specified in different locales.
Also see:
description
Type:
stringDefault:
''Details:
Description for the site.
This will be the
contentattribute of<meta name="description" />tag in the rendered HTML, which will be overrode by thedescriptionfield of page frontmatter.This can be specified in different locales.
Also see:
head
Type:
HeadConfig[]Default:
[]Details:
Extra tags to inject into the
<head>tag in the rendered HTML.You can specify each tag in the form of
[tagName, { attrName: attrValue }, innerHTML?].This can be specified in different locales.
Example:
To add a custom favicon:
module.exports = {
head: [['link', { rel: 'icon', href: '/images/logo.png' }]],
}
2
3
Rendered as:
<head>
<link rel="icon" href="/images/logo.png" />
</head>
2
3
- Also see:
locales
Type:
{ [path: string]: Partial<SiteLocaleData> }Default:
{}Details:
Specify locales for i18n support.
Acceptable fields:
Also see:
Theme Config
theme
Type:
stringDefault:
'@vuepress/default'Details:
Name or absolute path of theme your want to use.
This option accepts theme name, theme name shorthand, or absolute path to theme.
Example:
module.exports = {
theme: 'vuepress-theme-quicksand',
// or
theme: 'quicksand',
}
2
3
4
5
- Also see:
themeConfig
Type:
ThemeConfigDefault:
{}Details:
Provide config options to the used theme. The options will vary depending on the theme you are using.
Also see:
Bundler Config
bundler
Type:
stringDefault:
'@vuepress/webpack'Details:
Name of bundler your want to use.
Bundler name shorthand is acceptable.
Also see:
bundlerConfig
Type:
BundlerConfigDefault:
{}Details:
Provide config options to the used bundler. The options will vary depending on the bundler you are using.
Also see:
Directory Config
dest
Type:
stringDefault:
`${sourceDir}/.vuepress/dist`Details:
Specify the output directory for
vuepress buildcommand.
temp
Type:
stringDefault:
`${sourceDir}/.vuepress/.temp`Details:
Specify the directory for temporary files.
cache
Type:
stringDefault:
`${sourceDir}/.vuepress/.cache`Details:
Specify the directory for cache .
public
Type:
stringDefault:
`${sourceDir}/.vuepress/public`Details:
Specify the directory for public files.
Also see:
Markdown Config
markdown
Type:
MarkdownOptionsDefault:
{}Details:
Configure VuePress built-in Markdown syntax extensions.
It accepts all options of markdown-itopen in new window, and the following additional options.
Also see:
markdown.anchor
Type:
AnchorPluginOptions | falseDetails:
Options for markdown-it-anchoropen in new window.
Set to
falseto disable this plugin.Also see:
markdown.assets
Type:
AssetsPluginOptions | falseDetails:
Options for VuePress built-in markdown-it assets plugin.
Set to
falseto disable this plugin.
DANGER
You should not configure it unless you understand what it is for.
markdown.code
Type:
CodePluginOptions | falseDetails:
Options for VuePress built-in markdown-it code plugin.
Set to
falseto disable this plugin.Also see:
markdown.code.highlightLines
Type:
booleanDefault:
trueDetails:
Enable code line highlighting or not.
Also see:
markdown.code.lineNumbers
Type:
booleanDefault:
trueDetails:
Enable code line numbers or not.
Also see:
markdown.code.preWrapper
Type:
booleanDefault:
trueDetails:
Enable the extra wrapper of the
<pre>tag or not.The wrapper is required by the
highlightLinesandlineNumbers. That means, if you disablepreWrapper, the line highlighting and line numbers will also be disabled.
TIP
You can disable it if you want to implement them in client side. For example, Prismjs Line Highlightopen in new window or Prismjs Line Numbersopen in new window.
markdown.code.vPre
Type:
booleanDefault:
trueDetails:
Enable the
v-predirective on<pre>tag or not.Also see:
markdown.customComponent
Type:
undefined | falseDetails:
Options for VuePress built-in markdown-it custom-component plugin.
Set to
falseto disable this plugin.
DANGER
You should not configure it unless you understand what it is for.
markdown.emoji
Type:
EmojiPluginOptions | falseDetails:
Options for markdown-it-emojiopen in new window.
Set to
falseto disable this plugin.Also see:
markdown.extractHeaders
Type:
ExtractHeadersPluginOptions | falseDetails:
Options for VuePress built-in markdown-it extract-headers plugin.
It will extract page headers to page data, which would be used for generating sidebar, table of contents, etc. For example, the sidebar of current page is auto generated from the headers that extracted by this plugin.
Set to
falseto disable this plugin.
markdown.extractTitle
Type:
undefined | falseDetails:
Options for VuePress built-in markdown-it extract-title plugin.
It will extract title to page data, which will be used as the page title.
Set to
falseto disable this plugin.
DANGER
You should not configure it unless you understand what it is for.
markdown.hoistTags
Type:
HoistTagsPluginOptions | falseDetails:
Options for VuePress built-in markdown-it hoist-tags plugin.
It will hoist specific HTML tags in your Markdown to the top-level of SFC. By default, only
<script>and<style>tags will be hoisted. You can set this option to support SFC custom blocks in Markdown.Set to
falseto disable this plugin.Also see:
markdown.importCode
Type:
ImportCodePluginOptions | falseDetails:
Options for VuePress built-in markdown-it import-code plugin.
Set to
falseto disable this plugin.Also see:
markdown.importCode.handleImportPath
Type:
(str: string) => stringDefault:
(str) => strDetails:
A function to handle the import path of the import code syntax.
markdown.links
Type:
LinksPluginOptions | falseDetails:
Options for VuePress built-in markdown-it links plugin.
It will convert internal links to
<RouterLink>, and add extra attributes and icon to external links.Set to
falseto disable this plugin.Also see:
markdown.links.internalTag
Type:
'a' | 'RouterLink'Default:
'RouterLink'Details:
Tag for internal links.
By default, this plugin will transform internal links to
<RouterLink>. You can set this option to'a'to disable this feature.
markdown.links.externalAttrs
Type:
Record<string, string>Default:
{ target: '_blank', rel: 'noopener noreferrer' }Details:
Additional attributes for external links.
markdown.links.externalIcon
Type:
booleanDefault:
trueDetails:
Whether to append an open in new window icon to external links.
You can override this global option via externalIcon frontmatter in your pages.
markdown.toc
Type:
TocPluginOptions | falseDetails:
Options for VuePress built-in markdown-it table-of-contents plugin.
Set to
falseto disable this plugin.Also see:
Development Config
debug
Type:
booleanDefault:
falseDetails:
Enable debug mode or not.
This would be helpful for developers. Also, we are using debugopen in new window package for debug logging, which can be enabled via
DEBUG=vuepress*environment variable.
host
Type:
stringDefault:
'0.0.0.0'Details:
Specify the host to use for the dev server.
port
Type:
numberDefault:
8080Details:
Specify the port to use for the dev server.
open
Type:
booleanDefault:
falseDetails:
Whether to open the browser after dev-server had been started.
pagePatterns
Type:
string[]Default:
['**/*.md', '!.vuepress', '!node_modules']Details:
Specify the patterns of files you want to be resolved as pages. The patterns are relative to the source directory.
templateDev
Type:
stringDefault:
'@vuepress/client/templates/index.dev.html'Details:
Specify the HTML template to be used for dev.
templateSSR
Type:
stringDefault:
'@vuepress/client/templates/index.ssr.html'Details:
Specify the HTML template to be used for build (SSR).
shouldPreload
Type:
((file: string, type: string) => boolean)) | booleanDefault:
trueDetails:
A function to control what files should have
<link rel="preload">resource hints generated. Set totrueorfalseto enable or disable totally.By default, only those files that are required by current page will be preloaded. So you can keep it
truein most cases.
shouldPrefetch
Type:
((file: string, type: string) => boolean)) | booleanDefault:
falseDetails:
A function to control what files should have
<link rel="prefetch">resource hints generated. Set totrueorfalseto enable or disable for all files.If you set it to
true, all files that required by other pages will be prefetched. This is good for small sites, which will speed up the navigation, but it might not be a good idea if you have lots of pages in your site.
Plugin Config
plugins
Type:
PluginConfig[]Details:
Plugins to use.
This option accepts an array, each item of which is a two-element tuple:
- The first element is the plugin name or the plugin itself. It accepts plugin name, plugin name shorthand, absolute path to plugin, or the plugin object.
- The second element is the plugin options. It accepts boolean or object. Set it to
falseto skip the plugin. Set it totrueto enable the plugin without any options. Use object to enable the plugin with options.
For simplicity, you can use the first element of the tuple that described above as the array item, which equals enabling the plugin without any options.
Example:
module.exports = {
plugins: [
// two-element tuple
['vuepress-plugin-foo', false],
['bar', true],
[path.resolve(__dirname, './path/to/local/plugin'), { /* options */ }],
[require('vuepress-plugin-baz'), true],
// only use the first element
'foobar', // equals to ['foobar', true]
],
}
2
3
4
5
6
7
8
9
10
11
12
- Also see:
Plugin API
User config file also works as a VuePress plugin, so all of the Plugin APIs are available except the name and multiple options.
Please check out Plugin API Reference for a full list of Plugin APIs.