V
Comment plugin for VuePress supporting multiple providers. Usage npm i -D @vuepress/plugin-comment@next .vuepress/config.ts import { commentPlugin } from '@vuepress/plugin-comment' export default { plugins: [ commentPlugin({ provider: 'Waline', // Artalk | Giscus | Waline | Twikoo // provider-specific options }), ], } Supported Providers Artalk Giscus Twikoo Waline Guide See Guide for detailed configuration.
V
The following styles are provided. Normalize @vuepress/helper/normalize.css is a CSS file that normalizes the default styles of the browser. It is recommended to import it in community themes. Transitions @vuepress/helper/transition/*.css is a collection of CSS files that provide transitions for elements. It is recommended to import for use as needed in community themes. fade-in.css fade-in-up.css fade-in-down.css fade-in-left.css fade-in-right.css fade-in-scale-up.css slide-in-up.css…
V
The following functions are available on both Node.js and Client. These functions are available in @vuepress/helper, @vuepress/helper/client, and @vuepress/helper/shared. Data Related Encode/decode and zip/unzip data. This is useful in markdown plugins when you want to encode string content and pass it to the component through props. You may simply achieve this with encodeURIComponent and decodeURIComponent, but it can be very large if the content contains lots of special characters. So we…
V
These functions are only available in @vuepress/helper/client. Composables APIs hasGlobalComponent Check if a global component with the given name exists. export const hasGlobalComponent: (name: string, app?: App) => boolean Tips Local import of the component does not affect the result. When calling outside setup scope, you need to pass the app instance as the second parameter. Example // if you globally register `<my-component>` hasGlobalComponent('MyComponent') // true…
V
This package is a helper utility for VuePress developers. @vuepress/helper: Node.js side helper utilities. Bundler Related Locales Related Page Related @vuepress/helper/client: Client side helper utilities. @vuepress/helper/shared: Utilities that are both available at Node.js side or Client.
V
The default theme uses SASS as the CSS pre-processor. Users can customize style variables via a palette file, and add extra styles via a style file. Palette File The path of the palette file is .vuepress/styles/palette.scss. You can make use of it to override predefined SASS variables of the default theme. Click to expand SASS variables // responsive breakpoints $MQNarrow: 959px !default; $MQMobile: 719px !default; $MQMobileNarrow: 419px !default; Style File The path of the style file is…
V
The theme is a layout layer: the navbar, the sidebar, the document page, the home page and the not-found page are provided by the theme, while every feature outside the layout is provided by a plugin. The theme wires those plugins for you, with sensible defaults, so a typical site never installs or configures them itself. The theme data plugin is always enabled and is not configurable, because the whole theme configuration is delivered to the client through it. Every other plugin can be…
V
The theme wires the Markdown plugins it needs, so the syntax below works out of the box. Each section links to the plugin that owns the syntax and its full options. Hint Containers The theme enables @vuepress/plugin-markdown-hint with both the hint containers and the GFM alerts. ::: tip This is a tip. ::: ::: warning This is a warning. ::: ::: danger This is a danger message, rendered with the caution style. ::: ::: details A collapsible block. ::: The available containers are tip, warning,…
V
A site can be translated with the locales option of the theme. Each locale carries its own theme options, so the navbar, the sidebar, the labels and the texts of a language are configured together. VuePress itself also has a site-level locales option, which declares the languages of the site and decides the locale of a route. The theme locales only carry the theme options of a language, so declare the same locale paths in both places. import { themeDefault } from '@vuepress/theme-default'…
V
Frontmatter configures a single page, while the theme options configure the whole site. The fields documented on this page are the ones the theme reads; fields of the VuePress core and of the plugins (title, lang, description, head, icon, date, …) work as usual and are not repeated here.
V
The theme renders every page through a single layout component. Pages are differentiated by their page type instead of by their layout name, and the parts of the layout are exposed as slots. That makes a custom page or a custom layout a matter of registering a component and, when the layout of the theme is still wanted, wrapping it. Custom Layouts The theme registers two layouts: Layout and NotFound. The layout frontmatter selects one of the registered layouts by name, and it defaults to Layout:
V
All options are passed to themeDefault() in .vuepress/config.ts: .vuepress/config.ts import { themeDefault } from '@vuepress/theme-default' import { defineUserConfig } from 'vuepress' export default defineUserConfig({ theme: themeDefault({ siteTitle: 'My Site', nav: [{ text: 'Guide', link: '/guide/' }], sidebar: 'heading', }), }) Every option below is a field of the ThemeConfig interface, except hostname, which is an extra option of themeDefault(). Options that are not supported — including the…
V
The theme exports its building blocks, so a custom layout or a home page can be composed from them without copying the theme. Document them all in a table first, then give per-component props. Keep references to our own pages internal. The components are exported by the client entry. Import the ones a page uses in a <script setup> block: <script setup> import { VPButton, VPImage } from '@vuepress/theme-default/client' </script> Two components are registered globally, so they work in markdown…
V
The default theme of VuePress. It is a thin layout layer ported from the VitePress default theme: the theme provides the layout and the styles only (navbar, sidebar, doc outline, home page, footer and dark mode), while every other feature is delegated to the ecosystem plugins. The former default theme The theme that used to be published as @vuepress/theme-default is now @vuepress/theme-classic. The new default theme deliberately keeps the layout and the CSS variable names close to VitePress…
V
Replace local assets links within the site, such as links to images, videos, audio, PDF, and other assets, by rewriting the local assets addresses to new ones. Why is this feature needed? Many users choose to store their site's assets on CDN services to accelerate site access speed and improve site availability. In this process, it is usually necessary to first upload the assets to the CDN service, then obtain the asset links from the CDN service, and finally use them in the site content. This…
V
Register Vue components from component files or directory automatically. Usage npm i -D @vuepress/plugin-register-components@next .vuepress/config.ts import { registerComponentsPlugin } from '@vuepress/plugin-register-components' export default { plugins: [ registerComponentsPlugin({ // options }), ], } Guide Register from Directory Set componentsDir to the absolute path of the components directory. Files in this directory which are matched with componentsPatterns will be registered as Vue…
V
This plugin can automatically handle redirects for your site. Usage npm i -D @vuepress/plugin-redirect@next .vuepress/config.ts import { redirectPlugin } from '@vuepress/plugin-redirect' export default { plugins: [ redirectPlugin({ // options }), ], } Guide Control Page Redirection If you change the address of an existing page, you can use the redirectFrom option in Frontmatter to redirect to the address of this page, which ensures that users are redirected to the new address when they visit…
V
Integrate Google Tag Manager into VuePress. This plugin will import Google Tag Manager. Usage npm i -D @vuepress/plugin-google-tag-manager@next .vuepress/config.ts import { googleTagManagerPlugin } from '@vuepress/plugin-google-tag-manager' export default { plugins: [ googleTagManagerPlugin({ // options id: 'GTM-XXXXXXXXXX', }), ], } Working with Javascript Disabled If you want Google Tag Manager to work properly when javascript is disabled, you should add the following content to the body part…
V
This plugin is used to solve the issue of long startup times in VuePress. By caching the markdown render during the initial startup of the VuePress development server, the plugin skips unnecessary markdown render on subsequent startups, thus speeding up the startup process. Usage npm i -D @vuepress/plugin-cache@next Using it as last plugin It is recommended to place cachePlugin as the last item in the plugins configuration, as this can ensure maximum utilization of caching. .vuepress/config.ts…
V
Automatically insert frontmatter at the beginning of markdown files. When VuePress starts, locate markdown files based on matching rules, use the handle(data [,context]) function to generate frontmatter, and then add the frontmatter to the beginning of the markdown file. The plugin only processes markdown files under the source directory that meet the config.pagePatterns rules. Usage npm i -D @vuepress/plugin-auto-frontmatter@next .vuepress/config.ts import { autoFrontmatterPlugin } from…
V
This plugin removes service workers from your VuePress site, ensuring users can receive updates after you remove any previously enabled PWA plugin. Why this plugin is needed if you used PWA plugin once? PWA plugins like @vuepress/plugin-pwa register service workers that cache your site for offline access. If you remove a PWA plugin, the old service worker remains but can't receive updates as there's no new service worker to update to. Users will be stuck with the old version of your site. To…
V
Make your VuePress site a Progressive Web Application (PWA)[1]. Usage npm i -D @vuepress/plugin-pwa@next .vuepress/config.ts import { pwaPlugin } from '@vuepress/plugin-pwa' export default { plugins: [ pwaPlugin({ // options }), ], } The plugin uses workbox-build to generate the service worker file, and register-service-worker to register the service worker. A PWA uses a Service Worker[2] (SW for short) to cache and proxy site content. Warning If you have enabled this plugin once and want to…
V
Generate a sitemap for your site. Usage npm i -D @vuepress/plugin-sitemap@next .vuepress/config.ts import { sitemapPlugin } from '@vuepress/plugin-sitemap' export default { plugins: [ sitemapPlugin({ hostname: 'https://example.com', }), ], } The hostname option is required, as the sitemap links are generated from it. The plugin uses the last update time from @vuepress/plugin-git, and declares the alternative links of every page in other languages according to the locale config. Link Control By…
V
Make your site support Open Content Protocol OGP and JSON-LD 1.1 by injecting tags into <head>. Usage npm i -D @vuepress/plugin-seo@next .vuepress/config.ts import { seoPlugin } from '@vuepress/plugin-seo' export default { plugins: [ seoPlugin({ hostname: 'https://example.com', }), ], } The plugin works out of the box, it reads the site config and the page frontmatter to generate the tags as much as possible. By default, every page generated from a Markdown file is treated as an article, except…
V
A powerful client-side search plugin featuring custom indexing and full-text search support. Usage npm i -D @vuepress/plugin-slimsearch@next .vuepress/config.ts import { slimsearchPlugin } from '@vuepress/plugin-slimsearch' export default { plugins: [ slimsearchPlugin({ // options }), ], } Guide Search Index Powered by slimsearch, this plugin provides ultra-fast search capabilities, even for large documentation sites. By default, the plugin indexes only headings, article excerpts, and any…
V
Provide local search to your documentation site. Usage npm i -D @vuepress/plugin-search@next .vuepress/config.ts import { searchPlugin } from '@vuepress/plugin-search' export default { plugins: [ searchPlugin({ // options }), ], } Guide Local Search Index This plugin will generate search index from your pages locally, and load the search index file when users enter your site. In other words, this is a lightweight built-in search which does not require any external requests. However, when your…
V
A powerful client-side search plugin featuring custom indexing and full-text search support. Usage npm i -D @vuepress/plugin-orama@next .vuepress/config.ts import { oramaPlugin } from '@vuepress/plugin-orama' export default { plugins: [ oramaPlugin({ // options }), ], } Guide Search Index Powered by Orama, this plugin provides fast search capabilities, even for large documentation sites. By default, the plugin indexes only headings, article excerpts, and any custom fields you configure. If you…