Typora代码块配色和标题自带序号的实现代码

  1. 先打开主题文件夹
  2. 文件>偏好设置>外观>打开主题文件夹
  3. 然后编辑base.user.css(如果没有就新建一个)文件
/*标题自动添加序号*/
.sidebar-content {
``counter-reset``: h``1
}
.outline-h``1` `{
``counter-reset``: h``2
}
.outline-h``2` `{
``counter-reset``: h``3
}
.outline-h``3` `{
``counter-reset``: h``4
}
.outline-h``4` `{
``counter-reset``: h``5
}
.outline-h``5` `{
``counter-reset``: h``6
}
.outline-h``1``>.outline-item>.outline-label:before {
``counter-increment``: h``1``;
``content``: ``counter``(h``1``) ``" "
}
.outline-h``2``>.outline-item>.outline-label:before {
``counter-increment``: h``2``;
``content``: ``counter``(h``1``) ``"."``counter``(h``2``) ``" "
}
.outline-h``3``>.outline-item>.outline-label:before {
``counter-increment``: h``3``;
``content``: ``counter``(h``1``) ``"."``counter``(h``2``) ``"."``counter``(h``3``) ``" "
}
.outline-h``4``>.outline-item>.outline-label:before {
``counter-increment``: h``4``;
``content``: ``counter``(h``1``) ``"."``counter``(h``2``) ``"."``counter``(h``3``) ``"."``counter``(h``4``) ``" "
}
.outline-h``5``>.outline-item>.outline-label:before {
``counter-increment``: h``5``;
``content``: ``counter``(h``1``) ``"."``counter``(h``2``) ``"."``counter``(h``3``) ``"."``counter``(h``4``) ``"."``counter``(h``5``) ``" "
}
.outline-h``6``>.outline-item>.outline-label:before {
``counter-increment``: h``6``;
``content``: ``counter``(h``1``) ``"."``counter``(h``2``) ``"."``counter``(h``3``) ``"."``counter``(h``4``) ``"."``counter``(h``5``) ``"."``counter``(h``6``) ``" "
}
#write {
``counter-reset``: h``1
}
h``1` `{
``counter-reset``: h``2
}
h``2` `{
``counter-reset``: h``3
}
h``3` `{
``counter-reset``: h``4
}
h``4` `{
``counter-reset``: h``5
}
h``5` `{
``counter-reset``: h``6
}
#write h``1:``before {
``counter-increment``: h``1``;
``content``: ``counter``(h``1``) ``" "
}
#write h``2:``before {
``counter-increment``: h``2``;
``content``: ``counter``(h``1``) ``"."``counter``(h``2``) ``" "
}
#write h``3:``before,
h``3``.md-focus.md-heading:before
  ``{
``counter-increment``: h``3``;
``content``: ``counter``(h``1``) ``"."``counter``(h``2``) ``"."``counter``(h``3``) ``" "
}
#write h``4:``before,
h``4``.md-focus.md-heading:before {
``counter-increment``: h``4``;
``content``: ``counter``(h``1``) ``"."``counter``(h``2``) ``"."``counter``(h``3``) ``"."``counter``(h``4``) ``" "
}
#write h``5:``before,
h``5``.md-focus.md-heading:before {
``counter-increment``: h``5``;
``content``: ``counter``(h``1``) ``"."``counter``(h``2``) ``"."``counter``(h``3``) ``"."``counter``(h``4``) ``"."``counter``(h``5``) ``" "
}
#write h``6:``before,
h``6``.md-focus.md-heading:before {
``counter-increment``: h``6``;
``content``: ``counter``(h``1``) ``"."``counter``(h``2``) ``"."``counter``(h``3``) ``"."``counter``(h``4``) ``"."``counter``(h``5``) ``"."``counter``(h``6``) ``" "
}
#write>h``3``.md-focus:before,
#write>h``4``.md-focus:before,
#write>h``5``.md-focus:before,
#write>h``6``.md-focus:before,
h``3``.md-focus:before,
h``4``.md-focus:before,
h``5``.md-focus:before,
h``6``.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;
}
/*因为不同主题的代码块部分不一样,code部分统一*/
.CodeMirror-lines {
``padding-left``: ``4px``;
}
.code-tooltip {
``box-shadow: ``0` `1px` `1px` `0` `rgba(``0``,``28``,``36``,.``3``);
``border-top``: ``1px` `solid` `#eef2f2``;
}
.md-fences,
code``,
tt {
``background-color``: ``#f8f8f8``;
``border-radius: ``3px``;
``padding``: ``0``;
``padding-left``: ``4px` `!important``;
``padding-right``: ``4px` `!important``;
``font-size``: ``0.9em``;
}
code` `{
``background-color``: ``#f3f4f4``;
``padding``: ``0` `2px` `0` `2px``;
}
.md-fences {
``margin-bottom``: ``15px``;
``margin-top``: ``15px``;
``padding-top``: ``8px``;
``padding-bottom``: ``6px``;
}
.md-task-``list-item` `> input {
``margin-left``: ``-1.3em``;
}
@media ``print` `{
``html {
``font-size``: ``13px``;
``}
``table,
``pre` `{
``page-break-inside``: ``avoid``;
``}
``pre` `{
``word-wrap: break-word;
``}
}
.md-fences {
``background-color``: ``#f8f8f8``;
}
#write ``pre``.md-meta-``block` `{
``padding``: ``1``rem;
``font-size``: ``85%``;
``line-height``: ``1.45``;
``background-color``: ``#f7f7f7``;
``border``: ``0``;
``border-radius: ``3px``;
``color``: ``#777777``;
``margin-top``: ``0` `!important``;
}
.mathjax-``block``>.code-tooltip {
``bottom``: .``375``rem;
}
/*深色背景*/
#write .md-fences:not([mermaid-type]) {
``padding-top``: ``7px``;
``border-radius: ``10px``;
``background-color``: ``#282c34``;
``color``: ``#eeeeee``;
}
.code-tooltip .ty-input,
.code-tooltip input {
``color``: ``#eee``;
}
/*MAC的三个图标*/
.CodeMirror-wrap .CodeMirror-``scroll` `{
``padding-top``: ``20px``;
}
#write .md-fences:before {
``content``: ``""``;
``z-index``: ``4``;
``display``: ``block``;
``position``: ``absolute``;
``top``: ``7px``;
``left``: ``13px``;
``width``: ``15px``;
``height``: ``15px``;
``border-radius: ``50%``;
``float``: ``left``;
``background-color``: ``#fa3534``;
}
#write .CodeMirror-scroll:before {
``content``: ``""``;
``display``: ``block``;
``position``: ``absolute``;
``top``: ``0px``;
``left``: ``29px``;
``width``: ``15px``;
``height``: ``15px``;
``border-radius: ``50%``;
``float``: ``left``;
``z-index``: ``999``;
``background-color``: ``#ff9900``;
}
#write .md-fences::after {
``content``: ``""``;
``z-index``: ``4``;
``display``: ``block``;
``position``: ``absolute``;
``top``: ``7px``;
``left``: ``53px``;
``width``: ``15px``;
``height``: ``15px``;
``border-radius: ``50%``;
``float``: ``left``;
``background-color``: ``#19be6b``;
}
/*配色*/
.CodeMirror-line .cm-number,``/*数字*/
.CodeMirror-line .cm-property {``/*被调用的方法*/
``color``: ``#f08d49``;
}
.CodeMirror-line .cm-variable``-3``,``/*形参,类型*/
.CodeMirror-line .cm-qualifier,``/*css class*/
.CodeMirror-line .cm-variable``-2` `{``/*被使用的形参*/
``color``: ``#FFCB6B``;
}
.CodeMirror-line .cm-meta,``/*省略号,注解等*/
.CodeMirror-line .cm-atom,``/*css属性值,布尔值等等*/
.CodeMirror-line .cm-keyword{``/*关键字*/
``color``: ``#cc99cd``;
}
.CodeMirror-line .cm-def,``/*变量名*/
.CodeMirror-line .cm-variable {``/*被使用的变量名*/
``color``: ``#FFCB6B``;
}
.CodeMirror-line .cm-builtin {``/*被调用的属性*/
``color``: ``#82AAFF``;
}
.CodeMirror-line .cm-comment {``/*注释*/
``color``: ``#888``;
}
.CodeMirror-line .cm-string,``/*字符串*/
.CodeMirror-line .cm-string``-2` `{``/*正则表达式*/
``color``: ``#7ec699
}
.CodeMirror-line .cm-operator {``/*运算符*/
``color``: ``#67cdcc
}
.CodeMirror div.CodeMirror-cursor {``/*光标*/
``border-left``: ``1px` `solid` `#fff``;
``z-index``: ``3``;
}
.CodeMirror-selected,``/*选中的背景*/
.CodeMirror-selectedtext {
``background``: ``#666` `!important``;
}
/*html*/
.CodeMirror-line .cm-tag{``/*标签名字*/
``color``: ``#F07178``;
}
.CodeMirror-line .cm-bracket{``/*标签尖括号*/
``color``: ``#FFF``;
}
.CodeMirror-line .cm-attribute{``/*属性*/
``color``: ``#FFCB6B``;
}

