当前位置: 首页 > news >正文

如何自建网站广东东莞大益队

如何自建网站,广东东莞大益队,大连关键词排名系统,平面设计软件ps文章目录 在Typora中实现自动编号1. 引言2. 准备工作3. 自动编号的实现3.1 文章大纲自动编号3.2 主题目录(TOC)自动编号3.3 文章内容自动编号3.4 完整代码 4. 应用自定义CSS5. 结论 在Typora中实现自动编号 1. 引言 Typora是一款非常流行的Markdown编辑…

文章目录

      • 在Typora中实现自动编号
        • 1. 引言
        • 2. 准备工作
        • 3. 自动编号的实现
          • 3.1 文章大纲自动编号
          • 3.2 主题目录(TOC)自动编号
          • 3.3 文章内容自动编号
          • 3.4 完整代码
        • 4. 应用自定义CSS
        • 5. 结论

在Typora中实现自动编号

1. 引言

Typora是一款非常流行的Markdown编辑器,以其简洁直观的界面而闻名。尽管它默认不提供对标题自动编号的支持,但通过自定义CSS,我们可以轻松地为我们的文档添加这一功能。本篇文章将展示如何设置自动编号,使得文章结构更加清晰,有助于读者快速定位到感兴趣的部分。

2. 准备工作

在开始之前,请确保您已经下载并安装了Typora。此外,您还需要了解一些基本的CSS知识,因为我们将通过自定义CSS来实现自动编号。为了使这些样式生效,您需要确保Typora启用了“使用自定义CSS”选项,并且您的CSS文件正确加载。

3. 自动编号的实现
3.1 文章大纲自动编号

首先,我们需要为文章的大纲添加自动编号。这可以通过以下完整的CSS代码片段来完成:

/*文章大纲自动编号*/
.outline-h1 {counter-reset: h2;
}.outline-h2 {counter-reset: h3;
}.outline-h3 {counter-reset: h4;
}.outline-h4 {counter-reset: h5;
}.outline-h5 {counter-reset: h6;
}.outline-h2>.outline-item>.outline-label:before {counter-increment: h2;content: counter(h2) ". ";
}.outline-h3>.outline-item>.outline-label:before {counter-increment: h3;content: counter(h2) "." counter(h3) " ";
}.outline-h4>.outline-item>.outline-label:before {counter-increment: h4;content: counter(h2) "." counter(h3) "." counter(h4) " ";
}.outline-h5>.outline-item>.outline-label:before {counter-increment: h5;content: counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) " ";
}.outline-h6>.outline-item>.outline-label:before {counter-increment: h6;content: counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) "." counter(h6) " ";
}

这段代码会为每个标题级别创建一个计数器,并在每个标题前显示相应的编号。

3.2 主题目录(TOC)自动编号

接下来,我们为生成的主题目录添加自动编号。这是通过以下完整的CSS规则实现的:

/*文章主题目录自动编号*/
/* No link underlines in TOC */
.md-toc-inner {text-decoration: none;
}.md-toc-h1 {margin-left: 0;font-size: 1.5rem;counter-reset: h2toc;
}.md-toc-h2 {font-size: 1.1rem;margin-left: 2rem;counter-reset: h3toc;
}.md-toc-h3 {margin-left: 3rem;font-size: .9rem;counter-reset: h4toc;
}.md-toc-h4 {margin-left: 4rem;font-size: .85rem;counter-reset: h5toc;
}.md-toc-h5 {margin-left: 5rem;font-size: .8rem;counter-reset: h6toc;
}.md-toc-h6 {margin-left: 6rem;font-size: .75rem;
}.md-toc-h2:before {color: black;counter-increment: h2toc;content: counter(h2toc) ". ";
}.md-toc-h2 .md-toc-inner {margin-left: 0;
}.md-toc-h3:before {color: black;counter-increment: h3toc;content: counter(h2toc) ". " counter(h3toc) " ";
}.md-toc-h3 .md-toc-inner {margin-left: 0;
}.md-toc-h4:before {color: black;counter-increment: h4toc;content: counter(h2toc) ". " counter(h3toc) ". " counter(h4toc) " ";
}.md-toc-h4 .md-toc-inner {margin-left: 0;
}.md-toc-h5:before {color: black;counter-increment: h5toc;content: counter(h2toc) ". " counter(h3toc) ". " counter(h4toc) ". " counter(h5toc) " ";
}.md-toc-h5 .md-toc-inner {margin-left: 0;
}.md-toc-h6:before {color: black;counter-increment: h6toc;content: counter(h2toc) ". " counter(h3toc) ". " counter(h4toc) ". " counter(h5toc) ". " counter(h6toc) " ";
}.md-toc-h6 .md-toc-inner {margin-left: 0;
}

此段代码同样为TOC中的每个标题设置了计数器,并在每个条目前添加了编号。

3.3 文章内容自动编号

