[功能建议] 可不可以加入标题自动编号的功能?

本贴最后更新于 865 天前,其中的信息可能已经时异事殊

比如输入标题时可以自动编号 1 1.1 1.2 1.3 这种?可选第一级标题不自动编号,从二级标题可以自动编号

1 第一章

1.1 基础概念

1.2 公式定理

1.2.1 公式 1

  • 思源笔记

    思源笔记是一款隐私优先的个人知识管理系统,支持完全离线使用,同时也支持端到端加密同步。

    融合块、大纲和双向链接,重构你的思维。

    18611 引用 • 69255 回帖

相关帖子

欢迎来到这里!

我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。

注册 关于
请输入回帖内容 ...
  • 88250 1

    暂时不会加入,请关注 Issue #522 · siyuan-note/siyuan 如果有计划加入该特性的话会重开这个 issue,感谢反馈。

  • 在主题中加入如下样式即可实现自动编号(导出为 HTML/PDF 时也能保留)

    PS: 可以更改 font-size 字段调整编号的大小

    body {
        counter-reset: h1-count 0;
    }
    
    h1,
    .h1 {
        counter-reset: h2-count 0;
    }
    
    h2,
    .h2 {
        counter-reset: h3-count 0;
    }
    
    h3,
    .h3 {
        counter-reset: h4-count 0;
    }
    
    h4,
    .h4 {
        counter-reset: h5-count 0;
    }
    
    h5,
    .h5 {
        counter-reset: h6-count 0;
    }
    
    .protyle-wysiwyg [data-node-id].h1:before,
    .b3-typography h1:before {
        display: block;
        float: left;
        font-size: 50%;
        counter-increment: h1-count;
        content: counter(h1-count) "\00A0";
    }
    
    .protyle-wysiwyg [data-node-id].h2:before,
    .b3-typography h2:before {
        display: block;
        float: left;
        font-size: 50%;
        counter-increment: h2-count;
        content: counter(h1-count) "."counter(h2-count) "\00A0";
    }
    
    .protyle-wysiwyg [data-node-id].h3:before,
    .b3-typography h3:before {
        display: block;
        float: left;
        font-size: 50%;
        counter-increment: h3-count;
        content: counter(h1-count) "."counter(h2-count) "."counter(h3-count) "\00A0";
    }
    
    .protyle-wysiwyg [data-node-id].h4:before,
    .b3-typography h4:before {
        display: block;
        float: left;
        font-size: 50%;
        counter-increment: h4-count;
        content: counter(h1-count) "."counter(h2-count) "."counter(h3-count) "."counter(h4-count) "\00A0";
    }
    
    .protyle-wysiwyg [data-node-id].h5:before,
    .b3-typography h5:before {
        display: block;
        float: left;
        font-size: 50%;
        counter-increment: h5-count;
        content: counter(h1-count) "."counter(h2-count) "."counter(h3-count) "."counter(h4-count) "."counter(h5-count) "\00A0";
    }
    
    .protyle-wysiwyg [data-node-id].h6:before,
    .b3-typography h6:before {
        display: block;
        float: left;
        font-size: 50%;
        counter-increment: h6-count;
        content: counter(h1-count) "."counter(h2-count) "."counter(h3-count) "."counter(h4-count) "."counter(h5-count) "."counter(h6-count) "\00A0";
    }
    
    1 回复
  • 试了一下,不知道能否优化一下,如果为 0 就不显示。

    因为一般 H1 没用到,现在 H2 就变成 0.1 开始算

    1 回复
  • 可以自定义一下 content 属性中显示的内容

    counter(h1-count) 就是一级标题的编号, 以此类推, 若不需要删除即可

    1 回复
  • 就是想动态,比如没有 H1,就自动删除,可以吗?

    1 回复
请输入回帖内容 ...