参考:https://www.jb51.net/css/753133.html

Typora代码块配色和标题自带序号的实现代码的更多相关文章

  1. 构造代码块、this关键字、静态变量、静态代码块、主函数

    一.构造代码块: 作用:给对象进行初始化. 特点:对象一经运行就执行(与变量声明时赋初值同级别,此处注意 非法前向引用) 优先于构造函数的执行. 与构造函数的区别: 构造代码块是给所有对象统一初始化. ...

  2. 子类A继承父类B, A a = new A(); 则父类B构造函数、父类B静态代码块、父类B非静态代码块、子类A构造函数、子类A静态代码块、子类A非静态代码块 执行的先后顺序是

    按照先后顺序: 1,静态先于非静态代码库执行(静态代码块随着类的加载而加载,初始化只执行一次) 2,父类先于子类 3,非静态代码块优于构造函数执行 所以执行顺序如下: 父类B静态代码块->子类A ...

  3. Confluence代码块(Code Block)宏

    有时候现在wiki上插入代码,如何让代码高亮,变的有颜色,下面这篇文章可能会帮助你,先看下django代码高亮效果图 代码块(Code Block)宏允许你在 Confluence 页面中显示代码,并 ...

  4. (转)java中静态代码块的用法 static用法详解

    一)java 静态代码块 静态方法区别一般情况下,如果有些代码必须在项目启动的时候就执行的时候,需要使用静态代码块,这种代码是主动执行的;需要在项目启动的时候就初始化,在不创建对象的情况下,其他程序来 ...

  5. [Java基础]代码块及java反编译

    块的作用域:   块(即复合语句)是指一对花括号括起来的若干条简单的java语句.块确定了变量的作用域.一个块可以嵌套在另一个块中.但是,在嵌套的两个块中声明同名的变量时应注意,块中变量申明在块外变量 ...

  6. 从C#到Objective-C,循序渐进学习苹果开发(4)--代码块(block)和错误异常处理的理解

    本随笔系列主要介绍从一个Windows平台从事C#开发到Mac平台苹果开发的一系列感想和体验历程,本系列文章是在起步阶段逐步积累的,希望带给大家更好,更真实的转换历程体验.本文继续上一篇随笔<从 ...

  7. iOS端项目注释规范附统一代码块

    代码的注释经常被人忽略,以至于在后期维护的时候较为困难.我们准备在XX项目开始之前制定一套规范的注释体系,致力于达到就算维护人员改变也能快速上手的效果. 1.属性注释 属性注释 使用 /** 注释*/ ...

  8. java基础--java静态代码块和静态方法的区别、static用法

    转载自: http://blog.sina.com.cn/s/blog_afddb8ff0101aqs9.html 静态代码块:有些代码必须在项目启动的时候就执行,这种代码是主动执行的(当类被载入时, ...

  9. java中静态代码块的用法 static用法详解(转)

    (一)java 静态代码块 静态方法区别一般情况下,如果有些代码必须在项目启动的时候就执行的时候,需要使用静态代码块,这种代码是主动执行的;需要在项目启动的时候就初始化,在不创建对象的情况下,其他程序 ...

