短代碼參數

描述 Hugo 短代碼的參數定義,這對編寫短代碼文檔非常有用。

語法

1{{% hugo/shortcode-params [data] %}}

參數

data

索引名稱類型必填默認值版本
#0datastring--

數據文件名。

heading

索引名稱類型必填默認值版本
-headingstring-Parameters-

標題。

headingStartLevel

索引名稱類型必填默認值版本
-headingStartLevelnumber-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-

表示參數是否已被棄用。

示例

data/example-params.yaml
 1- name: foo
 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 %}}

Example Parameters

foo

索引名稱類型必填默認值版本
#0foostring--

Foo 描述。

bar

索引名稱類型必填默認值版本
-barnumber--v0.2.0

Bar 描述。

fizz

索引名稱類型必填默認值版本
-fizzstring---

Single description without translations.

可選項:one, two