admonition shortcode 允许你在内容中添加各种类型的标注。
参数配置
admonition shortcode 有以下具名参数,位置参数按照从上到下的顺序排列:
| 参数 | 说明 | 类型 | 默认值 |
|---|
| type | admonition 横幅的类型。见 支持的类型 | string | note |
| title | admonition 横幅的标题。(支持 Markdown 和 HTML 格式) | string | type 参数值 |
| open | 横幅内容是否默认展开。 | boolean | true |
基础用法
一个 admonition 示例:
1
2
3
4
5
6
7
| {{< admonition type=quote title="[FixIt](https://github.com/hugo-fixit/FixIt)" open=true >}}
一个**简洁**、**优雅**且**高效**的 [Hugo](https://gohugo.io/) 博客主题。
{{< /admonition >}}
或者
{{< admonition quote "[FixIt](https://github.com/hugo-fixit/FixIt)" true >}}
一个**简洁**、**优雅**且**高效**的 [Hugo](https://gohugo.io/) 博客主题。
{{< /admonition >}}
|
呈现的输出效果如下:
支持的类型
admonition shortcode 支持 13 种类型的横幅,除非你 自定义 Admonition,否则任何不支持的类型都会默认为 note 类型。类型标识不区分大小写。
完整示例如下:
注意
{{< admonition >}}
The quick brown fox jumps over the lazy dog.
{{< /admonition >}}
摘要
{{< admonition abstract >}}
The quick brown fox jumps over the lazy dog.
{{< /admonition >}}
别名:summary, tldr
信息
{{< admonition info >}}
The quick brown fox jumps over the lazy dog.
{{< /admonition >}}
待办

{{< admonition todo >}}
The quick brown fox jumps over the lazy dog.
{{< /admonition >}}
技巧
{{< admonition tip >}}
The quick brown fox jumps over the lazy dog.
{{< /admonition >}}
别名:hint, important
成功
{{< admonition success >}}
The quick brown fox jumps over the lazy dog.
{{< /admonition >}}
别名:check, done
问题
{{< admonition question >}}
The quick brown fox jumps over the lazy dog.
{{< /admonition >}}
别名:help, faq
警告
{{< admonition warning >}}
The quick brown fox jumps over the lazy dog.
{{< /admonition >}}
别名:caution, attention
失败
{{< admonition failure >}}
The quick brown fox jumps over the lazy dog.
{{< /admonition >}}
别名:fail, missing
危险
{{< admonition danger >}}
The quick brown fox jumps over the lazy dog.
{{< /admonition >}}
Alias: error
Bug
{{< admonition bug >}}
The quick brown fox jumps over the lazy dog.
{{< /admonition >}}
示例
{{< admonition example >}}
The quick brown fox jumps over the lazy dog.
{{< /admonition >}}
引用
{{< admonition quote >}}
The quick brown fox jumps over the lazy dog.
{{< /admonition >}}
Alias: cite