Butterfly主题魔改样式查阅(自带篇)
介绍
- 本篇文章主要是针对
Butterfly主题自带样式(含部分魔改样式),魔改样式查看:Butterfly主题魔改样式查阅(魔改篇) - 确保Butterfly主题是最新版、否则部分样式可能没有、
DIY样式有源码查看选项 - 部分DIY 外挂标签教程 :Tag外挂标签
- 我的魔改CSS: https://cdn.jsdelivr.net/gh/zykjofficial/zykjofficial.github.io@master/css/zykjcss.css
- Butterfly主题外挂标签教程:Butterfly主题外挂标签
Front-matter
Front-matter 是 markdown 文件最上方以 --- 分隔的区域,用于指定个别档案的变数。
- Page Front-matter 用于
页面配置 - Post Front-matter 用于
文章页配置
Page Front-matter
1 | --- |
| 参数 | 解释 |
|---|---|
| title | 【必需】页面标题 |
| date | 【必需】页面创建日期 |
| type | 【必需】标签、分类和友情链接三个页面需要配置 |
| updated | 【可选】页面更新日期 |
| description | 【可选】页面描述 |
| keywords | 【可选】页面关键字 |
| comments | 【可选】显示页面评论模块 (默认 true) |
| top_img | 【可选】页面顶部图片 |
| mathjax | 【可选】显示 mathjax (当设置 mathjax 的 per_page: false 时,才需要配置,默认 false) |
| katex | 【可选】显示 katex (当设置 katex 的 per_page: false 时,才需要配置,默认 false) |
| aside | 【可选】显示侧边栏 (默认 true) |
| aplayer | 【可选】在需要的页面加载 aplayer 的 js 和 css,请参考文章下面的音乐 配置 |
| highlight_shrink | 【可选】配置代码框是否展开 (true/false) (默认为设置中 highlight_shrink 的配置) |
| random | 【可选】配置友情链接是否随机排序(默认为 false) |
| limit | 【可选】配置说说显示数量 |
| limit.type | 【可选】配置说说显示数量的类型 (date 或者 num) |
| limit.value | 【可选】配置说说显示数量的值 |
Post Front-matter
1 | --- |
| 写法 | 解释 |
|---|---|
| title | 【必需】文章标题 |
| date | 【必需】文章创建日期 |
| updated | 【可选】文章更新日期 |
| tags | 【可选】文章标签 |
| categories | 【可选】文章分类 |
| keywords | 【可选】文章关键字 |
| description | 【可选】文章描述 |
| top_img | 【可选】文章顶部图片 |
| cover | 【可选】文章缩略图(如果没有设置 top_img,文章页顶部将显示缩略图,可设为 false/图片地址/留空) |
| comments | 【可选】显示文章评论模块(默认 true) |
| toc | 【可选】显示文章 TOC(默认为设置中 toc 的 enable 配置) |
| toc_number | 【可选】显示 toc_number(默认为设置中 toc 的 number 配置) |
| toc_style_simple | 【可选】显示 toc 简洁模式 |
| copyright | 【可选】显示文章版权模块(默认为设置中 post_copyright 的 enable 配置) |
| copyright_author | 【可选】文章版权模块的文章作者 |
| copyright_author_href | 【可选】文章版权模块的文章作者链接 |
| copyright_url | 【可选】文章版权模块的文章连结链接 |
| copyright_info | 【可选】文章版权模块的版权声明文字 |
| mathjax | 【可选】显示 mathjax(当设置 mathjax 的 per_page: false 时,才需要配置,默认 false ) |
| katex | 【可选】显示 katex (当设置 katex 的 per_page: false 时,才需要配置,默认 false ) |
| aplayer | 【可选】在需要的页面加载 aplayer 的 js 和 css,请参考文章下面的音乐 配置 |
| highlight_shrink | 【可选】配置代码框是否展开(true/false)(默认为设置中 highlight_shrink 的配置) |
| aside | 【可选】显示侧边栏 (默认 true) |
| abcjs | 【可选】加载 abcjs (当设置 abcjs 的 per_page: false 时,才需要配置,默认 false ) |
| noticeOutdate | 【可选】文章过期提醒 (默认为设置中 noticeOutdate 的 enable 配置) |
markdown
标题
由于标题渲染会影响文章这里简单写一下。
要创建标题,请#在单词或短语的前面添加数字符号()。您使用的数字符号的数量应与标题级别相对应。例如,要创建标题级别三(<h3>),请使用三个数字符号(例如### My Header)。
1 | Markdown HTML 渲染输出 |
着重
您可以通过使文本变为粗体或斜体来增加着重,
粗体
通过两个** 或者__。
I just love bold text.
I just love bold text.
1 | I just love **bold text**. |
斜体
通过两个* 或者_。
Italicized text is the cat’s meow.
Italicized text is the cat’s meow.
1 | Italicized text is the *cat's meow*. |
粗体和斜体
通过两个*** 或者___。
This text is really important.
This text is really important.
1 | This text is ***really important***. |
块引用
通过>。
Dorothy followed her through many of the beautiful rooms in her castle.
1 | > Dorothy followed her through many of the beautiful rooms in her castle. |
嵌套块引用: 通过个>>。
Dorothy followed her through many of the beautiful rooms in her castle.
The Witch bade her clean the pots and kettles and sweep the floor and keep the fire fed with wood.
1 | > Dorothy followed her through many of the beautiful rooms in her castle. |
清单
有序列表
通过数字+.。
默认
- First item
- Second item
- Third item
- Fourth item
缩进
- First item
- Second item
- Third item
- Indented item
- Indented item
- Fourth item
1 | 1. First item |
无序列表
通过-、*、+。
普通
- First item
- Second item
- Third item
- Fourth item
缩进
- First item
- Second item
- Third item
- Indented item
- Indented item
- Fourth item
1 | - First item |
高亮
1 | 通过 `` |
高亮内容
代码块
1 | 通过 ``` ``` |
1 | code |
水平线
通过---、+++、___、***
删除线
通过两个~~
删除线
链接
通过[]()
1 | [我的博客](https://zykj.js.org) |
图片
通过
1 |  |
表格
| Syntax | Description |
|---|---|
| Header | Title |
| Paragraph | Text |
1 | | Syntax | Description | |
任务清单
任务列表使您可以创建带有复选框的项目列表。在支持任务列表的Markdown应用程序中,复选框将显示在内容旁边。要创建任务列表,请在任务列表项之前添加破折号(-)和方括号,并[ ]在其前面加上一个空格()。要选择一个复选框,请x在方括号([x])之间添加in 。
- Write the press release
- Update the website
- Contact the media
1 | - [x] Write the press release |
Note
示例
simple样式
默认 提示块标签
default 提示块标签
primary 提示块标签
success 提示块标签
info 提示块标签
warning 提示块标签
danger 提示块标签
modern样式
默认 提示块标签
default 提示块标签
primary 提示块标签
success 提示块标签
info 提示块标签
warning 提示块标签
danger 提示块标签
flat样式
默认 提示块标签
default 提示块标签
primary 提示块标签
success 提示块标签
info 提示块标签
warning 提示块标签
danger 提示块标签
disabled样式
默认 提示块标签
default 提示块标签
primary 提示块标签
success 提示块标签
info 提示块标签
warning 提示块标签
danger 提示块标签
no-icon样式
你是刷 Visa 还是 UnionPay
2021年快到了….
小心开车 安全至上
这是三片呢?还是四片?
你是刷 Visa 还是 UnionPay
剪刀石头布
前端最讨厌的浏览器
使用方法
标签、自定义标签
更多内容查看:https://butterfly.js.org/posts/4aa8abbe/#Note-Bootstrap-Callout
1 | {% note 样式参数 %} |
标签、自定义标签
1 | {% note [class] [no-icon] [style] %} |
| 名称 | 用法 |
|---|---|
| class | 【可选】标识,不同的标识有不同的配色( default / primary / success / info / warning / danger ) |
| no-icon | 【可选】不显示 icon |
| style | 【可选】可以覆盖配置中的 style(simple/modern/flat/disabled) |
自定义icon
1 | {% note [color] [icon] [style] %} |
| 名称 | 用法 |
|---|---|
| color | 【可选】颜色 (default / blue / pink / red / purple / orange / green) |
| icon | 【可选】可配置自定义 icon (只支持 fontawesome 图标, 也可以配置 no-icon ) |
| style | 【可选】可以覆盖配置中的 style (simple/modern/flat/disabled) |
simple 样式
1 | {% note simple %}默认 提示块标签{% endnote %} |
modern 样式
1 | {% note modern %}默认 提示块标签{% endnote %} |
flat 样式
1 | {% note flat %}默认 提示块标签{% endnote %} |
disabled 样式
1 | {% note disabled %}默认 提示块标签{% endnote %} |
no-icon 样式
1 | {% note no-icon %}默认 提示块标签{% endnote %} |
自定义 icon
1 | {% note 'fab fa-cc-visa' simple %} |
Label
示例
臣亮言:先帝创业未半,而中道崩殂。今天下三分,益州疲敝,此诚危急存亡之秋也!然侍衞之臣,不懈于内;忠志之士,忘身于外者,盖追先帝之殊遇,欲报之于陛下也。诚宜开张圣听,以光先帝遗德,恢弘志士之气;不宜妄自菲薄,引喻失义,以塞忠谏之路也。
宫中、府中,俱为一体;陟罚臧否,不宜异同。若有作奸、犯科,及为忠善者,宜付有司,论其刑赏,以昭陛下平明之治;不宜偏私,使内外异法也。
使用方法
标签
1 | {% label text color %} |
1 | 臣亮言:{% label 先帝 %}创业未半,而{% label 中道崩殂 blue %}。今天下三分,{% label 益州疲敝 pink %},此诚{% label 危急存亡之秋 red %}也!然侍衞之臣,不懈于内;{% label 忠志之士 purple %},忘身于外者,盖追先帝之殊遇,欲报之于陛下也。诚宜开张圣听,以光先帝遗德,恢弘志士之气;不宜妄自菲薄,引喻失义,以塞忠谏之路也。 |
Tag-hide
示例
哪个英文字母最酷?
门里站着一个人?
查看代码
1 | print("Hello World") |
使用方法
Inline
1 | {% hideInline content,display,bg,color %} |
Block
1 | {% hideBlock display,bg,color %} |
Toggle
( display 不能包含英文逗号,可用 ‚)
1 | {% hideToggle display,bg,color %} |
Inline
content: 文本内容
display: 按钮显示的文字 (可选)
bg: 按钮的背景颜色 (可选)
color: 按钮文字的颜色 (可选)
Block
- content: 文本内容
- display: 按钮显示的文字 (可选)
- bg: 按钮的背景颜色 (可选)
- color: 按钮文字的颜色 (可选)
Inline
1 | 哪个英文字母最酷? {% hideInline 因为西装裤(C装酷),查看答案,#FF7242,#fff %} |
Block
1 | {% hideBlock 查看答案 %} |
Toggle
1 | {% hideToggle 查看代码 %} |
Button
示例
This is my website, click the button Butterfly
This is my website, click the button Butterfly
This is my website, click the button Butterfly
This is my website, click the button Butterfly
This is my website, click the button Butterfly
使用方法
1 | {% btn [url],[text],[icon],[color] [style] [layout] [position] [size] %} |
1 | This is my website, click the button {% btn 'https://butterfly.js.org/',Butterfly %} |
Tabs
注意:这是Butterfly主题自带样式
示例
This is Tab 1.
This is Tab 2.
This is Tab 3.
This is Tab 1.
This is Tab 2.
This is Tab 3.
This is Tab 1.
This is Tab 2.
This is Tab 3.
tab名字为第一个Tab
只有图标 没有Tab名字
名字+icon
使用方法
1 | {% tabs Unique name, [index] %} |
文档教程:https://butterfly.js.org/posts/4aa8abbe/#Tabs
1 | {% tabs test1 %} |
Gallery
注意:这是Butterfly主题自带样式
示例
使用方法
Gallery相册图库
1 | <div class="gallery-group-main"> |
- name:图库名字
- description:图库描述
- link:连接到对应相册的地址
- img-url:图库封面的地址
Gallery相册
1 | {% gallery %} |
Gallery相册图库
1 | <div class="gallery-group-main"> |
Gallery相册
1 | {% gallery %} |
inlineImg
注意:这是Butterfly主题自带样式
https://butterfly.js.org/posts/4aa8abbe/#inlineImg
示例
你看我长得漂亮不
我觉得很漂亮
使用方法
主题中的图片都是默认以块级元素显示,如果你想以内联元素显示,可以使用这个标签外挂。
1 | {% inlineImg [src] [height] %} |
1 | 你看我长得漂亮不 |
timeline
注意:这是Butterfly主题自带样式
https://butterfly.js.org/posts/4aa8abbe/#timeline
示例
2022
01-02
这是测试页面
2022
01-02
这是测试页面
2022
01-02
这是测试页面
2022
01-02
这是测试页面
2022
01-02
这是测试页面
2022
01-02
这是测试页面
2022
01-02
这是测试页面
使用方法
1 | {% timeline title,color %} |
| 名称 | 用法 |
|---|---|
| title | 标题/时间线 |
| color | timeline 颜色 default(留空) / blue / pink / red / purple / orange / green |
1 | {% timeline 2022 %} |
flink
注意:这是Butterfly主题自带样式
https://butterfly.js.org/posts/4aa8abbe/#flink
示例
使用方法
可在任何界面插入类似友情链接列表效果
内容格式与友情链接界面一样,支持 yml 格式
1 | {% flink %} |
1 | {% flink %} |
Mermaid
使用 mermaid 标签可以绘制 Flowchart(流程图)、Sequence diagram(时序图 )、Class Diagram(类别图)、State Diagram(状态图)、Gantt(甘特图)和 Pie Chart(圆形图),具体可以查看mermaid 文档
pie
title Key elements in Product X
"Calcium" : 42.96
"Potassium" : 50.05
"Magnesium" : 10.01
"Iron" : 5
使用方法
在_config.Butterfly.yml开启Mermaid功能
1 | # Mermaid |
写法:
1 | {% mermaid '[config]' %} |
| 参数 | 解释 |
|---|---|
| config | 【可选】mermaid 图表配置, 以 JSON 格式书写,具体配置参数请参考mermaid 文档 |
1 | {% mermaid %} |
Chartjs
另一种方式添加图表
{
"type": "pie",
"data": {
"labels": [
"编程",
"音乐",
"阅读",
"游戏",
"健身",
"旅游"
],
"datasets": [
{
"label": "喜爱指数",
"data": [
30,
24,
19,
14,
9,
4
],
"backgroundColor": {
"dark-mode": [
"rgba(255, 99, 132, 0.5)",
"rgba(54, 162, 235, 0.5)",
"rgba(255, 206, 86, 0.5)",
"rgba(75, 192, 192, 0.5)",
"rgba(153, 102, 255, 0.5)",
"rgba(255, 159, 64, 0.5)"
],
"light-mode": [
"rgba(255, 99, 132, 0.2)",
"rgba(54, 162, 235, 0.2)",
"rgba(255, 206, 86, 0.2)",
"rgba(75, 192, 192, 0.2)",
"rgba(153, 102, 255, 0.2)",
"rgba(255, 159, 64, 0.2)"
]
},
"borderColor": {
"dark-mode": [
"rgba(255, 99, 132, 1)",
"rgba(54, 162, 235, 1)",
"rgba(255, 206, 86, 1)",
"rgba(75, 192, 192, 1)",
"rgba(153, 102, 255, 1)",
"rgba(255, 159, 64, 1)"
],
"light-mode": [
"rgba(255, 99, 132, 1)",
"rgba(54, 162, 235, 1)",
"rgba(255, 206, 86, 1)",
"rgba(75, 192, 192, 1)",
"rgba(153, 102, 255, 1)",
"rgba(255, 159, 64, 1)"
]
}
}
]
},
"options": {
"plugins": {
"legend": {
"labels": {
"color": {
"dark-mode": "rgba(255, 255, 255, 0.8)",
"light-mode": "rgba(0, 0, 0, 0.8)"
}
}
}
}
}
}
除了计算机编程外,我想不出还有其他让我感兴趣的工作。
我可以无中生有地创造出精美的范式和结构,
在此过程中也解决了无数的小谜团。
I can’t think of any other job other than computer programming that interests me.
I can create beautiful paradigms and structures out of nothing,
Countless small mysteries are also solved in the process.
使用方法
在_config.Butterfly.yml开启Chartjs功能
1 | # chartjs |
| 参数 | 解释 |
|---|---|
| enable | 是否启用 chartjs |
| fontColor | 图表的字体颜色 |
| borderColor | 图表的边框颜色 |
| scale_ticks_backdropColor | 雷达和极区图表的刻度标签的背景颜色 |
写法:
1 | {% chartjs [width, abreast, chartId] %} |
| 参数 | 解释 |
|---|---|
| width | 【可选】图表宽度 |
| abreast | 【可选】是否并排显示,当你写了 , 使用并排模式,图标和描述将并排显示。abreast 为 true 时,需要配置 width 的值 |
| chartid | 【可选】图表 ID |
1 | {% chartjs 40,true %} |