随机推荐

  1. 【Maven实战技巧】「插件使用专题」Maven-Assembly插件实现自定义打包

    前提概要 最近我们项目越来越多了,然后我就在想如何才能把基础服务的打包方式统一起来,并且可以实现按照我们的要求来生成,通过研究,我们通过使用maven的assembly插件完美的实现了该需求,爽爆了有 ...

  2. Apache Flink jobmanager/logs路径遍历CVE-2020-17519

    影响版本 1.11.0 1.11.1 1.11.2 poc http://192.168.49.2:8081/jobmanager/logs/..%252f..%252f..%252f..%252f. ...

  3. 大数据学习(23)—— ZooKeeper实战

    本片介绍两方面内容,一方面是命令行操作,另一方面是Java调用API. ZooKeeper集群环境的搭建在Hadoop集群搭建里已经讲过了,这里不再赘述,本篇内容基于zk3.5.8. 这里补充一点,除 ...

  4. Linux从头学06:16张结构图,彻底理解【代码重定位】的底层原理

    作 者:道哥,10+年的嵌入式开发老兵. 公众号:[IOT物联网小镇],专注于:C/C++.Linux操作系统.应用程序设计.物联网.单片机和嵌入式开发等领域. 公众号回复[书籍],获取 Linux. ...

  5. python,ctf笔记随笔

    一.在centos虚拟机中安装pyhton3环境: 安装pip3:yum install python36-pip 将pip升级到最新版本:pip3 install --upgrade pip 运行p ...

  6. 线程创建的三种方法:继承Thread类,实现Runnable接口,实现Callable接口

    线程创建 三种创建方式 1. 继承Thread类 自定义线程类继承Thread类 重写run()方法,编写线程执行体 创建线程对象,调用start()方法启动线程 线程不一定执行,CPU按排调度 pa ...

  7. Linux虚拟机配置SSH免密登录

    本环境为CentOS 7(点击镜像下载iso文件),无图界面. 启动SSH服务 在/usr/sbin/有一个文件为sshd,然后输入绝对路径/usr/sbin/sshd即可开启ssh服务. 然后输入命 ...

  8. 使用Freemarker导出Word文档(包含图片)代码实现及总结

    .personSunflowerP { background: rgba(51, 153, 0, 0.66); border-bottom: 1px solid rgba(0, 102, 0, 1); ...

  9. Terracotta 2.7.2 Admin Console Guide

    http://www.terracotta.org/confluence/display/docs27/Admin+Console+Guide#AdminConsoleGuide-Roots

  10. ☕【Java技术指南】「Guava Collections」实战使用相关Guava不一般的集合框架

    Google Guava Collections 使用介绍 简介 Google Guava Collections 是一个对 Java Collections Framework 增强和扩展的一个开源 ...