alert提醒
使用 alert 警告短代码来显示提示与警告信息。该短代码会渲染为Bootstrap警告组件,支持使用Markdown格式内容,并可嵌套其他短代码。例如:
效果1: 无color
Tip
如果你在图片名称中也包含 featured 这个词,例如my-featured-background.jpg,那么它在分享时也会被用作Twitter卡片图片。
效果2: color="primary"
Tip
如果你在图片名称中也包含 featured 这个词,例如my-featured-background.jpg,那么它在分享时也会被用作Twitter卡片图片。
效果3: color="info"
Tip
如果你在图片名称中也包含 featured 这个词,例如my-featured-background.jpg,那么它在分享时也会被用作Twitter卡片图片。
效果4: color="warning"
Tip
如果你在图片名称中也包含 featured 这个词,例如my-featured-background.jpg,那么它在分享时也会被用作Twitter卡片图片。
语法
{{% alert title="Tip" %}}
如果你在图片名称中也包含**featured**这个词,例如 `my-featured-background.jpg`,那么它在分享时也会被用作Twitter卡片图片。
{{% /alert %}}
-
title(可选):用于指定警告框的标题。该标题将渲染为 Bootstrap 的警告标题,标题级别为 h4,通过将 h4 Bootstrap 类应用在<div>元素上实现。这可以避免该标题出现在页面的目录中。 -
color(可选):用于指定 Bootstrap 预定义的警告框变体之一,每种变体都有其特定的颜色。可选项包括primary,info, andwarning. 等。
提示对齐锁进
当在需要缩进的 Markdown 上下文(例如列表)中使用 alert 短代码时,警告框的内容(无论是文本/Markdown 还是短代码)必须进行相应的缩进。例如:
- The following note is part of this list item:
{{% alert title="Celebrate!" color=success %}}
This alert content is properly rendered.
{{% /alert %}}
The first list item continues.
- **Don't put content on the same line** as the opening tag, it breaks rendering:
{{% alert title="Misformed alert!" color=warning %}} **This content appears outside of
the list!** {{% /alert %}}
渲染效果:
-
The following note is part of this list item:
The first list item continues.Celebrate!
This alert content is properly rendered. -
Don’t put content on the same line as the opening tag, it breaks rendering:
Misformed alert!
This alert content appears outside of the list!