obsidian外观
Obsidian 样式 - 核心大纲 outline 标题显示自动编号
插件ID:obsidian%E6%A0%B7%E5%BC%8F-%E6%A0%B8%E5%BF%83%E5%A4%A7%E7%BA%B2outline%E6%A0%87%E9%A2%98%E6%98%BE%E7%A4%BA%E8%87%AA%E5%8A%A8%E7%BC%96%E5%8F%B7
obsidian%E6%A0%B7%E5%BC%8F-%E6%A0%B8%E5%BF%83%E5%A4%A7%E7%BA%B2outline%E6%A0%87%E9%A2%98%E6%98%BE%E7%A4%BA%E8%87%AA%E5%8A%A8%E7%BC%96%E5%8F%B7
obsidian%E6%A0%B7%E5%BC%8F %E6%A0%B8%E5%BF%83%E5%A4%A7%E7%BA%B2outline%E6%A0%87%E9%A2%98%E6%98%BE%E7%A4%BA%E8%87%AA%E5%8A%A8%E7%BC%96%E5%8F%B7: Outline 进行优化的CSS,自动对标题进行编号
Obsidian 样式 - 核心大纲 outline 标题显示自动编号
对 Obsidian 的核心插件 Outline 进行优化,自动对标题进行编号。请注意,该编号不会实际修改文档中的标题编号。
样式一:从一级标题开始计数
/* https://github.com/platon-ivanov/obsidian-visually-numbered-headings/issues/16 */
.workspace-leaf-content[data-type="outline"] {
counter-reset: rootCounter;
.tree-item .tree-item-self .tree-item-inner::before {
content: counters(rootCounter, ".") ". ";
counter-increment: rootCounter;
}
/* container of the ohter headings. */
/* NOTE: It is not .outline anymore. So we need a new counter */
.tree-item-children {
counter-reset: innerCounter;
}
.tree-item-children .tree-item .tree-item-self .tree-item-inner::before {
content: counters(rootCounter, ".") "."counters(innerCounter, ".") ". ";
counter-increment: innerCounter;
}
}
样式二:从二级标题开始计数
/*! Visually Numbered Headings */
/* https://github.com/platon-ivanov/obsidian-visually-numbered-headings/issues/16 */
/* container of first layer headings. */
.workspace-leaf-content[data-type="outline"] {
counter-reset: rootCounter;
tree-item .tree-item-self .tree-item-inner::before {
/* content: counters(rootCounter, ".") " "; */
counter-increment: rootCounter;
}
/* container of the ohter headings. */
/* NOTE: It is not .outline anymore. So we need a new counter */
.tree-item-children {
counter-reset: innerCounter 0;
}
.tree-item-children .tree-item .tree-item-self .tree-item-inner::before {
/* content: counters(rootCounter, ".") "." counters(innerCounter, ".") " "; */
content: counters(innerCounter, ".") " ";
counter-increment: innerCounter;
}
}
拓展样式:文件大纲显示编号
/* https://github.com/platon-ivanov/obsidian-visually-numbered-headings/issues/16 */
.workspace-leaf-content[data-type="file-explorer"] {
counter-reset: rootCounter;
.tree-item .tree-item-self .tree-item-inner::before {
content: counters(rootCounter, ".") ". ";
counter-increment: rootCounter;
}
/* container of the ohter headings. */
/* NOTE: It is not .outline anymore. So we need a new counter */
.tree-item-children {
counter-reset: innerCounter;
}
.tree-item-children .tree-item .tree-item-self .tree-item-inner::before {
content: counters(rootCounter, ".") "."counters(innerCounter, ".") ". ";
counter-increment: innerCounter;
}
}
讨论
若阁下有独到的见解或新颖的想法,诚邀您在文章下方留言,与大家共同探讨。
反馈交流
其他渠道
版权声明
版权声明:所有 PKMer 文章如果需要转载,请附上原文出处链接。