这篇文章上半部分是标准 Markdown(含 GitHub 风格扩展),下半部分是 Stellar 主题提供的标签插件。

一、标准 Markdown

1. 标题

文章标题由 front matter 里的 title 生成,相当于一级标题。正文里的章节从二级标题开始:

1
2
3
4
5
## 二级标题
### 三级标题
#### 四级标题
##### 五级标题
###### 六级标题

四级标题示例

五级标题示例
六级标题示例

2. 段落与换行

1
2
3
4
段落之间空一行。

同一段落内要换行,可以在行尾加两个空格,
或者使用 HTML 的换行标签。<br>这样也能换行。

段落之间空一行。

同一段落内要换行,可以在行尾加两个空格,
或者使用 HTML 的换行标签。
这样也能换行。

3. 强调

1
2
3
4
*斜体* 或 _斜体_
**粗体** 或 __粗体__
***粗斜体***
~~删除线~~

斜体 或 斜体

粗体 或 粗体

粗斜体

删除线

4. 引用

1
2
3
4
5
> 这是一段引用。
>
> 引用里可以有**格式**,也可以嵌套:
>
> > 这是嵌套的引用。

这是一段引用。

引用里可以有格式,也可以嵌套:

这是嵌套的引用。

5. 列表

1
2
3
4
5
6
7
8
9
10
11
12
- 无序列表项
- 另一项
- 缩进两个空格,形成嵌套
- 再嵌套一层

1. 有序列表
2. 第二项
1. 嵌套的有序列表
2. 第二个子项

- [x] 已完成的任务
- [ ] 未完成的任务
  • 无序列表项
  • 另一项
    • 缩进两个空格,形成嵌套
      • 再嵌套一层
  1. 有序列表
  2. 第二项
    1. 嵌套的有序列表
    2. 第二个子项
  • 已完成的任务
  • 未完成的任务

6. 代码

行内代码用一对反引号包裹:hexo generate。

代码块用三个反引号包裹,并在开头注明语言,就会有语法高亮:

1
2
3
4
```powershell
hexo clean
hexo generate
```
1
2
hexo clean
hexo generate
1
2
3
4
5
// 一段 JavaScript
function greet(name) {
return `Hello, ${name}!`
}
console.log(greet('Stellar'))
1
2
3
4
server {
listen 80 default_server;
root /var/www/blog;
}

7. 分隔线

1
---

8. 链接

