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

你可能感兴趣的:(Typora设置标题自动添加序号)