吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 456|回复: 0
收起左侧

[求助] MarkDown的样式bug求救!!!

[复制链接]
sspg62 发表于 2022-8-26 18:06
大佬们,本人想修改下Mybase中MarkDown的样式,让标题能够主动加编号,有没大佬帮忙看一下样式有什么问题,请求帮忙调整一下。
一、环境
1.Mybase笔记:V7.3.5
二、希望的效果

1.标题1
   1.1 标题XXX
   1.2 标题XXX
       1.2.1 标题XXX
       1.2.2 标题XXX
2.标题XXX
3.标题XXX

三、使用说明
目前我一般用Mybase整理比较的时候采用外部打开MK文档(Typora)进行快速编辑并保存。外部软件我解决了这个样式了(网上找的),整合到Mybase就搞不了
三、代码:

[CSS] 纯文本查看 复制代码

pre {
	--select-text-bg-color: #36284e;
	--select-text-font-color: #fff;
}

html {
	font-size: 16px;
	-webkit-font-smoothing: antialiased;
}

html, body {
	background-color: #f3f2ee;
	font-family: Microsoft YaHei;
	color: #1f0909;
	line-height: 1.5em;
}


#write {
	max-width: 40em;
}
[url=home.php?mod=space&uid=945662]@media[/url] only screen and (min-width: 1000px) {
	#write {max-width: 960px;}
}


@media only screen and (min-width: 1400px) {
	#write {max-width: 1080px;}
}

@media only screen and (min-width: 1900px) {
	#write {max-width: 1180px;}
}

ol li {
	list-style-type: decimal;
	list-style-position: outside;
}
ul li {
	list-style-type: disc;
	list-style-position: outside;
}

ol,
ul {
	list-style: none;
}

blockquote,
q {
	quotes: none;
}
blockquote:before,
blockquote:after,
q:before,
q:after {
	content: '';
	content: none;
}
table {
	border-collapse: collapse;
	border-spacing: 0;
}


h1,
h2,
h3,
h4,
h5,
h6 {
	font-family: Microsoft YaHei;
	padding-bottom: 0.3em;
	border-bottom: 1px solid #d8dee4;
	font-weight: bold;
	margin-bottom: 1.5em;
}
h1 {
	font-size: 30px;
	/*30 / 16*/
	line-height: 1.6em;
	/* 48 / 30*/
	margin-top: 2em;
}
h2{
	font-size: 25px;
	line-height: 1.15;
	/*24 / 21*/
	margin-top: 2.285714em;
	/*48 / 21*/
	margin-bottom: 1.15em;
	/*24 / 21*/
}
h3 {
	font-size: 20px;
	/*21 / 16*/
	line-height: 1.15;
	/*24 / 21*/
	margin-top: 2.285714em;
	/*48 / 21*/
	margin-bottom: 1.15em;
	/*24 / 21*/
}

h4 {
	font-size: 16px;
	/*18 / 16*/
	margin-top: 2.67em;
	/*48 / 18*/
}















/* 首先在父元素中(在这里是类markdown-body的元素),初始化你想要编号的最大标题的计数。我喜欢从h2开始编号,所以我就写h2,你也可以写h1。 */


#write {
  counter-reset: h2;
}

/* 然后父标题初始化子标题的计数,下面以此类推。 */
h1 {
  counter-reset: h2;
}

h2 {
  counter-reset: h3;
}

h3 {
  counter-reset: h4;
}

h4 {
  counter-reset: h5;
}

h5 {
  counter-reset: h6;
}


/* 接着在每个标题前面自动加上编号 */
h2:before {
    counter-increment: h2;
    content: counter(h2) ". ";
}

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

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

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

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




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

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

.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) ". ";
}




发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-11-25 06:41

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表