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 静态代码块 静态方法区别一般情况下,如果有些代码必须在项目启动的时候就执行的时候,需要使用静态代码块,这种代码是主动执行的;需要在项目启动的时候就初始化,在不创建对象的情况下,其他程序 ...
随机推荐
- 用QT写的简单Todo记事本-附源码(浮动窗口)
去年边学边写了搞了很久, 已经好久没继续开发了, 先放出来供大家参考吧. 发现自己的学习能力还是不错的. 技术点: 使用QT, QML技术 代码参考: https://github.com/cnscu ...
- upload-lab 靶场实战
文件上传/下载 漏洞 冲冲冲,好好学习 2020.02.13 淦靶场之前,先来点知识铺垫铺垫. 文件上传漏洞 前端Js绕过. MIME类型绕过 后缀名大写写绕过 / php4 .php5 00截断 覆 ...
- Leetcode_丑数问题
1. 263. 丑数 给你一个整数 n ,请你判断 n 是否为 丑数 .如果是,返回 true :否则,返回 false . 丑数 就是只包含质因数 2.3 或 5 的正整数. 示例 1: 输入:n ...
- NDIS LWF:NdisFSendNetBufferLists蓝屏(DRIVER_IRQL_NOT_EQUAL_OR_LESS)
调用NdisFSendNetBufferLists发送自定义数据包后蓝屏,蓝屏代码为DRIVER_IRQL_NOT_EQUAL_OR_LESS,如果创建的NBL都没问题,一定要确保该自定义的NBL要在 ...
- 【Android面试查漏补缺】之事件分发机制详解
前言 查漏补缺,查漏补缺,你不知道哪里漏了,怎么补缺呢?本文属于[Android面试查漏补缺]系列文章第一篇,持续更新中,感兴趣的朋友可以[关注+收藏]哦~ 本系列文章是对自己的前段时间面试经历的总结 ...
- alpakka-kafka(7)-kafka应用案例,消费模式
上篇描述的kafka案例是个库存管理平台.是一个公共服务平台,为其它软件模块或第三方软件提供库存状态管理服务.当然,平台管理的目标必须是共享的,即库存是作为公共资源开放的.这个库存管理平台是一个Kaf ...
- 跟我一起写 Makefile(六)
书写命令 ---- 每条规则中的命令和操作系统Shell的命令行是一致的.make会一按顺序一条一条的执行命令,每条命令的开头必须以[Tab]键开头,除非,命令是紧跟在依赖规则后面的分号后的.在命令行 ...
- spring中的组合模式
org.springframework.cache.support.CompositeCacheManager /* * Copyright 2002-2016 the original author ...
- RPM包方式安装Oracle21c的方法
RPM包方式安装Oracle21c的方法 前言 北京时间2021.8.14 Oracle发布了最新的数据库版本Oracle21c, Oracle规划不再发布Oracle20c和Oracle22c, 直 ...
- 【vulapps】Sturcts2 S2-037RCE漏洞复现
一.漏洞基本信息 S2-037官方公告 CVE编号:CVE-2016-4438漏洞名称:Struts(S2-037)远程代码执行漏洞发布日期:2016.615受影响的软件及系统:Apache stru ...