Typora代码块配色和标题自带序号的实现代码
Typora代码块配色和标题自带序号的实现代码
- 先打开主题文件夹
- 文件>偏好设置>外观>打开主题文件夹
- 然后编辑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代码块配色和标题自带序号的实现代码的更多相关文章
- 构造代码块、this关键字、静态变量、静态代码块、主函数
一.构造代码块: 作用:给对象进行初始化. 特点:对象一经运行就执行(与变量声明时赋初值同级别,此处注意 非法前向引用) 优先于构造函数的执行. 与构造函数的区别: 构造代码块是给所有对象统一初始化. ...
- 子类A继承父类B, A a = new A(); 则父类B构造函数、父类B静态代码块、父类B非静态代码块、子类A构造函数、子类A静态代码块、子类A非静态代码块 执行的先后顺序是
按照先后顺序: 1,静态先于非静态代码库执行(静态代码块随着类的加载而加载,初始化只执行一次) 2,父类先于子类 3,非静态代码块优于构造函数执行 所以执行顺序如下: 父类B静态代码块->子类A ...
- Confluence代码块(Code Block)宏
有时候现在wiki上插入代码,如何让代码高亮,变的有颜色,下面这篇文章可能会帮助你,先看下django代码高亮效果图 代码块(Code Block)宏允许你在 Confluence 页面中显示代码,并 ...
- (转)java中静态代码块的用法 static用法详解
一)java 静态代码块 静态方法区别一般情况下,如果有些代码必须在项目启动的时候就执行的时候,需要使用静态代码块,这种代码是主动执行的;需要在项目启动的时候就初始化,在不创建对象的情况下,其他程序来 ...
- [Java基础]代码块及java反编译
块的作用域: 块(即复合语句)是指一对花括号括起来的若干条简单的java语句.块确定了变量的作用域.一个块可以嵌套在另一个块中.但是,在嵌套的两个块中声明同名的变量时应注意,块中变量申明在块外变量 ...
- 从C#到Objective-C,循序渐进学习苹果开发(4)--代码块(block)和错误异常处理的理解
本随笔系列主要介绍从一个Windows平台从事C#开发到Mac平台苹果开发的一系列感想和体验历程,本系列文章是在起步阶段逐步积累的,希望带给大家更好,更真实的转换历程体验.本文继续上一篇随笔<从 ...
- iOS端项目注释规范附统一代码块
代码的注释经常被人忽略,以至于在后期维护的时候较为困难.我们准备在XX项目开始之前制定一套规范的注释体系,致力于达到就算维护人员改变也能快速上手的效果. 1.属性注释 属性注释 使用 /** 注释*/ ...
- java基础--java静态代码块和静态方法的区别、static用法
转载自: http://blog.sina.com.cn/s/blog_afddb8ff0101aqs9.html 静态代码块:有些代码必须在项目启动的时候就执行,这种代码是主动执行的(当类被载入时, ...
- java中静态代码块的用法 static用法详解(转)
(一)java 静态代码块 静态方法区别一般情况下,如果有些代码必须在项目启动的时候就执行的时候,需要使用静态代码块,这种代码是主动执行的;需要在项目启动的时候就初始化,在不创建对象的情况下,其他程序 ...
随机推荐
- java获取日出日落时间
import java.math.BigDecimal; import java.text.ParseException; import java.text.SimpleDateFormat; imp ...
- Java8 Lambda表达式(二)
目录 一.Java8 内置的四大核心函数式接口 1. 消费型接口 Consumer 2. 供给型接口 Supplier 3. 函数型接口 Function 4.断言型接口 Predicate 二.方法 ...
- 数据库技术中的触发器(Trigger)——和ContentObserver功能类似
刚总结过ContentObserver的作用和特点,顺便总结下数据库技术中的触发器(Trigger),触 发 器 分 为 表 触 发 器 . 行 触 发 器
- 攻防世界Web区部分题解
攻防世界Web区部分题解 前言:PHP序列化就是把代码中所有的 对象 , 类 , 数组 , 变量 , 匿名函数等全部转换为一个字符串 , 提供给用户传输和存储 . 而反序列化就是把字符串重新转换为 ...
- XSS闯关挑战(1-15)
第一关 关键代码: 这一关两处的输出都没做任何防护,直接将用户的输入拼接到输出里面. payload: 第二关 使用上一关的payload显示如下 闭合一下标签就好了. 第三关 htmlspecial ...
- Python 列表解析式竟然支持异步?
PEP原文:https://www.python.org/dev/peps/pep-0530 PEP标题:PEP 530 -- Asynchronous Comprehensions PEP作者:Yu ...
- Java知识复习回顾
1.MVC 三层架构: M:Model 数据模型层 V:View 视图层 C:Controller控制器层 目的:解耦 2.Spring Spring:轻量级的Java开源框架,容器,目的是解决企业级 ...
- mock请求时出现中文乱码的解决
请求返回的乱码如图: 原mock代码如下 [ { "description":"这是我们的第一个mock例子", "request":{ & ...
- .jsp文件的使用和理解以及一些小练习和Listener监听器
什么是 jsp,它有什么用? jsp 的全换是 java server pages.Java 的服务器页面.jsp 的主要作用是代替 Servlet 程序回传 html 页面的数据.因为 Servle ...
- JVM G1GC的算法与实现
G1GC 是什么? 一些基本概念 实时性 G1GC 有什么特点? G1GC 的堆结构是什么样的? G1GC 的执行过程是什么样的? 并发标记 并发标记是什么 标记位图 执行步骤 步骤 1--初始标记阶 ...