本文将介绍如何使用 alert
shortcode。
语法
Inline
1{{< alert [type] >}}INLINE ALERT{{< /alert >}}
Block
1{{< alert [type] >}}
2BLOCK ALERT
3{{< /alert >}}
The parameter
type
is optional. Default toinfo
, available values:info
,success
,warning
anddanger
.
带有标题
1{{< alert [type] >}}
2{{< alert-heading >}}Well Done!{{< /alert-heading >}}
3ALERT MESSAGE
4{{< /alert >}}
带有 Markdown 格式
1{{% alert warning %}}
2Alert Shortcode with Markdown Syntax:
3```bash
4$ echo 'An example of alert shortcode with the Markdown syntax'
5```
6{{% /alert %}}
Alert Shortcode with Markdown Syntax:
1$ echo 'An example of alert shortcode with the Markdown syntax'
请注意,你需要开启 markup.goldmark.renderer.unsafe
配置。
config.toml
1[markup]
2 [markup.goldmark]
3 [markup.goldmark.renderer]
4 unsafe = true
config.yaml
1markup:
2 goldmark:
3 renderer:
4 unsafe: true
config.json
1{
2 "markup": {
3 "goldmark": {
4 "renderer": {
5 "unsafe": true
6 }
7 }
8 }
9}
例子
Info
Aww yeah, you successfully read this important alert message. This example text is going to run a bit longer so that you can see how spacing within an alert works with this kind of content.
Warning
Danger
评论