Include Files

About 1 min

Let the Markdown file in your VuePress site support including other files.



Use @include(filename) to include a file.

To partially import the file, you can specify the range of lines to be included:

  • @include(filename{start-end})
  • @include(filename{start-})
  • @include(filename{-end})



Heading 2

Contents containing bolded text and some Markdown Enhance features:


Hey how are you? 😄



Hey how are you? 😄


You can also set an object to customize include filepath and include behavior.

interface IncludeOptions {
   * handle include filePath
   * @default (path) => path
  getPath?: (path: string) => string;

   * Whether deep include files in included Markdown files
   * @default false
  deep?: boolean;

E.g.: you can use @src as an alias for your source directory.

Also, to place your Markdown files directly besides your actual files, but don’t want them rendered as pages, you can set pagePatterns options in VuePress config. See pagePatternsopen in new window for more details.