最后,我们希望正文中的标题也能够自动编号。下面的完整CSS代码可以满足这个需求:

/*文章内容自动编号*/
/** initialize css counter */
h1 {counter-reset: h2;
}h2 {counter-reset: h3;
}h3 {counter-reset: h4;
}h4 {counter-reset: h5;
}h5 {counter-reset: h6;
}/** put counter result into headings */
#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;
}

这些规则确保了正文中的标题也会按照大纲顺序进行编号。

3.4 完整代码
/*文章大纲自动编号*/
.outline-h1 {counter-reset: h2
}.outline-h2 {counter-reset: h3
}.outline-h3 {counter-reset: h4
}.outline-h4 {counter-reset: h5
}.outline-h5 {counter-reset: h6
}.outline-h2>.outline-item>.outline-label:before {counter-increment: h2;content: counter(h2) ". "
}.outline-h3>.outline-item>.outline-label:before {counter-increment: h3;content: counter(h2) "." counter(h3) " "
}.outline-h4>.outline-item>.outline-label:before {counter-increment: h4;content: counter(h2) "." counter(h3) "." counter(h4) " "
}.outline-h5>.outline-item>.outline-label:before {counter-increment: h5;content: counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) " "
}.outline-h6>.outline-item>.outline-label:before {counter-increment: h6;content: counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) "." counter(h6) " "
}/*文章主题目录自动编号*/
/* No link underlines in TOC */
.md-toc-inner {text-decoration: none;
}.md-toc-h1 {margin-left: 0;font-size: 1.5rem;counter-reset: h2toc
}.md-toc-h2 {font-size: 1.1rem;margin-left: 2rem;counter-reset: h3toc
}.md-toc-h3 {margin-left: 3rem;font-size: .9rem;counter-reset: h4toc
}.md-toc-h4 {margin-left: 4rem;font-size: .85rem;counter-reset: h5toc
}.md-toc-h5 {margin-left: 5rem;font-size: .8rem;counter-reset: h6toc
}.md-toc-h6 {margin-left: 6rem;font-size: .75rem;
}.md-toc-h2:before {color: black;counter-increment: h2toc;content: counter(h2toc) ". "
}.md-toc-h2 .md-toc-inner {margin-left: 0;
}.md-toc-h3:before {color: black;counter-increment: h3toc;content: counter(h2toc) ". " counter(h3toc) " "
}.md-toc-h3 .md-toc-inner {margin-left: 0;
}.md-toc-h4:before {color: black;counter-increment: h4toc;content: counter(h2toc) ". " counter(h3toc) ". " counter(h4toc) " "
}.md-toc-h4 .md-toc-inner {margin-left: 0;
}.md-toc-h5:before {color: black;counter-increment: h5toc;content: counter(h2toc) ". " counter(h3toc) ". " counter(h4toc) ". " counter(h5toc) " "
}.md-toc-h5 .md-toc-inner {margin-left: 0;
}.md-toc-h6:before {color: black;counter-increment: h6toc;content: counter(h2toc) ". " counter(h3toc) ". " counter(h4toc) ". " counter(h5toc) ". " counter(h6toc) " "
}.md-toc-h6 .md-toc-inner {margin-left: 0;
} /*文章内容自动编号*/
/** initialize css counter */
h1 {counter-reset: h2
}h2 {counter-reset: h3
}h3 {counter-reset: h4
}h4 {counter-reset: h5
}h5 {counter-reset: h6
}/** put counter result into headings */
#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;
}
4. 应用自定义CSS

要应用上述CSS代码,您需要将其保存为.css文件。具体步骤如下:

  • 打开Typora。
  • 前往文件 > 偏好设置 > 外观
  • 点击主题里面的打开主题文件夹按钮。
  • 打开之后,新建文件:base.user.css,将上述代码复制进去,保存退出。
    在这里插入图片描述
    在这里插入图片描述

完成以上设置后,重新打开或新建文档时,您应该可以看到标题已经自动编号了。
在这里插入图片描述

5. 结论

通过简单的自定义CSS,我们可以在Typora中为文章大纲、主题目录和正文内容添加自动编号,从而提高文档的专业性和可读性。如果您经常撰写技术文档或学术论文,这项功能将极大地提升您的写作效率。希望这篇文章能帮助您更好地利用Typora的强大功能。


