您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
为Notion标题自动添加序号
当前为
Notion优化(持续更新中)
📅 2025-08-09 有效
通过注入 CSS 代码实现标题和目录自动编号,采用纯前端渲染方式,不改变页面本质内容。
URL pattern: https://www.notion.so/*
CSS 代码:
/* 正文标题编号 */
body {
counter-set: headings1 headings2 headings3;
}
/* 重置计数器 */
.notranslate[placeholder="Heading 1"] {
counter-set: headings2;
}
.notranslate[placeholder="Heading 2"] {
counter-set: headings3;
}
/* 添加编号前缀 */
.notranslate[placeholder="Heading 1"]::before {
counter-increment: headings1;
content: counter(headings1) " ";
}
.notranslate[placeholder="Heading 2"]::before {
counter-increment: headings2;
content: counter(headings1) "." counter(headings2) " ";
}
.notranslate[placeholder="Heading 3"]::before {
counter-increment: headings3;
content: counter(headings1) "." counter(headings2) "." counter(headings3) " ";
}
/* 目录编号 */
.table_of_contents {
counter-set: toc-h1 toc-h2 toc-h3;
}
/* 目录中的h1重置下级计数器 */
.table_of_contents .nb-h1 {
counter-set: toc-h2;
}
.table_of_contents .nb-h2 {
counter-set: toc-h3;
}
/* 目录编号前缀 */
.table_of_contents .nb-h1 .text::before {
counter-increment: toc-h1;
content: counter(toc-h1) " ";
}
.table_of_contents .nb-h2 .text::before {
counter-increment: toc-h2;
content: counter(toc-h1) "." counter(toc-h2) " ";
}
.table_of_contents .nb-h3 .text::before {
counter-increment: toc-h3;
content: counter(toc-h1) "." counter(toc-h2) "." counter(toc-h3) " ";
}
/* 可选:为目录添加一些样式美化 */
.table_of_contents .nb-h1 .text {
font-weight: bold;
}
.table_of_contents .nb-h2 .text {
padding-left: 1em;
}
.table_of_contents .nb-h3 .text {
padding-left: 2em;
}
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址