描述函数和 API 的参数定义,这对文档非常有用。
成为我们的资助者或赞助商,以支持我们的工作。
1{{% params [data] %}}
data| 名称 | 上下文 | 类型 | 必填 | 默认值 | 版本 | 示例 |
|---|---|---|---|---|---|---|
data | - | string | ✓ | - | - | - |
数据文件名。
heading| 名称 | 上下文 | 类型 | 必填 | 默认值 | 版本 | 示例 |
|---|---|---|---|---|---|---|
heading | - | string | - | Parameters | - | - |
标题。
headingStartLevel| 名称 | 上下文 | 类型 | 必填 | 默认值 | 版本 | 示例 |
|---|---|---|---|---|---|---|
headingStartLevel | - | number | - | 2 | - | - |
开始标题的级别。
context| 名称 | 上下文 | 类型 | 必填 | 默认值 | 版本 | 示例 |
|---|---|---|---|---|---|---|
context | - | string | - | - | 0.20.0 | - |
所有参数的默认上下文。
name| 名称 | 上下文 | 类型 | 必填 | 默认值 | 版本 | 示例 |
|---|---|---|---|---|---|---|
name | - | string | ✓ | - | - | - |
参数名。
type| 名称 | 上下文 | 类型 | 必填 | 默认值 | 版本 | 示例 |
|---|---|---|---|---|---|---|
type | - | string/array | - | string | - | - |
参数类型。
required| 名称 | 上下文 | 类型 | 必填 | 默认值 | 版本 | 示例 |
|---|---|---|---|---|---|---|
required | - | boolean | - | false | - | - |
表示参数是否必填。
default| 名称 | 上下文 | 类型 | 必填 | 默认值 | 版本 | 示例 |
|---|---|---|---|---|---|---|
default | - | string | - | - | - | - |
参数默认值。
since| 名称 | 上下文 | 类型 | 必填 | 默认值 | 版本 | 示例 |
|---|---|---|---|---|---|---|
since | - | string | - | - | - | - |
表示添加参数的版本。
description| 名称 | 上下文 | 类型 | 必填 | 默认值 | 版本 | 示例 |
|---|---|---|---|---|---|---|
description | - | string/object | ✓ | - | - | - |
参数说明,支持 Markdown。
description.default| 名称 | 上下文 | 类型 | 必填 | 默认值 | 版本 | 示例 |
|---|---|---|---|---|---|---|
description.default | - | string | - | - | - | - |
默认的参数说明。
description.[lang]| 名称 | 上下文 | 类型 | 必填 | 默认值 | 版本 | 示例 |
|---|---|---|---|---|---|---|
description.[lang] | - | string | - | - | - | - |
特定语言的描述。
options| 名称 | 上下文 | 类型 | 必填 | 默认值 | 版本 | 示例 |
|---|---|---|---|---|---|---|
options | - | array | - | - | - | - |
可选项。
deprecated| 名称 | 上下文 | 类型 | 必填 | 默认值 | 版本 | 示例 |
|---|---|---|---|---|---|---|
deprecated | - | string | - | false | - | - |
表示参数是否已被弃用。
1- name: foo
2 required: true
3 description:
4 default: Foo description.
5 zh-hans: Foo 描述。
6 zh-hant: Foo 描述。
7
8- name: bar
9 type: number
10 since: v0.2.0
11 deprecated: true
12 description:
13 default: Bar description.
14 zh-hans: Bar 描述。
15 zh-hant: Bar 描述。
16
17- name: fizz
18 description: Single description without translations.
19 options:
20 - one
21 - two
Result as follows.
1{{% params data="data/example-params.yaml" heading="Example Parameters" headingStartLevel=3 %}}foo| 名称 | 上下文 | 类型 | 必填 | 默认值 | 版本 | 示例 |
|---|---|---|---|---|---|---|
foo | - | string | ✓ | - | - | - |
Foo 描述。
bar| 名称 | 上下文 | 类型 | 必填 | 默认值 | 版本 | 示例 |
|---|---|---|---|---|---|---|
bar | - | number | - | - | v0.2.0 | - |
Bar 描述。
fizz| 名称 | 上下文 | 类型 | 必填 | 默认值 | 版本 | 示例 |
|---|---|---|---|---|---|---|
fizz | - | string | - | - | - | - |
Single description without translations.
可选项:one, two。