描述 Hugo 短代码的参数定义,这对编写短代码文档非常有用。
成为我们的资助者或赞助商,以支持我们的工作。
1{{% hugo/shortcode-params [data] %}}
data
索引 | 名称 | 类型 | 必填 | 默认值 | 版本 | 示例 |
---|---|---|---|---|---|---|
#0 | data | string | ✓ | - | - | - |
数据文件名。
heading
索引 | 名称 | 类型 | 必填 | 默认值 | 版本 | 示例 |
---|---|---|---|---|---|---|
- | heading | string | - | Parameters | - | - |
标题。
headingStartLevel
索引 | 名称 | 类型 | 必填 | 默认值 | 版本 | 示例 |
---|---|---|---|---|---|---|
- | headingStartLevel | number | - | 2 | - | - |
开始标题的级别。
name
名称 | 上下文 | 类型 | 必填 | 默认值 | 版本 | 示例 |
---|---|---|---|---|---|---|
name | - | string | ✓ | - | - | - |
参数名。
position
名称 | 上下文 | 类型 | 必填 | 默认值 | 版本 | 示例 |
---|---|---|---|---|---|---|
position | - | number | - | - | - | - |
位置参数的索引。
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 | - | - |
表示参数是否已被弃用。
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-yaml" data-lang="yaml"><span class="line"><span class="ln"> 1</span><span class="cl">- <span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l">foo</span><span class="w">
2 position: 0 3 required: true 4 description: 5 default: Foo description. 6 zh-hans: Foo 描述。 7 zh-hant: Foo 描述。 8 9- name: bar 10 type: number 11 since: v0.2.0 12 deprecated: true 13 description: 14 default: Bar description. 15 zh-hans: Bar 描述。 16 zh-hant: Bar 描述。 17 18- name: fizz 19 description: Single description without translations. 20 options: 21 - one 22 - two
Result as follows.
1{{% hugo/shortcode-params data="data/example-params.yaml" heading="Example Parameters" headingStartLevel=3 %}}
foo
索引 | 名称 | 类型 | 必填 | 默认值 | 版本 | 示例 |
---|---|---|---|---|---|---|
#0 | foo | string | ✓ | - | - | - |
Foo 描述。
bar
索引 | 名称 | 类型 | 必填 | 默认值 | 版本 | 示例 |
---|---|---|---|---|---|---|
- | bar | number | - | - | v0.2.0 | - |
Bar 描述。
fizz
索引 | 名称 | 类型 | 必填 | 默认值 | 版本 | 示例 |
---|---|---|---|---|---|---|
- | fizz | string | - | - | - | - |
Single description without translations.
可选项:one
, two
。