首页 > 其他分享 >typora自动编号设置,pdf导出也带编号

typora自动编号设置,pdf导出也带编号

时间:2023-07-30 20:01:25浏览次数:43  
标签:md typora outline h2 counter 编号 pdf toc before

鉴于目前网上的baser.use.css文件配置都无法在pdf导出时保存编号,所以列出baser.use.css文件内容(之前在网上找的,找不到链接了),该配置可以在导出pdf的时候保存编号,亲测。

/**
 * author: LPZ
 * email: [email protected]
 */

h1, h2, h3, h4, strong {
  font-weight: 600;
}

/* 添加自动序号样式 */
#write {
  counter-reset: h2;
}

h1 {
  counter-reset: h2;
}

h2 {
  counter-reset: h3;
}

h3 {
  counter-reset: h4;
}

h4 {
  counter-reset: h5;
}

h5 {
  counter-reset: h6;
}

#write h2:before {
  counter-increment: h2;
  content: counter(h2) ". ";
}

#write h3:before,
h3.md-focus.md-heading:before { /** override the default style for focused headings */
  counter-increment: h3;
  content: counter(h2) "."counter(h3) ". ";
}

#write h4:before,
h4.md-focus.md-heading:before {
  counter-increment: h4;
  content: counter(h2) "."counter(h3) "."counter(h4) ". ";
}

#write h5:before,
h5.md-focus.md-heading:before {
  counter-increment: h5;
  content: counter(h2) "."counter(h3) "."counter(h4) "."counter(h5) ". "
}

#write h6:before,
h6.md-focus.md-heading: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;
}

/* 自定义强制换号符,使得在导出PDF 或打印时强制换行 */
@media print {

  /* 这是自定义标签, 在需要换行的地方插入:<pb> */
  pb {
    display: block;
    page-break-after: always;
  }

  h1 {
    page-break-before: always;
  }

  h1:first-of-type {
    page-break-before: avoid;
  }
}

/* 完成的 Task 添加删除线 */
.task-list-done {
  text-decoration: line-through;
  color: #777;
}

.task-list-not-done {}

/* 添加键盘样式 */
kbd {
  box-shadow: inset 0 -2px 0 #c6cbd1;
  background-color: white;
}

/* TOC 中隐藏 H1 和 H6 */
.md-toc-h1, .md-toc-h6 {
  display: none;
}

/* 添加 TOC 自动序号样式 */
.md-toc-content {
  counter-reset: toc-h2;
}

.md-toc-h1 {
  counter-reset: toc-h2;
}

.md-toc-h2 {
  counter-reset: toc-h3;
}

.md-toc-h3 {
  counter-reset: toc-h4;
}

.md-toc-h4 {
  counter-reset: toc-h5;
}

.md-toc-h5 {
  counter-reset: toc-h6;
}

.md-toc-content .md-toc-h2 a:before {
  counter-increment: toc-h2;
  content: counter(toc-h2) ". ";
}

.md-toc-content .md-toc-h3 a:before {
  counter-increment: toc-h3;
  content: counter(toc-h2) "."counter(toc-h3) ". ";
}

.md-toc-content .md-toc-h4 a:before {
  counter-increment: toc-h4;
  content: counter(toc-h2) "."counter(toc-h3) "."counter(toc-h4) ". ";
}

.md-toc-content .md-toc-h5 a:before {
  counter-increment: toc-h5;
  content: counter(toc-h2) "."counter(toc-h3) "."counter(toc-h4) "."counter(toc-h5) ". ";
}

.md-toc-content .md-toc-h6 a:before {
  counter-increment: toc-h6;
  content: counter(toc-h2) "."counter(toc-h3) "."counter(toc-h4) "."counter(toc-h5) "."counter(toc-h6) ". ";
}

/* 侧边栏自动编号 */
.outline-content {
  counter-reset: outline-h2;
}

.outline-h1 {
  counter-reset: outline-h2;
}

.outline-h2 {
  counter-reset: outline-h3;
}

.outline-h3 {
  counter-reset: outline-h4;
}

.outline-h4 {
  counter-reset: outline-h5;
}

.outline-h5 {
  counter-reset: outline-h6;
}

.outline-content .outline-h2 .outline-label:before {
  counter-increment: outline-h2;
  content: counter(outline-h2) ". ";
}

.outline-content .outline-h3 .outline-label:before {
  counter-increment: outline-h3;
  content: counter(outline-h2) "."counter(outline-h3) ". ";
}

.outline-content .outline-h4 .outline-label:before {
  counter-increment: outline-h4;
  content: counter(outline-h2) "."counter(outline-h3) "."counter(outline-h4) ". ";
}

.outline-content .outline-h5 .outline-label:before {
  counter-increment: outline-h5;
  content: counter(outline-h2) "."counter(outline-h3) "."counter(outline-h4) "."counter(outline-h5) ". ";
}

