准备工作

打开Typora,然后依次点击:文件→偏好设置→外观→打开主题文件夹

在该文件夹中创建base.user.css文件,内容如下,保存后重启Typora即可看到效果

Type1:从一级标题开始的

/** initialize css counter */
#write,
.sidebar-content {counter-reset: h1;
}h1,
.outline-h1 {counter-reset: h2;
}h2,
.outline-h2 {counter-reset: h3;
}h3,
.outline-h3 {counter-reset: h4;
}h4,
.outline-h4 {counter-reset: h5;
}h5,
.outline-h5 {counter-reset: h6;
}/** put counter result into headings */
#write h1:before,
.outline-h1 > .outline-item > .outline-label:before {counter-increment: h1;content: counter(h1) " ";
}#write h2:before,
.outline-h2 > .outline-item > .outline-label:before {counter-increment: h2;content: counter(h1) "." counter(h2) " ";
}#write h3:before,
h3.md-focus.md-heading:before, /** override the default style for focused headings */
.outline-h3 > .outline-item > .outline-label:before {counter-increment: h3;content: counter(h1) "." counter(h2) "." counter(h3) " ";
}#write h4:before,
h4.md-focus.md-heading:before,
.outline-h4 > .outline-item > .outline-label:before {counter-increment: h4;content: counter(h1) "." counter(h2) "." counter(h3) "." counter(h4) " ";
}#write h5:before,
h5.md-focus.md-heading:before,
.outline-h5 > .outline-item > .outline-label:before {counter-increment: h5;content: counter(h1) "." counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) " ";
}#write h6:before,
h6.md-focus.md-heading:before,
.outline-h6 > .outline-item > .outline-label:before {counter-increment: h6;content: counter(h1) "." counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) "." counter(h6) " ";
}/** override the default style for focused headings */
#write > h3.md-focus:before,
#write > h4.md-focus:before,
#write > h5.md-focus:before,
#write > h6.md-focus:before,
h3.md-focus:before,
h4.md-focus:before,
h5.md-focus:before,
h6.md-focus:before {color: inherit;border: inherit;border-radius: inherit;position: inherit;left: initial;float: none;top: initial;font-size: inherit;padding-left: inherit;padding-right: inherit;vertical-align: inherit;font-weight: inherit;line-height: inherit;
}

如图

Type2:从二级标题开始的

/** initialize css counter */
.outline-h1,
h1 {counter-reset: h2;
}.outline-h2,
h2 {counter-reset: h3;
}.outline-h3,
h3 {counter-reset: h4;
}.outline-h4,
h4 {counter-reset: h5;
}.outline-h5,
h5 {counter-reset: h6;
}#write h2:before,
.outline-h2 > .outline-item > .outline-label:before {counter-increment: h2;content: counter(h2) " ";
}#write h3:before,
h3.md-focus.md-heading:before, /** override the default style for focused headings */
.outline-h3 > .outline-item > .outline-label:before {counter-increment: h3;content: counter(h2) "." counter(h3) " ";
}#write h4:before,
h4.md-focus.md-heading:before,
.outline-h4 > .outline-item > .outline-label:before {counter-increment: h4;content: counter(h2) "." counter(h3) "." counter(h4) " ";
}#write h5:before,
h5.md-focus.md-heading:before,
.outline-h5 > .outline-item > .outline-label:before {counter-increment: h5;content: counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) " ";
}#write h6:before,
h6.md-focus.md-heading:before,
.outline-h6 > .outline-item > .outline-label:before {counter-increment: h6;content: counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) "." counter(h6) " ";
}/** override the default style for focused headings */
#write > h3.md-focus:before,
#write > h4.md-focus:before,
#write > h5.md-focus:before,
#write > h6.md-focus:before,
h3.md-focus:before,
h4.md-focus:before,
h5.md-focus:before,
h6.md-focus:before {color: inherit;border: inherit;border-radius: inherit;position: inherit;left: initial;float: none;top: initial;font-size: inherit;padding-left: inherit;padding-right: inherit;vertical-align: inherit;font-weight: inherit;line-height: inherit;
}

如图

参考:

Auto Numbering for Headings

Auto numbering Typora outline

