The document is only used for theme display, please go to the official site for the latest Vuepress documentation
container
Register markdown custom containers in your VuePress site.
This plugin simplifies the use of markdown-it-containeropen in new window, but also retains its original capabilities.
The Custom Containers of default theme is powered by this plugin.
Container Syntax
::: <type> [info]
[content]
:::
2
3
- The 
typeis required and should be specified via type option. - The 
infois optional, and the default value can be specified viadefaultInfoin locales option. - The 
contentcan be any valid markdown content. 
TIP
This plugin can be used multiple times to support different types of containers.
Options
type
Type:
stringDetails:
The type of the container.
It will be used as the
nameparam of markdown-it-containeropen in new window.
locales
Type:
Record<string, { defaultInfo: string }>Details:
The default
infoof the container in different locales.If this option is not specified, the default
infowill fallback to the uppercase of the type option.Example:
module.exports = {
  plugins: [
    [
      '@vuepress/container',
      {
        type: 'tip',
        locales: {
          '/': {
            defaultInfo: 'TIP',
          },
          '/zh/': {
            defaultInfo: '提示',
          },
        },
      },
    ],
  ],
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
- Also see:
 
before
Type:
(info: string) => stringDefault:
(info: string): string =>
  `<div class="custom-container ${type}">${info ? `<p class="custom-container-title">${info}</p>` : ''}\n`
2
Details:
A function to render the starting tag of the container.
The first param is the
infopart of container syntax.This option will not take effect if you don't specify the after option.
after
Type:
(info: string) => stringDefault:
(): string => '</div>\n'
Details:
A function to render the ending tag of the container.
The first param is the
infopart of container syntax.This option will not take effect if you don't specify the before option.
render
- Type:
 
type MarkdownItContainerRenderFunction = (
  tokens: Token[],
  index: number,
  options: any,
  env: MarkdownEnv,
  self: Renderer
) => string
2
3
4
5
6
7
Details:
The
renderoption of markdown-it-containeropen in new window.This plugin uses a default
renderfunction. If you specify this option, the defaultrenderfunction will be replaced, and the locales, before and after options will be ignored.
validate
Type:
(params: string) => booleanDetails:
The
validateoption of markdown-it-containeropen in new window.
marker
Type:
stringDetails:
The
markeroption of markdown-it-containeropen in new window.