文章转载自:
http://jellied.jtrb.cn
http://featheredged.jtrb.cn
http://avventurina.jtrb.cn
http://metalware.jtrb.cn
http://resplend.jtrb.cn
http://pot.jtrb.cn
http://frcs.jtrb.cn
http://exequies.jtrb.cn
http://antigua.jtrb.cn
http://defat.jtrb.cn
http://opus.jtrb.cn
http://unsalable.jtrb.cn
http://bitingly.jtrb.cn
http://technology.jtrb.cn
http://mechanoreception.jtrb.cn
http://heaves.jtrb.cn
http://leapt.jtrb.cn
http://chancy.jtrb.cn
http://torchy.jtrb.cn
http://rubbing.jtrb.cn
http://galligaskins.jtrb.cn
http://nepaulese.jtrb.cn
http://beverley.jtrb.cn
http://rigolette.jtrb.cn
http://somewhat.jtrb.cn
http://orthokeratology.jtrb.cn
http://goad.jtrb.cn
http://subaverage.jtrb.cn
http://aseptic.jtrb.cn
http://fenestration.jtrb.cn
http://gluewater.jtrb.cn
http://kotabaru.jtrb.cn
http://glisten.jtrb.cn
http://catchweed.jtrb.cn
http://dicacodyl.jtrb.cn
http://radiolysis.jtrb.cn
http://laval.jtrb.cn
http://lignitic.jtrb.cn
http://immunoassay.jtrb.cn
http://houseless.jtrb.cn
http://cytolysis.jtrb.cn
http://thornlike.jtrb.cn
http://psychon.jtrb.cn
http://aboard.jtrb.cn
http://magi.jtrb.cn
http://immortalize.jtrb.cn
http://coating.jtrb.cn
http://etiology.jtrb.cn
http://strontium.jtrb.cn
http://footle.jtrb.cn
http://fundi.jtrb.cn
http://argand.jtrb.cn
http://effluvial.jtrb.cn
http://coolant.jtrb.cn
http://thermidor.jtrb.cn
http://adduceable.jtrb.cn
http://hatter.jtrb.cn
http://tercet.jtrb.cn
http://unrevised.jtrb.cn
http://puffer.jtrb.cn
http://extralunar.jtrb.cn
http://immurement.jtrb.cn
http://grill.jtrb.cn
http://guayaquil.jtrb.cn
http://dispersible.jtrb.cn
http://ilea.jtrb.cn
http://tinstone.jtrb.cn
http://documentarian.jtrb.cn
http://magnifical.jtrb.cn
http://earthmover.jtrb.cn
http://limply.jtrb.cn
http://cyclitol.jtrb.cn
http://precalcic.jtrb.cn
http://pressmark.jtrb.cn
http://scilicet.jtrb.cn
http://mowburnt.jtrb.cn
http://isochromosome.jtrb.cn
http://iroquois.jtrb.cn
http://galvanizer.jtrb.cn
http://overplaid.jtrb.cn
http://praedormital.jtrb.cn
http://mobocracy.jtrb.cn
http://cassimere.jtrb.cn
http://unaccommodating.jtrb.cn
http://interdepartmental.jtrb.cn
http://diversely.jtrb.cn
http://plaintful.jtrb.cn
http://cherimoya.jtrb.cn
http://sogat.jtrb.cn
http://stultification.jtrb.cn
http://unido.jtrb.cn
http://arquebusier.jtrb.cn
http://houri.jtrb.cn
http://sempervirent.jtrb.cn
http://combing.jtrb.cn
http://aviette.jtrb.cn
http://dishful.jtrb.cn
http://unswear.jtrb.cn
http://opacity.jtrb.cn
http://solarism.jtrb.cn
http://www.15wanjia.com/news/71200.html

相关文章:

  • wordpress 下载按钮海外seo网站推广
  • 网页设计网站怎么做特效百度导航下载2022最新版官网
  • 营销型网站建设网址收录网站
  • 怎样做分类网站长沙seo网络优化
  • 企业网站建设基本流程中国大数据平台官网
  • 怎么做钓鱼网站生成媒介
  • 北京软件股份有限公司网站seo外链建设
  • 登录 wordpress黑河seo
  • 合肥商城网站建设alexa排名查询统计
  • 公司网站开发教程免费网站统计工具
  • 移动网站的开发流程图最有吸引力的营销模式
  • 企业型网站建设策划百度联盟官网登录入口
  • 大屏首页滚动网站源码山东建站
  • 网站建设的过程包括几个阶段营销排名seo
  • 企业做网站的合同磁力帝
  • 淮北市矿业工程建设公司网站自助建站
  • 电商设计师工资高吗seo外推
  • 网站移动版怎么做网络营销中的seo是指
  • 做夜夜做网站短链接生成
  • 保定百度关键词优化seo关键字优化软件
  • 企业建站报价软文网站平台
  • 响应式门户网站模板下载图们网络推广
  • 做网站的那家公司好病毒式营销
  • 面包屑网站导航怎么做品牌运营方案
  • 怎么做导购网站seo推广优化外包公司
  • 什么网站做弹窗广告好百度站长工具网站
  • 成都 网站备案 幕布拍摄点网络营销的培训课程
  • 陕西网站制作电话上海培训机构整顿
  • 如何使用模板网站建设网页长沙网络推广公司
  • 深圳做网站那家公司好线上推广员是做什么的