Typora自动生成标题编号(包含从二级标题开始的)相关推荐

  1. sql server 按照日期自动生成单据编号的函数

    一.sql server 按照日期自动生成单据编号的函数,格式为##08080001,##表示打头的单据字符,然后是年月和流水编号. 二.传入的参数为单据的打头字符和生成单据的日期 三.一般的调用格式 ...

  2. wps文档插入一个表格,怎么取消自动生成的编号

    wps是专有名词太多了么,这个里边弄了半天,上火. 不多说,浪费时间了,那就得记下来:不想要的如下: 怎么取消这个f,g,h,i自动生成的编号? wps文字 (左上角) -->格式 --> ...

  3. websocket中自动生成身份编号(获取sessionID,将sid值设置为sessionID的方法),并在页面刷新时沿用sid的解决方案

    websocket如果需要1对1通信,或者说将服务器数据发送到指定的客户端上,就需要给每一个新生成的websocket加上编号.比较常见的,是在地址映射中加上编号,比如: @ServerEndpoin ...

  4. mysql 单据编号生成_mysql自动生成单据编号

    这一句SQL就可以直接生成唯一的单据编号,方便直接插入主表 select CONCAT ('test_', DATE_FORMAT(now(), '%Y%m%d'), RIGHT(CONCAT ('0 ...

  5. java自动生成项目编号_java - Apache POI,在同一文档中创建项目符号点和编号列表 - 堆栈内存溢出...

    我试图用apache poi创建一个既包含圆点又包含编号列表的文档. 我想得到这样的结果. 名单: 清单1项目0 清单1项目1 清单1项目2 列表后的段落. 清单2: 清单2项目0 清单2项目1 清单 ...

  6. Java自动生成订单编号+流水号

    介绍 这里是小编成长之路的历程,也是小编的学习之路.希望和各位大佬们一起成长! 以下为小编最喜欢的两句话: 要有最朴素的生活和最遥远的梦想,即使明天天寒地冻,山高水远,路远马亡. 一个人为什么要努力? ...

  7. SQL触发器新增自动生成唯一编号

    编号格式:关键字+年月日时+3位流水号 CREATE TRIGGER [dbo].[insert_xxtable_number] ON [dbo].[xxtable] AFTER INSERT AS ...

  8. Word2007自动生成带编号的多级目录

    [url]http://inexus.iteye.com/blog/1739627[/url]

  9. word自动生成目录后,序号和标题之间有空格,如何删除空格

      菜单栏依次选择:引用 => 目录 => 自定义目录 => 修改 => 对"目录1"修改 => 格式 => 制表位 => 根据个人选择合 ...

  10. word设置多级标题,一级标题为“一”,二级标题为“1.1”

    针对此例,如下操作: 1.点击"视图"选项卡的"大纲"视图 2.点击"一级标题1",再点击"大纲工具"的下拉选项框中的& ...

最新文章

  1. 东莞网络推广浅析网站优化中常见的引流方式有哪些?
  2. 也许你不知道的c#基本数据类型及其默认值
  3. 【floyd存字典序路径】【HDU1385】【Minimum Transport Cost】
  4. 手动将经典 VM 从 VHD 迁移到新的 ARM 托管磁盘 VM
  5. python 提示错误AttributeError: type object 'str' has no attribute '_name_'
  6. 接口方法和映射器的statement id 是怎么绑定起来的?
  7. mybatis11--多对多关联查询
  8. 编辑距离 在输入检测中的应用
  9. jQuery Howto: 如何快速创建一个AJAX的加载的图片效果
  10. win10使用navicat管理数据库
  11. MySQL8.0数据库基础教程(二)-理解关系
  12. Java_银行开户存取款
  13. ArduPilot飞行前检查——PreArm解析
  14. MATLAB解线性方程组
  15. 线性可分支持向量机、线性支持向量机、非线性支持向量机的区别
  16. Linux性能分析方法
  17. 蜡烛图、美国图绘图及标记
  18. 新建项目(failed to import..)解决方法
  19. 国际化开发技术FAQ
  20. labVIEW写入电子表格文件

热门文章

  1. OpenWRT上如何让 ss 设置指定域名dst bypass
  2. 关于CSDN登录提示手机号验证的问题
  3. 关于钱学森定义复杂网络一事的探究
  4. 数字电子技术基础第5版笔记和课后习题答案 阎石
  5. DeepMind论文三连发:如何在仿真环境中生成灵活行为
  6. 联想电脑Fn热键驱动
  7. LoadRunner 11 安装及破解
  8. 400多款微信公众号小游戏源码集合源码
  9. 字符串函数和数据类型转换函数
  10. HTML期末大作业~酒店网站模板(HTML+CSS+JavaScript)