.outline-content .outline-h6 .outline-label:before {
  counter-increment: outline-h6;
  content: counter(outline-h2) "."counter(outline-h3) "."counter(outline-h4) "."counter(outline-h5) "."counter(outline-h6) ". ";
}

百度网盘链接:链接:https://pan.baidu.com/s/1cQB7VDg6liDSN7RIUlbO8g?pwd=1234
提取码:1234

标签:md,typora,outline,h2,counter,编号,pdf,toc,before
From: https://www.cnblogs.com/skyaha/p/17591900.html

相关文章

  • 零代码编程:PDF文件名和Excel数据进行比对找不同
    F盘“北交所招股说明书”文件夹下有150个文件;F盘”北证A股20230703.xlsx”表格中证券名称有200多个;现在想找出文件夹下的哪些证券名称不在表格里面。在ChatGPT中输入提示词:写一段Python程序:F盘“北交所招股说明书”文件夹下有很多PDF文件,获取其标题名称,保存到列表:“已下载说明书的......
  • C#生成PDF格式的合同文件
    生成PDF格式的合同文件,效果图如下: 一、准备工作首先C#代码操作pdf文件,需要引用一个pdf官方提供的两个dll,去网上下载,并将其添加引用到项目即可。官方下载地址 ,提取码:0jue在代码中引用usingiTextSharp.text;usingiTextSharp.text.pdf;usingSystem.IO;二、创建PDF......
  • 【专题】展望人工智能银行:当银行遇到AI报告PDF合集分享(附原数据表)
    报告链接:http://tecdat.cn/?p=32210在2016年,AlphaGo机器人打败了18届世界棋王李世石,成为了世界棋坛上最伟大的人物。阅读原文,获取专题报告全文,解锁154份文末人工智能银行相关报告。围棋是一种非常复杂的棋类,它要求有很强的直觉,想像力和策略性的思考,而这一切在很长一段时间里都......
  • 【专题】2022母婴行业洞察报告PDF合集分享(附原数据表)
    报告链接:http://tecdat.cn/?p=32654原文出处:拓端数据部落公众号在这一特别的环境下,我国的母婴消费市场将会发生什么新的变化?面对这一代又一代交替的母亲与母亲,他们的消费观念与养育模式又有什麽新的标记?面对怎样的新挑战,新的机会?报告从母婴行业现状与趋势、母婴人群精准画像、母......
  • 第一个文章!python去除行业标准信息pdf图片的水印
    在网上下得pdf 有水印正好这几天在看python  那么她来啦!!!上代码defdeal_water_mark(imagePath):count=len(os.listdir(imagePath))start_time_all=datetime.datetime.now()forfilenameinos.listdir(imagePath):start_time=datetime.datetim......
  • 华为认证 | HCIE考过了,证书编号怎么查?
    我们都知道,每一个HCIE都拥有属于自己的独一无二的编号,这个编号到底是指什么呢?HCIE作为华为专家级的认证,考试难度极高,你要通过HCIE的笔试、实验LAB考试。当你“过五关斩六将”,通过LAB的那一刻,你就可以成为一名HCIE了。之后你拿到证书,在你的证书上有一个编号,上面有一个“HCIENo.”,后......
  • Acrobat Pro DC 2023 for Mac(PDF编辑器) 2023.003.20244 中文版
    AcrobatProDC2023forMac是一款功能强大的PDF编辑器软件,由AdobeSystems开发。它为Mac用户提供了广泛的PDF处理工具和功能,使用户能够创建、编辑、转换和共享高质量的PDF文件。以下是AcrobatProDC2023forMac的一些主要特点和功能:PDF编辑:AcrobatProDC允许用户对PDF文件进......
  • 筛选出 1指定行( 编号中包含login的行),2指定列的值 放到列表中
    第一版 写死了列的值的下标,不够人性化,还需要去数列在第几个位置#导包importxlrd#第一步根据包提供的方法读某个路径下的xlsworkbook=xlrd.open_workbook('../data/testcase.xls')#第二步根据名字找某个表每个excel里有Sheet1Sheet2等worksheet=wor......
  • 【专题】中国可持续金融发展洞察白皮书报告PDF合集分享(附原数据表)
    全文链接:https://tecdat.cn/?p=33318原文出处:拓端数据部落公众号自我国提出双碳目标以来,可持续金融市场发展迅速,呈现蓬勃发展的态势。多年来,致力于中国可持续金融市场的可持续金融战略咨询团队为金融机构提供了相关服务。阅读原文,获取专题报告合集全文,解锁文末358份金融行业相关......
  • 小易pdf软件工具箱
    +++最新1.3版本号+++***下载地址https://all-file2.lanzoug.com/0727170088220973bb/2022/11/08/e5ee17dd7c20440891490e9762bcafd3.zip?st=-qCqqTOSl5Uuw6dgTlK8ug&e=1690452043&b=BxdcMFQ1VzECPAIWADkDdQk4AHEHVlA6BTcKflw_bUiJRLlprVXtQbVArVDsEsgGXVKwJs1bDALgFs1_aLUP8AL......