容器类标签(9个) ablock 普通块容器 note 标签就是使用 ablock 容器实现的,它们样式是相同的:
更名记录(Stellar 1.18.0) 因为原 noteblock 标签在升级到 hexo 6.0 之后跟官方库冲突了,官方一直没有解释原因,后不得不改名: noteblock -> grid -> border -> ablock 详情见:#172
语法格式 1 2 3 {% ablock [title] [color:color] [child:codeblock/tabs] %} ... {% endablock %}
写法如下 1 2 3 4 5 {% ablock Stellar v1.12.0 color:warning %} 因为原 noteblock 标签在升级到 hexo 6.0 之后跟官方库冲突了,官方一直没有解释原因,后不得不改名: noteblock -> grid -> border 详情见:[#172 ](https://github.com/volantis-x/hexo-theme-volantis/issues/712 ) {% endablock %}
彩色代码块 设置 child:codeblock 并设置 color:颜色枚举 可以实现 10 种不同颜色的代码块,彩色代码块一般可以用在代码正确与错误的示范对比场景。
嵌套其它标签 例如嵌套一个 tabs 标签:
公司一般都会强制安装安防软件,这些软件要求开机自启动,要求有屏幕录制权限、完全的磁盘访问权限包括相册图库。因此如果使用自己的 MacBook 作为办公设备,必须要把生活区和工作区完全独立开,安装在两个磁盘分区,并且对磁盘分区进行加密。
folding 折叠容器 折叠块标签的语法格式为:
1 2 3 {% folding title [codeblock:bool] [open:bool] [color:color] %} content {% endfolding %}
参数说明 1 2 3 codeblock: true /false open: true /false color: red/orange/yellow/green/cyan/blue/purple/light/dark
彩色可折叠代码块 备注标签相较于旧版进行了增强,可以实现更多种颜色,还可以通过设置 child:codeblock 来实现可折叠的代码块。以下是一个默认打开的代码折叠框:
默认打开的代码折叠框 1 2 3 func test () { print ("hello world" ) }
代码如下:
1 2 3 {% folding child:codeblock open:true color:yellow 默认打开的代码折叠框 %} 代码块 {% endfolding %}
危险,请不要打开这个 通过设置颜色,以实现更醒目的作用,但不要滥用色彩哦~
警告,真的很危险 通过设置颜色,以实现更醒目的作用,但不要滥用色彩哦~
最后一次警告,千万不要打开这个 不要说我们没有警告过你,Windows 10 不是為所有人設計,而是為每個人設計。
folders 多个折叠容器聚合 样式相比 folding 简单一些,适用于多个折叠标签平铺显示的场景,例如题目列表:
代码如下:
1 2 3 4 5 6 7 8 {% folders %} <!-- folder 题目1 --> 这是答案1 <!-- folder 题目2 --> 这是答案2 <!-- folder 题目3 --> 这是答案3 {% endfolders %}
tabs 分栏容器 这个标签移植自 NexT 主题,但做了以下修改:
支持设置 align:center 来使内容居中 设置默认激活的标签方式为 active:1 而非 , 1(使用默认格式降低学习成本,且显式声明可读性更强) 不需要 <!-- endtab --> 来作为结束标识(因为 Stellar 会自动判断) 不需要 tabs id 来保证唯一性(因为 Stellar 会设置唯一标识) 不支持 @icon 方式设置图标(因为 Stellar 不再内置 fontawesome 图标库) 轮廓样式简化,可以搭配其它容器类标签嵌套使用。 1 2 let x = 123 print ("hello world" )
gallery 图库容器 这个功能在 1.21.0 版本后开始支持,其内部只能填写 md 格式的图片。
@tianhao_wang
@eberhard
@eberhard
@eberhard
@eberhard
@vklemen
写法如下 1 2 3 4 5 6 7 8 {% gallery %}       {% endgallery %}
banner 横幅容器 这个功能在 1.21.0 版本后开始支持,将会取代 about 组件,请尽快完成迁移。
用于独立页面顶部 写法如下 1 2 3 {% banner 随记 bg:https://xaoxuu.com/assets/banner/notes.jpg %} {% navbar active:/notes/ [随记](/notes/) [收藏](/bookmark/) %} {% endbanner %}
用于用户个人资料页 写法如下 1 2 {% banner 某某 这是个人简介 avatar:https://xaoxuu.com/assets/xaoxuu/avatar/rect-256@2x.png bg:https://xaoxuu.com/assets/banner/nebula.jpg %} {% endbanner %}
用作文章摘要卡片 设置 link 可以让整个卡片响应点击事件,实现点击跳转到对应文章:
博客进阶:自动化部署
本文讲了如何利用脚本和 GitHub Actions 简化博客搭建和部署流程,提高效率。
写法如下 1 2 {% banner 博客进阶:自动化部署 本文讲了如何利用脚本和 GitHub Actions 简化博客搭建和部署流程,提高效率。 bg:https://xaoxuu.com/assets/xaoxuu/blog/2022-1126a@2x.jpg link:/blog/20221126/ %} {% endbanner %}
grid 网格分区容器 这个功能在 1.12.0 版本后开始支持,目前只支持显示一行两列,且手机端因宽度较窄会恢复为单列显示。
Unsplash Photo
The Galactic Center is the rotational center of the Milky Way galaxy. Its central massive object is a supermassive black hole of about 4 million solar masses, which is called Sagittarius A*. Its mass is equal to four million suns. The center is located 25,800 light years away from Earth.
Ōwhiro Bay, Wellington, New Zealand Published on May 31, 2022 SONY, ILCE-6000 Free to use under the Unsplash License
普通块样式:
卡片样式:
示例代码:
1 2 3 4 5 6 {% grid bg:block %} <!-- cell left --> <center>左侧内容</center> <!-- cell right --> <center>右侧内容</center> {% endgrid %}
bg 为可选参数,默认没有背景,可设置为 block/card 两种样式
about 关于块容器 方便在关于页面显示一段图文信息,比普通块容器稍微有一点点不一样:
1 2 3 4 5 6 7 8 9 10 11 {% about avatar:/assets/xaoxuu/avatar/rect-256@2x.png height:80px %} <img height="32px" alt="XAOXUU" src="/assets/xaoxuu/logo/180x30@2x.png"> **如果宇宙中真有什么终极的逻辑,那就是我们终有一天会在舰桥上重逢,直到生命终结。** XAOXUU 目前是一个 iOS 开发者,代表作品有:ProHUD、ValueX 等。在业余时间也开发了 Stellar 博客主题,更多的作品可以去项目主页查看,希望大家喜欢~ {% navbar [文章](/) [项目](/wiki/) [留言](#comments) [GitHub](https://github.com/xaoxuu/) %} {% endabout %}
swiper 轮播容器 默认一张图片是 50% 宽度,通过设置 width:min 设置为 25% 宽度,width:max 设置为 100% 宽度。
写法如下 1 2 3 4 5 6 {% swiper effect:cards %}     {% endswiper %}
写法如下 1 2 3 {% swiper width:min/max %} ... {% endswiper %}
1 2 3 {% swiper effect:cards/coverflow %} ... {% endswiper %}
注意
一个页面只能设置一次,第一个 swiper 容器的效果全局生效。
曲终