Typora设置标题自动添加序号

  1. 打开文件 -->偏好设置 -->打开主题文件夹


    1595170924365.png
  2. 创建github.user.css文件,添加以下css内容
body {
    counter-reset: body;
}

h1 {
    counter-reset: h1;
}

h2 {
    counter-reset: h2;
}
h3 {
    counter-reset: h3;
}
h4 {
    counter-reset: h4;
}
h5 {
    counter-reset: h5;
}
h6 {
    counter-reset: h6;
}



h1:before {
    counter-increment: body;
    content: counter(body) ". ";
}

h2:before {
    counter-increment: h1;
    content: counter(body) "." counter(h1) " ";
}

h3:before {
    counter-increment: h2;
    content: counter(body) "." counter(h1)"." counter(h2) " ";
}
h4:before {
    counter-increment: h3;
    content: counter(body) "." counter(h1)"." counter(h2)"." counter(h3) " ";
}
h5:before {
    counter-increment: h4;
    content: counter(body) "." counter(h1)"." counter(h2)"." counter(h3)"." counter(h4) " ";
}
h6:before {
    counter-increment: h5;
    content: counter(body) "." counter(h1)"." counter(h2)"." counter(h3)"." counter(h4)"." counter(h5) " ";
}
  1. 保存后重启Typora


    1595171136681.png
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。