1
2
3
4
5
6
[行内链接](https://hexo.io)
[带标题的链接](https://hexo.io "鼠标悬停时显示")
[引用式链接][hexo]
<https://github.com>

[hexo]: https://hexo.io

行内链接

带标题的链接

引用式链接

https://github.com

站内链接直接写路径,比如 归档页。

9. 图片

1
![图片说明](/images/demo/photo-1.svg "图片标题")

图片说明

图片放在 source/images/ 下,引用时路径从 /images/ 开始。

10. 表格

1
2
3
4
| 左对齐 | 居中 | 右对齐 |
| :--- | :---: | ---: |
| Hexo | 静态 | 8.x |
| Stellar | 主题 | 2.x |
左对齐 居中 右对齐
Hexo 静态 8.x
Stellar 主题 2.x

11. 转义字符

想显示 Markdown 的特殊符号本身,在前面加反斜杠:

1
\*不是斜体\*  \# 不是标题  \[不是链接\]

*不是斜体* # 不是标题 [不是链接]

12. 内嵌 HTML

Markdown 里可以直接写 HTML:

1
2
3
4
5
6
7
按 <kbd>Ctrl</kbd> + <kbd>C</kbd> 复制。
H<sub>2</sub>O,x<sup>2</sup>,<mark>高亮文字</mark>。

<details>
<summary>点击展开</summary>
这里是折叠的内容。
</details>

按 Ctrl + C 复制。
H2O,x2,高亮文字。

点击展开 这里是折叠的内容。

13. 数学公式

需要在 front matter 里开启:

1
2
render:
math: mathjax

行内公式用一对 $ 包裹,独立公式用一对 $$ 包裹。Stellar 只在页面里找到 class="has-jax" 的元素时才会加载 MathJax,所以公式要放在带这个 class 的 HTML 标签里。这样做还有一个好处:HTML 块里的内容不会被 Markdown 处理,公式里的 _ 和 \ 不会被误当成 Markdown 语法:

1
2
3
4
5
6
7
质能方程 <span class="has-jax">$E = mc^2$</span> 是行内公式。

<div class="has-jax">
$$
\sum_{i=1}^{n} i = \frac{n(n+1)}{2}
$$
</div>

质能方程 $E = mc^2$ 是行内公式。

$$ \sum_{i=1}^{n} i = \frac{n(n+1)}{2} $$

14. Mermaid 图表

需要在 front matter 里开启:

1
2
render:
diagrams: mermaid

然后用 class="mermaid" 的 pre 标签写图表:

1
2
3
4
<pre class="mermaid">
graph LR
A[写文章] --> B[hexo generate] --> C[deploy.ps1] --> D[VPS]
</pre>
graph LR
  A[写文章] --> B[hexo generate] --> C[deploy.ps1] --> D[VPS]

15. 不支持的语法

Hexo 默认的渲染器 hexo-renderer-marked 不支持定义列表。需要的话可以换成 hexo-renderer-markdown-it 并安装对应插件。

marked 本身也不支持脚注([^1]),本站用 scripts/footnote.js 在渲染前做了转换,正文里写 [^id],文末写 [^id]: 内容 即可。

二、Stellar 标签插件

Stellar 的标签插件都写成 {% 名称 参数 %} 的形式。参数用空格分隔,key:value 是可选参数。容器类标签需要用 {% end名称 %} 结束。

很多标签支持 color: 参数,可选颜色有:red、orange、amber、yellow、green、cyan、blue、purple、theme、accent、light、dark、warning、error。

1. 文字修饰

1
2
3
4
{% u 下划线 %}、{% emp 着重号 %}、{% wavy 波浪线 %}、{% del 删除线 %}
按 {% kbd Ctrl %} + {% kbd S %} 保存
密码是 {% psw 鼠标移上来才显示 %},{% blur 模糊文字 %}
H{% sub 2 %}O,E = mc{% sup 2 color:red %}
下划线、着重号、波浪线、删除线

按 Ctrl + S 保存

密码是 鼠标移上来才显示,模糊文字

H2O,E = mc2

2. 高亮标记 mark

1
2
{% mark 默认颜色 %}、{% mark 红色 color:red %}、{% mark 绿色 color:green %}
{% mark 带提示 color:blue tip:鼠标悬停显示的提示 %}
默认颜色、红色、绿色 带提示鼠标悬停显示的提示

3. 注解 tip

1
Stellar 是一个{% tip 全能型 pop:博客、文档、知识库都能做 %}的 Hexo 主题。

Stellar 是一个全能型博客、文档、知识库都能做的 Hexo 主题。

4. 话题标签 hashtag

1
{% hashtag Markdown /tags/Markdown/ %} {% hashtag Hexo /tags/Hexo/ %} {% hashtag Stellar /tags/Stellar/ color:purple %}
Markdown Hexo Stellar

5. 图标 icon

1
2
{% icon github:logo %} {% icon default:fire color:red %} {% icon default:calendar color:blue %}
{% icon default:edit 带文字的图标 %}
带文字的图标

6. 表情 emoji

1
{% emoji twemoji 1f600 %} {% emoji twemoji 1f680 %} {% emoji twemoji 2764 %}

twemoji 是表情来源,后面是表情的 Unicode 编码。主题配置里还内置了 qq、aru、tieba、blobcat 等来源。

7. 复选框 checkbox 与单选框 radio

1
2
3
4
5
6
{% checkbox 未选中 %}
{% checkbox checked:true 已选中 %}
{% checkbox color:green symbol:plus checked:true 加号样式 %}
{% checkbox color:red symbol:times checked:true 叉号样式 %}
{% radio 未选中的单选 %}
{% radio color:cyan checked:true 已选中的单选 %}
未选中
已选中
加号样式
叉号样式
未选中的单选
已选中的单选

8. 复制框 copy

1
2
{% copy npm i hexo-theme-stellar %}
{% copy git:ssh xaoxuu/hexo-theme-stellar %}

9. 按钮 button

1
2
3
{% button 主题文档 https://xaoxuu.com/wiki/stellar/ %}
{% button color:green 源码仓库 https://github.com/xaoxuu/hexo-theme-stellar icon:github:logo %}
{% button color:orange 小号按钮 /archives/ size:xs %}
主题文档 源码仓库 小号按钮
1
{% link https://github.com/xaoxuu/hexo-theme-stellar Stellar主题仓库 %}

11. 提示块 note

第一个词是标题,后面是内容。只写一段文字时,就没有标题:

1
2
3
4
{% note 只有内容、没有标题的提示块。 %}
{% note color:green 提示 这是一个绿色的提示块,内容支持 **Markdown**。 %}
{% note color:yellow 注意 修改配置后记得执行 `hexo clean`。 %}
{% note color:red 警告 执行 `rm -rf` 之前一定要确认路径。 %}

只有内容、没有标题的提示块。

提示

这是一个绿色的提示块,内容支持 Markdown。

注意

修改配置后记得执行 hexo clean。

警告

执行 rm -rf 之前一定要确认路径。

12. 醒目语句 quot

1
2
3
{% quot 好的工具,让写作回归写作本身。 %}
{% quot el:h3 icon:hashtag 话题式标题 %}
{% quot icon:question 为什么选择静态博客? %}

好的工具,让写作回归写作本身。

话题式标题

为什么选择静态博客?

13. 引用块 blockquote

1
2
3
{% blockquote %}
Stellar 版的引用块,比标准 Markdown 引用更醒目。
{% endblockquote %}

Stellar 版的引用块,比标准 Markdown 引用更醒目。

14. 诗词 poetry

1
2
3
4
{% poetry 静夜思 author:李白 footer:唐诗三百首 %}
床前明月光,疑是地上霜。
举头望明月,低头思故乡。
{% endpoetry %}
静夜思
李白

床前明月光,疑是地上霜。
举头望明月,低头思故乡。

15. 卷轴 reel

1
2
3
4
{% reel 登鹳雀楼 author:王之涣 %}
白日依山尽,黄河入海流。
欲穷千里目,更上一层楼。
{% endreel %}
登鹳雀楼
王之涣

白日依山尽,黄河入海流。
欲穷千里目,更上一层楼。

16. 信纸 paper

1
2
3
4
5
6
7
8
9
10
{% paper style:underline title:建站笔记 author:我 date:2026-11-23 footer:写于博客上线当天 %}
<!-- section 第一步 -->
购买 VPS,完成 SSH 基础加固。
<!-- section 第二步 -->
安装 Nginx,部署 Hexo 生成的静态文件。
<!-- paragraph -->
一切从这里开始。
<!-- line right -->
—— 完
{% endpaper %}
建站笔记
第一步

购买 VPS,完成 SSH 基础加固。

第二步

安装 Nginx,部署 Hexo 生成的静态文件。

一切从这里开始。

—— 完

17. 盒子 box

1
2
3
4
5
6
7
8
{% box 默认盒子 %}
盒子里可以放任意 Markdown 内容。
{% endbox %}

{% box color:blue 蓝色盒子 %}
- 列表
- **粗体**
{% endbox %}

默认盒子

盒子里可以放任意 Markdown 内容。

蓝色盒子

  • 列表
  • 粗体

18. 折叠块 folding

1
2
3
4
5
6
7
{% folding 点击展开 %}
默认折叠的内容。
{% endfolding %}

{% folding color:green open:true 默认展开 %}
设置 `open:true` 后默认展开。
{% endfolding %}

点击展开

默认折叠的内容。

默认展开

设置 open:true 后默认展开。

19. 折叠组 folders

1
2
3
4
5
6
{% folders %}
<!-- folder 什么是 Hexo? -->
一个基于 Node.js 的静态博客框架。
<!-- folder 什么是 Stellar? -->
一个功能丰富的 Hexo 主题。
{% endfolders %}

什么是 Hexo?

一个基于 Node.js 的静态博客框架。

什么是 Stellar?

一个功能丰富的 Hexo 主题。

20. 标签页 tabs

1
2
3
4
5
6
7
8
{% tabs active:2 %}
<!-- tab Windows -->
在 PowerShell 里运行 `.\deploy.ps1`。
<!-- tab Linux -->
在终端里运行 `./deploy.sh`。
<!-- tab macOS -->
同 Linux。
{% endtabs %}

在 PowerShell 里运行 .\deploy.ps1。

在终端里运行 ./deploy.sh。

同 Linux。

21. 网格布局 grid

1
2
3
4
5
6
{% grid c:2 bg:box %}
<!-- cell -->
**左栏**:网格可以把内容分成多列。
<!-- cell -->
**右栏**:窄屏时会自动变成单列。
{% endgrid %}

左栏:网格可以把内容分成多列。

右栏:窄屏时会自动变成单列。

22. 时间线 timeline

1
2
3
4
5
6
{% timeline %}
<!-- node 2026-11-22 -->
完成 VPS 基础加固,安装 Nginx。
<!-- node 2026-11-23 -->
切换到 Hexo + Stellar,博客上线。
{% endtimeline %}
2026-11-22

完成 VPS 基础加固,安装 Nginx。

2026-11-23

切换到 Hexo + Stellar,博客上线。

23. 表格增强 table

列很多时,用 style:scroll 让表格横向滚动,style:wrap 自动换行,style:compact 紧凑显示:

1
2
3
4
5
6
7
{% table style:compact %}
| 命令 | 作用 |
| --- | --- |
| `hexo new` | 新建文章 |
| `hexo server` | 本地预览 |
| `hexo generate` | 生成网站 |
{% endtable %}
命令 作用
hexo new 新建文章
hexo server 本地预览
hexo generate 生成网站

24. 图片 image

1
{% image /images/demo/photo-2.svg 点击可以放大查看 width:480px %}
点击可以放大查看
点击可以放大查看
1
2
3
4
5
6
{% gallery %}
![第一张](/images/demo/photo-1.svg)
![第二张](/images/demo/photo-2.svg)
![第三张](/images/demo/photo-3.svg)
![第四张](/images/demo/photo-4.svg)
{% endgallery %}

26. 轮播 swiper

1
2
3
4
5
{% swiper effect:cards %}
![](/images/demo/photo-1.svg)
![](/images/demo/photo-2.svg)
![](/images/demo/photo-3.svg)
{% endswiper %}

27. 设备框 frame

1
{% frame iphone11 img:/images/demo/phone.svg 手机截图 %}
手机截图
手机截图

28. 横幅 banner 与导航栏 navbar

1
2
3
4
5
{% banner 我的博客 记录建站与学习 bg:/images/demo/banner.svg %}
{% navbar [首页](/) [归档](/archives/) %}
{% endbanner %}

{% navbar active:/ [首页](/) [归档](/archives/) [分类](/categories/) %}

29. 下拉菜单 dropdown

1
2
3
4
{% dropdown 常用链接 %}
- [Hexo 文档](https://hexo.io/zh-cn/docs/)
- [Stellar 文档](https://xaoxuu.com/wiki/stellar/)
{% enddropdown %}

30. 目标进度 okr

每个目标(O)和关键结果(KR)的第一行是标题,后面是备注:

1
2
3
4
5
6
7
8
9
10
{% okr o1 percent:60 status:in_track %}
搭建个人博客
从零开始,把博客部署到自己的 VPS 上。
<!-- okr kr1 percent:100 status:finished -->
博客上线
已经可以通过 IP 访问。
<!-- okr kr2 percent:20 status:at_risk -->
配置域名和 HTTPS
443 端口被代理占用,需要先解决冲突。
{% endokr %}
O1
搭建个人博客

从零开始,把博客部署到自己的 VPS 上。

正常 60%
KR1
博客上线

已经可以通过 IP 访问。

已完成 100%
KR2
配置域名和 HTTPS

443 端口被代理占用,需要先解决冲突。

风险 20%

31. 人格卡片 mbti

1
{% mbti INTJ-T 93-72-78-83-51 %}
我的 MBTI 人格:INTJ-T(架构师)
外向93% 内向
天马行空 72%求真务实
理性思考 78%情感细腻
运筹帷幄 83%随机应变
自信果断51% 情绪易波动

五个数字依次是精力、心智、天性、策略、身份五个维度的百分比。

32. 聊天记录 chat

先用 YAML 定义参与者,再逐条写消息:

1
2
3
4
5
6
7
8
9
10
11
12
{% chat iphone11 style:wechat title:建站交流群 me:me %}
me:
name: 我
avatar: /images/demo/avatar-me.svg
friend:
name: 朋友
avatar: /images/demo/avatar-friend.svg
<!-- chattip 2026年11月23日 20:00 -->
<!-- chatcell user:friend md:博客搭好了吗? -->
<!-- chatcell user:me md:搭好了,用的 Hexo + Stellar -->
<!-- chatcell user:friend md:看起来不错! -->
{% endchat %}
14:36
3
建站交流群
2026年11月23日 20:00
朋友

博客搭好了吗?

我

搭好了,用的 Hexo + Stellar

朋友

看起来不错!

33. 音频 audio 与视频 video

1
2
{% audio https://interactive-examples.mdn.mozilla.net/media/cc0-audio/t-rex-roar.mp3 %}
{% video https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4 %}

视频也支持 B 站和 YouTube,写成 {% video bilibili:BV号 %} 或 {% video youtube:视频ID %}。

34. GitHub 卡片 ghcard

1
{% ghcard xaoxuu/hexo-theme-stellar %}

35. 友链 friends 与网站卡片 sites

链接数据写在 source/_data/links.yml 里,每个顶层键是一个分组:

1
2
3
4
5
6
demo:
- title: Hexo
url: https://hexo.io/
avatar: /images/demo/avatar-me.svg
description: 快速、简洁且高效的博客框架
cover: /images/demo/photo-1.svg
1
2
{% friends demo %}
{% sites demo %}

36. 需要额外配置的标签

下面这些标签需要外部服务或额外数据,这篇文章里没有演示:

标签 用途 需要什么
{% rating %} 评分 自行部署 star-vote 服务,并在主题配置 services.rating 中填写地址
{% vote %} 投票 同上,配置 services.vote
{% gist %} 嵌入 GitHub Gist 一个 Gist 的 ID
{% md %} 嵌入远程 Markdown 文件 文件的 URL
{% toc %} 文档目录 Wiki 项目
{% albums %}、{% posters %} 相册、海报墙 links.yml 里的图片数据或远程数据源

结语

这些就是写文章时最常用的语法。标签插件的完整参数可以查阅 Stellar 文档,也可以直接看主题源码里 scripts/tags/lib/ 下每个文件开头的注释。

站内搜索

没有找到内容!