由于shoka姐姐站点出现loadding死循环,特此备份shoka配置指南
# 基本配置
# xxxxxxxxxx // hexo-safago Waline评论区链接处理 - 内联脚本script. (function() { // 从配置中读取白名单 var whitelist = !{JSON.stringify(config.hexo_safego.whitelist.domain_whitelist)}; function isInWhitelist(url) { return whitelist.some(function(domain) { return url.indexOf(domain) !== -1; }); } function convertLink(link) { var href = link.getAttribute('href'); if (!href || href.startsWith('/') || href.startsWith('mailto:') || href.startsWith('tel:')) { return; } // 检查白名单 if (isInWhitelist(href)) { return; } if (link.dataset.safagoProcessed) { return; } try { var encodedUrl = btoa(href); var newHref = '/go.html?u=' + encodedUrl; link.setAttribute('href', newHref); link.setAttribute('target', '_blank'); link.dataset.safagoProcessed = 'true'; } catch(e) { console.error('[safago-inline] Error:', e); } } function processWalineLinks() { var links = document.querySelectorAll('.wl-nick a[href], .wl-card a[href]'); links.forEach(convertLink); } // 初始处理 if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', processWalineLinks); } else { processWalineLinks(); } // 延迟处理(备用) setTimeout(processWalineLinks, 2000); // 事件委托:在链接被点击时进行转换(最重要) document.addEventListener('click', function(e) { var link = e.target.closest('a[href]'); if (link && (link.classList.contains('wl-nick') || link.closest('.wl-card'))) { convertLink(link); } }, true); // PJAX支持 document.addEventListener('pjax:complete', processWalineLinks); })();pug
# 特殊功能
# links 链接块
本功能参考 NexT,基于 Hexo Tag 功能,用来建立友链或其他网址链接功能。
文章中的使用格式:
- 使用
links标签块,包围yml语法书写的内容,字段包括
site |
站点名称 | 必填 |
|---|---|---|
owner |
管理员名字 | 可选,默认为 site 的值 |
url |
站点链接 | 必填 |
desc |
cateCards: - slug: Study cover: Study/cover.jpg - slug: Life cover: Life/cover.jpgyml | 可选,默认为 url 的值 |
image |
站点图片 | 可选,默认为 images/404.png |
color |
方块颜色 | 可选,默认为 #666 |
{% links %}
- site: #站点名称
owner: #管理员名字
url: #站点网址
desc: #简短描述
image: #一张图片
color: #颜色代码
{% endlinks %}
举个栗子:
{% links %}
- site: 个人首页
owner: RPWN
desc: SHARED BY Vullfin
url: https://nav.vull.top/
image: assets/nav.png
color: "#7ab8ba"
- site: 赞赏主页
owner: RPWN
url: https://sponsor.vull.top/
desc: SHARED BY Vullfin
image: assets/milk.png
color: "#e9bcc1"
- site: 吃啥好呢?
owner: RPWN
url: https://eat.vull.top/
desc: SHARED BY Vullfin
image: assets/eat.png
color: "#FA8072"
- site: 个人主页
owner: RPWN
url: https://vull.top/
desc: SHARED BY Vullfin
image: assets/home.png
color: "#6097b3"
{% endlinks %}
效果:
- 以上标签块里的内容,还可以保存到一个
yml文件中,然后使用linksfile标签。
其中,path位于<root>/source目录下。
{% linksfile [path] %}
举个栗子:
{% linksfile friends/_data.yml %}
# code 代码块
使用 markdown-it-prism 进行代码高亮,支持显示行号、行高亮 mark 、命令行提示符 command 、代码块标题。
基本格式: [language] [title] [url] [link text] [mark] [command]
| 选项 | 描述 | 默认值 |
|---|---|---|
| language | 支持的语言戳此如果不需要代码高亮,但希望显示代码块样式,则设为 raw留空或设为 info ,将不显示代码高亮和代码块样式 |
null |
| title | 代码块的标题文字 | null |
| url | 代码块标题右侧显示的链接 | null |
| link text | 上述链接显示的标题 | link |
| mark | 行高亮显示,格式为 mark:行号,行号开始-行号结束,其他行号 。 例如 mark:1,4-7,10 ,将高亮显示第 1、4、5、6、7、10 行 |
null |
| command | 命令行提示符,格式为 command:("提示内容":行号,行号||"提示内容":行号开始-行号结束) 例如 command:("[root@localhost] $":1,9-10||"[admin@remotehost] #":4-6) |
```java 行高亮 https://shoka.lostyu.me 参考链接 mark:1,6-7
import java.util.Scanner;
...
Scanner in = new Scanner (System.in);
// 输入 Scan 之后,按下键盘 Alt + “/” 键,Eclipse 下自动补全。
System.out.println (in.nextLine ());
System.out.println ("Hello" + "world.");
```
```bash 命令行提示符 command:("[root@localhost] $":1,9-10||"[admin@remotehost] #":4-6)
pwd
/usr/home/chris/bin
ls -la
total 2
drwxr-xr-x 2 chris chris 11 Jan 10 16:48 .
drwxr--r-x 45 chris chris 92 Feb 14 11:10 ..
-rwxr-xr-x 1 chris chris 444 Aug 25 2013 backup
-rwxr-xr-x 1 chris chris 642 Jan 17 14:42 deploy
git add -A
git commit -m "update"
git push
```
import java.util.Scanner;
...
Scanner in = new Scanner (System.in);
// 输入 Scan 之后,按下键盘 Alt + “/” 键,Eclipse 下自动补全。
System.out.println (in.nextLine ());
System.out.println ("Hello" + "world.");
pwd
/usr/home/chris/bin
ls -la
total 2
drwxr-xr-x 2 chris chris 11 Jan 10 16:48 .
drwxr--r-x 45 chris chris 92 Feb 14 11:10 ..
-rwxr-xr-x 1 chris chris 444 Aug 25 2013 backup
-rwxr-xr-x 1 chris chris 642 Jan 17 14:42 deploy
git add -A
git commit -m "update"
git push
# quiz 练习题与答案
这个功能是用来显示练习题的。
需要在 Front Matter 中添加 quiz: true ,以正确显示题型标签。
---
title: 练习题与答案
quiz: true
---
1. 编译时多态主要指运算符重载与函数重载,而运行时多态主要指虚函数。 {.quiz .true}
2. 有基类 `SHAPE`,派生类 `CIRCLE`,声明如下变量: {.quiz .multi}
```cpp
SHAPE shape1,*p1;
CIRCLE circle1,*q1;
下列哪些项是 “派生类对象替换基类对象”。
- `p1=&circle1;` {.correct}
- `q1=&shape1;`
- `shape1=circle1;` {.correct}
- `circle1=shape1;`
---
title: 练习题与答案
quiz: true
---
1. 编译时多态主要指运算符重载与函数重载,而运行时多态主要指虚函数。 {.quiz .true}
2. 有基类 `SHAPE`,派生类 `CIRCLE`,声明如下变量: {.quiz .multi}
```cpp
SHAPE shape1,*p1;
CIRCLE circle1,*q1;
下列哪些项是 “派生类对象替换基类对象”。
- `p1=&circle1;` {.correct}
- `q1=&shape1;`
- `shape1=circle1;` {.correct}
- `circle1=shape1;`
行内公式:
块级公式:
:::encrypted{password="test"}
这里是加密的内容,支持完整的 Markdown 语法:
- 粗体、斜体、
删除线 行内代码- 链接
console.log('加密内容中的代码也有语法高亮!');
行内公式 也可以正常渲染。
:::
:::encrypted{password="another"}
每个加密块可以设置独立的密码。
:::
:::default
默认默认
:::
:::primary
基本基本
:::
:::info
提示提示
:::
:::success
成功成功
:::
:::warning
警告警告
:::
:::danger
危险危险
:::
:::danger no-icon
危险危险
:::