描述函数和 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
。