徽章、按钮和图标
徽章
内联徽章可以用作标签组件。徽章提供每种语义颜色,包括填充和轮廓变体
普通徽章
primary (主要), primary-line (主要-线条)
secondary (次要), secondary-line (次要-线条)
success (成功), success-line (成功-线条)
info (信息), info-line (信息-线条)
warning (警告), warning-line (警告-线条)
danger (危险), danger-line (危险-线条)
light (浅色), light-line (浅色-线条)
dark (深色), dark-line (深色-线条)
语法
{bdg}`plain badge`
{bdg-primary}`primary`, {bdg-primary-line}`primary-line`
{bdg-secondary}`secondary`, {bdg-secondary-line}`secondary-line`
{bdg-success}`success`, {bdg-success-line}`success-line`
{bdg-info}`info`, {bdg-info-line}`info-line`
{bdg-warning}`warning`, {bdg-warning-line}`warning-line`
{bdg-danger}`danger`, {bdg-danger-line}`danger-line`
{bdg-light}`light`, {bdg-light-line}`light-line`
{bdg-dark}`dark`, {bdg-dark-line}`dark-line`
:bdg:`plain badge`
:bdg-primary:`primary`, :bdg-primary-line:`primary-line`
:bdg-secondary:`secondary`, :bdg-secondary-line:`secondary-line`
:bdg-success:`success`, :bdg-success-line:`success-line`
:bdg-info:`info`, :bdg-info-line:`info-line`
:bdg-warning:`warning`, :bdg-warning-line:`warning-line`
:bdg-danger:`danger`, :bdg-danger-line:`danger-line`
:bdg-light:`light`, :bdg-light-line:`light-line`
:bdg-dark:`dark`, :bdg-dark-line:`dark-line`
bdg-link-
和 bdg-ref-
变体也适用于链接和引用。语法与 ref
角色相同。
语法
{bdg-link-primary}`https://example.com`
{bdg-link-primary-line}`explicit title <https://example.com>`
:bdg-link-primary:`https://example.com`
:bdg-link-primary-line:`explicit title <https://example.com>`
有关更多信息,请参阅 Bootstrap 徽章,以及相关的 Material Design 芯片。
按钮
按钮允许用户通过单击导航到外部 (button-link
) / 内部 (button-ref
) 链接。
语法
```{button-link} https://example.com
```
```{button-link} https://example.com
Button text
```
```{button-link} https://example.com
:color: primary
:shadow:
```
```{button-link} https://example.com
:color: primary
:outline:
```
```{button-link} https://example.com
:color: secondary
:expand:
```
.. button-link:: https://example.com
.. button-link:: https://example.com
Button text
.. button-link:: https://example.com
:color: primary
:shadow:
.. button-link:: https://example.com
:color: primary
:outline:
.. button-link:: https://example.com
:color: secondary
:expand:
请注意,默认情况下,sphinx 会将引用的内容转换为原始文本。例如,**Bold text**
且 ref-type
设置为 ref
将在没有粗体的情况下呈现
但是,如果使用 myst-parser,您可以将 ref-type
设置为 myst
,内容将正确呈现
使用 click-parent
选项使按钮的父容器也可点击。
有关更多详细信息,请参阅 Material Design 和 Bootstrap 描述。
button-link
和 button-ref
选项
- ref-type (
button-ref
仅限) 要使用的引用类型;
any
(默认),ref
,doc
, 或myst
- color (颜色)
设置按钮的颜色(背景和字体)。语义颜色名称之一:
primary
,secondary
,success
,danger
,warning
,info
,light
,dark
,muted
。- outline (轮廓)
轮廓颜色变体
- align (对齐)
在页面上对齐按钮;
left
,right
,center
或justify
- expand (展开)
展开以适应父宽度
- click-parent (点击父级)
使父容器也可点击
- tooltip (工具提示)
悬停时添加工具提示
- shadow (阴影)
添加阴影 CSS
- class (类)
附加 CSS 类
内联图标
内联图标角色可用于 GitHub octicon、Google Material Design Icons 或 FontAwesome 库。
Octicon 图标和 Material 图标作为 SVG 直接添加到页面中,分别使用 octicon
和 material-<flavor>
角色。请参阅下文了解 Material Design Icons 的不同风格。
默认情况下,图标的高度为 1em
(即字体的高度)。可以在分号 (;
) 后设置特定高度,单位可以是 px
、em
或 rem
。也可以在第二个分号 (;
) 分隔符后向 SVG 添加其他 CSS 类。
Octicon 图标
一个彩色图标,一些更多文本。
A coloured icon: {octicon}`report;1em;sd-text-info`, some more text.
A coloured icon: :octicon:`report;1em;sd-text-info`, some more text.
所有 Octicons
accessibility (无障碍) |
|
accessibility-inset (无障碍-内嵌) |
|
alert (警告) |
|
alert-fill (警告-填充) |
|
apps (应用) |
|
archive (存档) |
|
arrow-both (双向箭头) |
|
arrow-down (向下箭头) |
|
arrow-down-left (左下箭头) |
|
arrow-down-right (右下箭头) |
|
arrow-left (向左箭头) |
|
arrow-right (向右箭头) |
|
arrow-switch (箭头切换) |
|
arrow-up (向上箭头) |
|
arrow-up-left (左上箭头) |
|
arrow-up-right (右上箭头) |
|
beaker (烧杯) |
|
bell (铃铛) |
|
bell-fill (铃铛-填充) |
|
bell-slash (铃铛-斜线) |
|
blocked (阻止) |
|
bold (粗体) |
|
book (书) |
|
bookmark (书签) |
|
bookmark-fill (书签-填充) |
|
bookmark-slash (书签-斜线) |
|
bookmark-slash-fill (书签-斜线-填充) |
|
briefcase (公文包) |
|
broadcast (广播) |
|
browser (浏览器) |
|
bug (错误) |
|
cache (缓存) |
|
calendar (日历) |
|
check (检查) |
|
check-circle (检查-圆圈) |
|
check-circle-fill (检查-圆圈-填充) |
|
checkbox (复选框) |
|
checklist (清单) |
|
chevron-down (向下箭头) |
|
chevron-left (向左箭头) |
|
chevron-right (向右箭头) |
|
chevron-up (向上箭头) |
|
circle (圆圈) |
|
circle-slash (圆圈-斜线) |
|
clock (时钟) |
|
clock-fill (时钟-填充) |
|
cloud (云) |
|
cloud-offline (云-离线) |
|
code (代码) |
|
code-of-conduct (行为准则) |
|
code-review (代码审查) |
|
code-square (代码-正方形) |
|
codescan (代码扫描) |
|
codescan-checkmark (代码扫描-复选标记) |
|
codespaces (代码空间) |
|
columns (列) |
|
command-palette (命令面板) |
|
comment (评论) |
|
comment-discussion (评论-讨论) |
|
commit (提交) |
|
container (容器) |
|
copilot (副驾驶) |
|
copilot-error (副驾驶-错误) |
|
copilot-warning (副驾驶-警告) |
|
copy (复制) |
|
cpu (CPU) |
|
credit-card (信用卡) |
|
cross-reference (交叉引用) |
|
dash (破折号) |
|
database (数据库) |
|
dependabot (Dependabot) |
|
desktop-download (桌面下载) |
|
device-camera (设备-相机) |
|
device-camera-video (设备-摄像机-视频) |
|
device-desktop (设备-桌面) |
|
device-mobile (设备-移动) |
|
devices (设备) |
|
diamond (钻石) |
|
diff (差异) |
|
diff-added (差异-添加) |
|
diff-ignored (差异-忽略) |
|
diff-modified (差异-修改) |
|
diff-removed (差异-移除) |
|
diff-renamed (差异-重命名) |
|
discussion-closed (讨论-关闭) |
|
discussion-duplicate (讨论-重复) |
|
discussion-outdated (讨论-过时) |
|
dot (点) |
|
dot-fill (点-填充) |
|
download (下载) |
|
duplicate (重复) |
|
ellipsis (省略号) |
|
eye (眼睛) |
|
eye-closed (眼睛-闭合) |
|
feed-discussion (订阅-讨论) |
|
feed-forked (订阅-派生) |
|
feed-heart (订阅-心形) |
|
feed-issue-closed (订阅-问题-关闭) |
|
feed-issue-draft (订阅-问题-草稿) |
|
feed-issue-open (订阅-问题-打开) |
|
feed-issue-reopen (订阅-问题-重新打开) |
|
feed-merged (订阅-合并) |
|
feed-person (订阅-个人) |
|
feed-plus (订阅-加号) |
|
feed-public (订阅-公开) |
|
feed-pull-request-closed (订阅-拉取请求-关闭) |
|
feed-pull-request-draft (订阅-拉取请求-草稿) |
|
feed-pull-request-open (订阅-拉取请求-打开) |
|
feed-repo (订阅-仓库) |
|
feed-rocket (订阅-火箭) |
|
feed-star (订阅-星形) |
|
feed-tag (订阅-标签) |
|
feed-trophy (订阅-奖杯) |
|
file (文件) |
|
file-added (文件-添加) |
|
file-badge (文件-徽章) |
|
file-binary (文件-二进制) |
|
file-code (文件-代码) |
|
file-diff (文件-差异) |
|
file-directory (文件-目录) |
|
file-directory-fill (文件-目录-填充) |
|
file-directory-open-fill (文件-目录-打开-填充) |
|
file-directory-symlink (文件-目录-符号链接) |
|
file-media (文件-媒体) |
|
file-moved (文件-移动) |
|
file-removed (文件-移除) |
|
file-submodule (文件-子模块) |
|
file-symlink-file (文件-符号链接-文件) |
|
file-zip (文件-压缩) |
|
filter (筛选器) |
|
filter-remove (筛选器-移除) |
|
fiscal-host (财政主机) |
|
flame (火焰) |
|
fold (折叠) |
|
fold-down (向下折叠) |
|
fold-up (向上折叠) |
|
gear (齿轮) |
|
gift (礼物) |
|
git-branch (Git 分支) |
|
git-commit (Git 提交) |
|
git-compare (Git 比较) |
|
git-merge (Git 合并) |
|
git-merge-queue (Git 合并队列) |
|
git-pull-request (Git 拉取请求) |
|
git-pull-request-closed (Git 拉取请求-关闭) |
|
git-pull-request-draft (Git 拉取请求-草稿) |
|
globe (地球) |
|
goal (目标) |
|
grabber (抓取器) |
|
graph (图表) |
|
hash (哈希) |
|
heading (标题) |
|
heart (心形) |
|
heart-fill (心形-填充) |
|
history (历史记录) |
|
home (主页) |
|
home-fill (主页-填充) |
|
horizontal-rule (水平线) |
|
hourglass (沙漏) |
|
hubot (Hubot) |
|
id-badge (ID 徽章) |
|
image (图像) |
|
inbox (收件箱) |
|
infinity (无限) |
|
info (信息) |
|
issue-closed (问题-关闭) |
|
issue-draft (问题-草稿) |
|
issue-opened (问题-打开) |
|
issue-reopened (问题-重新打开) |
|
issue-tracked-by (问题-被跟踪者) |
|
issue-tracks (问题-跟踪) |
|
italic (斜体) |
|
iterations (迭代) |
|
kebab-horizontal (水平省略号) |
|
key (钥匙) |
|
key-asterisk (钥匙-星号) |
|
law (法律) |
|
light-bulb (灯泡) |
|
link (链接) |
|
link-external (外部链接) |
|
list-ordered (有序列表) |
|
list-unordered (无序列表) |
|
location (位置) |
|
lock (锁定) |
|
log (日志) |
|
logo-gist (Gist 标志) |
|
logo-github (GitHub 标志) |
|
mail (邮件) |
|
mark-github (GitHub 标记) |
|
markdown (Markdown) |
|
megaphone (扩音器) |
|
mention (提及) |
|
meter (仪表) |
|
milestone (里程碑) |
|
mirror (镜像) |
|
moon (月亮) |
|
mortar-board (学位帽) |
|
move-to-bottom (移到底部) |
|
move-to-end (移到末尾) |
|
move-to-start (移到开头) |
|
move-to-top (移到顶部) |
|
multi-select (多选) |
|
mute (静音) |
|
no-entry (禁止入内) |
|
no-entry-fill (禁止入内-填充) |
|
north-star (北极星) |
|
note (笔记) |
|
number (数字) |
|
organization (组织) |
|
package (包) |
|
package-dependencies (包-依赖项) |
|
package-dependents (包-依赖者) |
|
paintbrush (画笔) |
|
paper-airplane (纸飞机) |
|
paperclip (回形针) |
|
passkey-fill (通行密钥-填充) |
|
paste (粘贴) |
|
pencil (铅笔) |
|
people (人) |
|
person (人) |
|
person-add (添加人) |
|
person-fill (人-填充) |
|
pin (图钉) |
|
pin-slash (图钉-斜线) |
|
pivot-column (透视列) |
|
play (播放) |
|
plug (插头) |
|
plus (加号) |
|
plus-circle (加号-圆圈) |
|
project (项目) |
|
project-roadmap (项目-路线图) |
|
project-symlink (项目-符号链接) |
|
project-template (项目-模板) |
|
pulse (脉冲) |
|
question (问题) |
|
quote (引用) |
|
read (阅读) |
|
redo (重做) |
|
rel-file-path (相对文件路径) |
|
reply (回复) |
|
repo (仓库) |
|
repo-clone (仓库-克隆) |
|
repo-deleted (仓库-已删除) |
|
repo-forked (仓库-已派生) |
|
repo-locked (仓库-已锁定) |
|
repo-pull (仓库-拉取) |
|
repo-push (仓库-推送) |
|
repo-template (仓库-模板) |
|
report (报告) |
|
rocket (火箭) |
|
rows (行) |
|
rss (RSS) |
|
ruby (Ruby) |
|
screen-full (全屏) |
|
screen-normal (正常屏幕) |
|
search (搜索) |
|
server (服务器) |
|
share (分享) |
|
share-android (Android 分享) |
|
shield (盾牌) |
|
shield-check (盾牌-检查) |
|
shield-lock (盾牌-锁定) |
|
shield-slash (盾牌-斜线) |
|
shield-x (盾牌-X) |
|
sidebar-collapse (侧边栏-折叠) |
|
sidebar-expand (侧边栏-展开) |
|
sign-in (登录) |
|
sign-out (登出) |
|
single-select (单选) |
|
skip (跳过) |
|
skip-fill (跳过-填充) |
|
sliders (滑块) |
|
smiley (笑脸) |
|
sort-asc (升序排序) |
|
sort-desc (降序排序) |
|
sparkle-fill (闪耀-填充) |
|
sponsor-tiers (赞助层级) |
|
square (正方形) |
|
square-fill (正方形-填充) |
|
squirrel (松鼠) |
|
stack (堆叠) |
|
star (星形) |
|
star-fill (星形-填充) |
|
stop (停止) |
|
stopwatch (秒表) |
|
strikethrough (删除线) |
|
sun (太阳) |
|
sync (同步) |
|
tab (标签页) |
|
tab-external (外部标签页) |
|
table (表格) |
|
tag (标签) |
|
tasklist (任务列表) |
|
telescope (望远镜) |
|
telescope-fill (望远镜-填充) |
|
terminal (终端) |
|
three-bars (三条横线) |
|
thumbsdown (点踩) |
|
thumbsup (点赞) |
|
tools (工具) |
|
tracked-by-closed-completed (被跟踪者-关闭-已完成) |
|
tracked-by-closed-not-planned (被跟踪者-关闭-未计划) |
|
trash (垃圾桶) |
|
triangle-down (向下三角形) |
|
triangle-left (向左三角形) |
|
triangle-right (向右三角形) |
|
triangle-up (向上三角形) |
|
trophy (奖杯) |
|
typography (排版) |
|
undo (撤销) |
|
unfold (展开) |
|
unlink (取消链接) |
|
unlock (解锁) |
|
unmute (取消静音) |
|
unread (未读) |
|
unverified (未验证) |
|
upload (上传) |
|
verified (已验证) |
|
versions (版本) |
|
video (视频) |
|
webhook (Webhook) |
|
workflow (工作流) |
|
x (X) |
|
x-circle (X-圆圈) |
|
x-circle-fill (X-圆圈-填充) |
|
zap (闪电) |
|
zoom-in (放大) |
|
zoom-out (缩小) |
Material Design 图标
Material Design 图标有几种风格。每种风格代表 sphinx-design 中使用的不同角色。这些风格是
material-regular (Material 常规)
material-outlined (Material 轮廓)
material-round (Material 圆角)
material-sharp (Material 锐角)
material-twotone (Material 双色调)
并非所有图标都适用于每种风格,但大多数都适用。与其在此处显示 10660 多个图标,我们鼓励您从 Google 托管的 Material Design Icons 展示 中浏览可用图标。
一个常规图标,一些更多文本
一个彩色常规图标,一些更多文本。
一个彩色轮廓图标,一些更多文本。
一个彩色锐角图标,一些更多文本。
一个彩色圆角图标,一些更多文本。
一个彩色双色调图标,一些更多文本。
- A regular icon: {material-regular}`data_exploration;2em`, some more text
- A coloured regular icon: {material-regular}`settings;3em;sd-text-success`, some more text.
- A coloured outline icon: {material-outlined}`settings;3em;sd-text-success`, some more text.
- A coloured sharp icon: {material-sharp}`settings;3em;sd-text-success`, some more text.
- A coloured round icon: {material-round}`settings;3em;sd-text-success`, some more text.
- A coloured two-tone icon: {material-twotone}`settings;3em;sd-text-success`, some more text.
- A fixed size icon: {material-regular}`data_exploration;24px`, some more text.
- A regular icon: :material-regular:`data_exploration;2em`, some more text
- A coloured regular icon: :material-regular:`settings;3em;sd-text-success`, some more text.
- A coloured outline icon: :material-outlined:`settings;3em;sd-text-success`, some more text.
- A coloured sharp icon: :material-sharp:`settings;3em;sd-text-success`, some more text.
- A coloured round icon: :material-round:`settings;3em;sd-text-success`, some more text.
- A coloured two-tone icon: :material-twotone:`settings;3em;sd-text-success`, some more text.
- A fixed size icon: :material-regular:`data_exploration;24px`, some more text.
FontAwesome 图标
FontAwesome 图标通过 Fontawesome CSS 类添加。如果您使用的主题尚未包含 FontAwesome CSS,则应使用 html_css_files 选项从 font-awesome CDN 在您的配置中加载它,例如
html_css_files = [
"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css"
]
角色名称可以使用 fa
(在 font-awesome v5 中已弃用)、fas
、fab
或 far
。请注意,并非所有 regular 样式图标都是免费的,far
角色仅适用于免费图标。
警告
由于 FontAwesome 图标直接从其分布式 CSS 获取,因此不支持为 fa*
角色指定高度/大小。但是,您可以随时添加控制 font-size
属性的自定义 CSS 类。
如果为 fa*
角色提供了高度/大小,则它将被解释为 CSS 类。fa*
角色的参数中最多只能有 1 个 ;
- An icon {fas}`spinner;sd-text-primary`, some more text.
- An icon {fab}`github`, some more text.
- An icon {fab}`gitkraken;sd-text-success fa-xl`, some more text.
- An icon {fas}`skull;sd-text-danger`, some more text.
- An icon :fas:`spinner;sd-text-primary`, some more text.
- An icon :fab:`github`, some more text.
- An icon :fab:`gitkraken;sd-text-success fa-xl`, some more text.
- An icon :fas:`skull;sd-text-danger`, some more text.
一个图标 ,一些更多文本。
一个图标 ,一些更多文本。
一个图标 ,一些更多文本。
一个图标 ,一些更多文本。
默认情况下,图标将仅以 HTML 格式输出。但是,如果您希望 FontAwesome 图标在 LaTeX 上输出,使用 fontawesome package,您可以添加到您的配置中
sd_fontawesome_latex = True