skip to content
行之

Markdown 提示框(Admonitions)

/ 约2分钟

更新:
目 录

什么是提示框

提示框(也称为“旁注”)适用于提供与正文相关的辅助或补充信息。

如何使用

在 Astro Cactus 中使用提示框时,将 Markdown 内容包裹在一对三冒号 ::: 之间。第一行需要指定要使用的提示框类型。

例如,以下 Markdown:

:::note
Highlights information that users should take into account, even when skimming.
:::

将渲染为:

提示框类型

当前支持以下类型:

  • note
  • tip
  • important
  • warning
  • caution

Note(说明)

:::note
突显用户在快速浏览时也应注意的信息。
:::

Tip(提示)

:::tip
可选信息,帮助用户更好地完成任务。
:::

Important(重要)

:::important
至关重要的信息。
:::

Caution(注意)

:::caution
某些操作可能带来的不良后果。
:::

Warning(警告)

:::warning
由于潜在风险,需要用户立即关注的关键信息。
:::

自定义提示框标题

可以使用以下标记自定义提示框标题:

:::note[My custom title]
This is a note with a custom title.
:::

将渲染为:

GitHub 仓库卡片

你可以添加指向 GitHub 仓库的动态卡片。页面加载时,仓库信息将通过 GitHub API 获取。

Lorem ipsum dolor sit amet, consectetur adipiscing elit.
00K00KMIT

你也可以链接 GitHub 用户:

00K00K

要使用该功能,直接使用 “Github” 指令:

Linking a repo
::github{repo="chrismwilliams/astro-theme-cactus"}
Linking a user
::github{user="withastro"}