简介

该微件用于展示一条提示信息。

Markdown Blockquotes

类型

  1. GitHub Alerts 兼容,支持五个类型 (Note, Tip, Important, Warning, Caution):

    Markdown
    > [!NOTE]
    > Useful information that users should know, even when skimming content.
    
    > [!TIP]
    > Helpful advice for doing things better or more easily.
    
    > [!IMPORTANT]
    > Key information users need to know to achieve their goal.
    
    > [!WARNING]
    > Urgent info that needs immediate user attention to *avoid problems*.
    
    > [!CAUTION]
    > Advises about **risks** or negative outcomes of certain actions.
    渲染效果
    提醒 Note

    Useful information that users should know, even when skimming content.

    提示 Tip

    Helpful advice for doing things better or more easily.

    重要 Important

    Key information users need to know to achieve their goal.

    警告 Warning

    Urgent info that needs immediate user attention to avoid problems.

    注意 Caution

    Advises about risks or negative outcomes of certain actions.

  2. 额外添加四个类型 (Info, Success, Error, Danger):

    Markdown
    > [!INFO]
    > The quick brown ~~fox~~ jumps over the lazy dog.
    
    > [!SUCCESS]
    > The quick brown fox jumps over the lazy dog.
    
    > [!ERROR]
    > The quick brown fox jumps over the lazy dog.
    
    > [!DANGER]
    > The quick brown fox jumps over the lazy dog.
    渲染效果
    信息 Info

    The quick brown fox jumps over the lazy dog.

    成功 Success

    The quick brown fox jumps over the lazy dog.

    错误 Error

    The quick brown fox jumps over the lazy dog.

    危险 Danger

    The quick brown fox jumps over the lazy dog.

标题

可覆盖默认的标题:

Markdown
> [!INFO] 这是一条提示信息
> The quick brown fox jumps over the lazy dog.
渲染效果
这是一条提示信息

The quick brown fox jumps over the lazy dog.

短代码

参数

名称类型必要描述
type字符串(见上方,共 9 个类型)提示类型
title字符串提示的标题,默认与类型相关
icon字符串 / false提示的图标,默认与类型相关
设置为 false 禁用图标
small布尔truefalse(默认)小号的提示
simple布尔truefalse(默认)简化的提示

示例

Markdown
{{% notice type="info" %}}The quick brown fox jumps over the lazy dog.{{%/notice%}}
{{% notice type="info" icon=false %}}这是一个**没有图标**的提示{{%/notice%}}
{{% notice type="info" icon="bi-pen" %}}这是一个指定了**图标**的提示{{%/notice%}}
{{% notice type="info" icon="bi-pen" title="Pen" %}}这是一个指定了**图标**和**标题**的提示{{%/notice%}}
{{% notice type="tip" small=true %}}这是一个小号的提示{{%/notice%}}
{{% notice type="tip" simple=true %}}这是一个简化的提示{{%/notice%}}
{{% notice type="tip" simple=true small=true %}}这是一个简化的小号的的提示{{%/notice%}}
{{% notice type="tip" simple=true small=true icon=false %}}这是一个没有图标的简化的小号的的提示{{%/notice%}}
渲染效果
信息 Info
The quick brown fox jumps over the lazy dog.
信息 Info
这是一个没有图标的提示
信息 Info
这是一个指定了图标的提示
Pen
这是一个指定了图标标题的提示
提示 Tip
这是一个小号的提示
这是一个简化的提示
这是一个简化的小号的的提示
这是一个没有图标的简化的小号的的提示

局部模板

widgets\notice.html

参数

名称类型必要描述
pagehugo.Page
type字符串(见上方,共 9 个类型)提示类型
content提示的内容
title字符串提示的标题,默认与类型相关
icon字符串 / false提示的图标,默认与类型相关
设置为 false 禁用图标
small布尔truefalse(默认)小号的提示
simple布尔truefalse(默认)简化的提示