linux.sb helpers —— 让帖子好看一点
感觉本站 UI 稍微有点用不习惯,遂写了个加强油猴脚本。
装好之后,本帖本身就是说明书:往下滚就能看到各种增强效果。配色跟站点主题走(站点自带的浅/深色);第一次装脚本若还没开过主题页,会先带你去主题切换看一眼。
悬停试试:@你自己、@别人 #楼层、本站主题链接、作者名 —— 会弹出资料卡 / 楼层预览。
Markdown 渲染
站点原生只是转义文本。装了脚本之后,GFM 会真的变成标题、引用、表格、任务列表。
表格
| 能力 | 效果 |
|---|---|
| 外链 | 裸 https://… 变蓝,带 favicon + 标题 |
| 图片 URL | 有 png/jpg/webp… 后缀的直接内联;无后缀也会试探 image/* |
| GitHub | 仓库 / Issue / PR / commit / 文件预览卡(含行范围) |
| 公式 / 图 / 代码 | 按需拉 KaTeX、mermaid、Shiki |
任务清单
- [x] 标题 / 引用 / 表格
- [x] 公式与 mermaid
- [x] GitHub 卡片
- [x] 跟站点主题
行内也能 加粗、斜体、行内代码,以及 本站随便链一下。
数学公式
行内:$E = mc^2$,以及 $\displaystyle \sum_{k=1}^{n} k = \frac{n(n+1)}{2}$。
块级:
$$
\int_{-\infty}^{\infty} e^{-x^{2}}\,dx = \sqrt{\pi}
$$
$$
\begin{pmatrix}
a & b \\
c & d
\end{pmatrix}
\begin{pmatrix}
x \\ y
\end{pmatrix}
=
\begin{pmatrix}
ax+by \\ cx+dy
\end{pmatrix}
$$
Mermaid
flowchart LR
A[帖文 Markdown] --> B[linkify]
B --> C{GitHub?}
C -->|是| D[仓库 / Issue / PR / commit / blob 卡]
C -->|否| E[外链标题 / 内联图]
B --> F[站内悬浮 tip]代码高亮
const hello = (name) => `你好,${name}`
console.log(hello('linux.sb'))# ps12exe:一行把脚本编成 exe
'"Hello World!"' | ps12exe图片内联
裸图片 URL 会直接显示,不用包 ![]():
https://repository-images.githubusercontent.com/729678966/3ed3f02f-c7c9-4a18-b1f5-255e667643b6
https://repository-images.githubusercontent.com/862251163/0ac90205-ae40-4fc6-af67-1e28d074c76b
GitHub 卡片预览
仓库:
https://github.com/steve02081504/ps12exe
Issue:
https://github.com/denoland/deno/issues/36408
PR:
https://github.com/steve02081504/fount/pull/282
commit(标题、作者、± 行):
https://github.com/steve02081504/ps12exe/commit/cf37e7eccb62cd9389590e0956d1f600d633d5d9
文件预览(带行范围 #L1-L25,Shiki 高亮):
https://github.com/steve02081504/ps12exe/blob/master/ps12exe.ps1#L1-L25
外链增强
普通网站也会链化并尽量拉标题(失败就安静回退成普通蓝链):
其它小习惯
- 回复框里 Ctrl+Enter(Mac:Cmd+Enter)直接提交,不用去找按钮
- 主页侧栏:未签到时会自动点一次签到
- 虚拟卡购买记录:≥2 条默认折叠
有想加的效果或踩到的坑,回帖甩链接 / 截图就行。