Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/plugins/markdown/markdown-include.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ icon: between-horizontal-end

<NpmBadge package="@vuepress/plugin-markdown-include" />

Add additional features to your markdown includes.
Add markdown include features to your VuePress site.

## Usage

Expand All @@ -30,13 +30,13 @@ export default {

Use `<!-- @include: filename -->` to include a file.

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

- `<!-- @include: filename{start-end} -->`
- `<!-- @include: filename{start-} -->`
- `<!-- @include: filename{-end} -->`

Also, you can include file region:
Also, you can include a file region:

- `<!-- @include: filename#region -->`

Expand Down Expand Up @@ -214,7 +214,7 @@ class MyClass:
#region snippet
def sayHello(self):
print("Hello " + self.msg + "!")
#region snippet
#endregion snippet

def sayBye(self):
print("Bye " + self.msg + "!")
Expand Down Expand Up @@ -340,7 +340,7 @@ int main() {
### deep

- Type: `boolean`
- Details: Whether enable figure support.
- Details: Whether to recursively include files referenced in included Markdown files.

### useComment

Expand Down
10 changes: 5 additions & 5 deletions docs/zh/plugins/markdown/markdown-include.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ icon: between-horizontal-end

<NpmBadge package="@vuepress/plugin-markdown-include" />

向你的 VuePress 添加导入文件功能
为你的 VuePress 站点添加 Markdown 导入功能

## 使用方法

Expand All @@ -30,13 +30,13 @@ export default {

使用 `<!-- @include: filename -->` 导入文件。

如果要部分导入文件,你可以指定导入的行数
如果要部分导入文件,你可以指定导入的行数

- `<!-- @include: filename{start-end} -->`
- `<!-- @include: filename{start-} -->`
- `<!-- @include: filename{-end} -->`

同时你也可以导入文件区域:
同时你也可以导入文件区域

- `<!-- @include: filename#region -->`

Expand Down Expand Up @@ -214,7 +214,7 @@ class MyClass:
#region snippet
def sayHello(self):
print("Hello " + self.msg + "!")
#region snippet
#endregion snippet

def sayBye(self):
print("Bye " + self.msg + "!")
Expand Down Expand Up @@ -340,7 +340,7 @@ int main() {
### deep

- 类型:`boolean`
- 详情:是否启用图片 Figure 支持
- 详情:是否递归包含被包含的 Markdown 文件中引用的文件

### useComment

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,27 @@ import type { MarkdownEnv } from 'vuepress/markdown'
import { path } from 'vuepress/utils'
import type { MarkdownIncludePluginOptions } from './options.js'

/**
* Markdown include plugin
*
* Markdown 导入插件
*
* @param options - Plugin options / 插件选项
*
* @example
* ```ts
* import { markdownIncludePlugin } from '@vuepress/plugin-markdown-include'
*
* export default {
* plugins: [
* markdownIncludePlugin({
* deep: true,
* useComment: true,
* }),
* ],
* }
* ```
*/
export const markdownIncludePlugin =
(options: MarkdownIncludePluginOptions): Plugin =>
(app) => {
Expand Down
5 changes: 5 additions & 0 deletions plugins/markdown/plugin-markdown-include/src/node/options.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import type { MarkdownItIncludeOptions } from '@mdit/plugin-include'

/**
* Options for @vuepress/plugin-markdown-include
*
* @vuepress/plugin-markdown-include 插件的选项
*/
export type MarkdownIncludePluginOptions = Omit<
MarkdownItIncludeOptions,
'currentPath'
Expand Down
Loading