求助各位大佬们,我用 Kimi 帮我写了一下 CSS 的代码,用来帮我自动调格式。但是加上“自动编号”的代码后编号和标题内容就总是不在一行内。Kimi 调了好几回都解决不了,代码白痴来论坛求助了。目前的效果如下:
我使用的代码如下,请各位大佬帮忙看下能怎么修正,谢谢!
/* ===== 思源笔记 custom.css · 英文统一 Times New Roman ===== */
/* 0. 全局先锁死英文,再写中文 */
.protyle-wysiwyg,
.protyle-wysiwyg [data-node-id] {
/* Times 放最前,保证英文最先命中 */
font-family: "Times New Roman", "方正仿宋_GBK", "FZFangSong-Z02", "Noto Serif CJK SC", serif !important;
font-size: 16pt !important;
line-height: 1.6;
/* 关闭中文字体对 ASCII 的覆盖 */
font-variant-east-asian: normal;
}
/* 1. 一级标题 */
.protyle-wysiwyg [data-subtype="h1"],
.b3-typography h1 {
font-family: "Times New Roman", "方正黑体_GBK", "FZZhengHei-B01", "Noto Sans CJK SC", serif !important;
font-size: 16pt !important;
font-weight: normal !important;
}
/* 2. 二级标题 */
.protyle-wysiwyg [data-subtype="h2"],
.b3-typography h2 {
font-family: "Times New Roman", "方正楷体_GBK", "FZKai-Z03", "Noto Serif CJK SC", serif !important;
font-size: 16pt !important;
font-weight: bold !important;
}
/* 3. 三级标题 */
.protyle-wysiwyg [data-subtype="h3"],
.b3-typography h3 {
font-family: "Times New Roman", "方正仿宋_GBK", "FZFangSong-Z02", "Noto Serif CJK SC", serif !important;
font-size: 16pt !important;
font-weight: bold !important;
}
/* 4. 四级及以上 */
.protyle-wysiwyg [data-subtype="h4"],
.protyle-wysiwyg [data-subtype="h5"],
.protyle-wysiwyg [data-subtype="h6"],
.b3-typography h4,
.b3-typography h5,
.b3-typography h6 {
font-family: "Times New Roman", "方正仿宋_GBK", "FZFangSong-Z02", "Noto Serif CJK SC", serif !important;
font-size: 16pt !important;
font-weight: normal !important;
}
/* 5. 保险:强制所有 ASCII 码点用 Times 渲染 */
@font-face {
font-family: "Times Override";
src: local("Times New Roman");
unicode-range: U+0000-007F; /* 基本拉丁 */
}
.protyle-wysiwyg,
.b3-typography {
font-family: "Times Override", "Times New Roman", serif;
}
/* ===== 追加:文档标题 & 正文首行缩进 ===== */
/* 1. 文档标题(富文本顶部那个 NodeTitle) */
.protyle-title__input,
.b3-typography h1[data-type="NodeTitle"] {
/* Times 放最前,保证英文最先命中;中文随后 */
font-family: "Times New Roman",
"方正小标宋_GBK", "FZXiaoBiaoSong-B05",
"Noto Serif CJK SC", "Source Han Serif SC", serif !important;
font-size: 22pt !important; /* 二号字 */
font-weight: normal !important; /* 不加粗 */
text-align: center; /* 可选:居中 */
}
/* 1. 非列表内的段落才缩进 */
.protyle-wysiwyg [data-type="NodeParagraph"]:not([data-type="NodeListItem"] [data-type="NodeParagraph"]) {
text-indent: 2em;
margin-block: 0 0.5em;
}
/* ===== 增量:1-6 级标题首行缩进 2 字符 ===== */
.protyle-wysiwyg [data-type="NodeHeading"],
.b3-typography h1,
.b3-typography h2,
.b3-typography h3,
.b3-typography h4,
.b3-typography h5,
.b3-typography h6 {
text-indent: 2em; /* 首行缩进两个汉字宽 */
margin-block: 0em 0.5em; /* 段间距可自行调 */
}
/* 2. 列表项本身清零(保险) */
.protyle-wysiwyg [data-type="NodeListItem"] {
text-indent: 0 !important;
}
/* ===== 终极行内版:编号与文字绝对同一行 ===== */
/* 1. 计数器作用域 */
.protyle-wysiwyg { counter-reset: h1-counter; }
.protyle-wysiwyg [data-subtype="h1"] { counter-reset: h2-counter; }
.protyle-wysiwyg [data-subtype="h2"] { counter-reset: h3-counter; }
/* 2. 利用 first-line 伪元素把编号塞进文字行 */
.protyle-wysiwyg [data-subtype="h1"]::first-line,
.protyle-wysiwyg [data-subtype="h2"]::first-line,
.protyle-wysiwyg [data-subtype="h3"]::first-line {
/* 清掉思源给 first-line 的 block 特性 */
display: inline;
}
/* 3. 在 first-line 前插编号,并强制 inline */
.protyle-wysiwyg [data-subtype="h1"]::before {
counter-increment: h1-counter;
content: counter(h1-counter, cjk-ideographic) "、";
display: inline; /* 必须 */
}
.protyle-wysiwyg [data-subtype="h2"]::before {
counter-increment: h2-counter;
content: "(" counter(h2-counter, cjk-ideographic) ")";
display: inline;
}
.protyle-wysiwyg [data-subtype="h3"]::before {
counter-increment: h3-counter;
content: counter(h3-counter) "."; /* 全角点 */
display: inline;
}





