Skip to content

Instantly share code, notes, and snippets.

@CowSmiles
Last active December 13, 2021 03:01
Show Gist options
  • Save CowSmiles/03d5e0c51ee1d96e6e67ac338076684d to your computer and use it in GitHub Desktop.
Save CowSmiles/03d5e0c51ee1d96e6e67ac338076684d to your computer and use it in GitHub Desktop.
为知笔记重构版多级标题编号
/** 从标题2开始编号的规则 **/
/** 标题多级编号 **/
.desktop-editor .editor-main .title-block {
counter-reset: nonTitleH1;
}
.desktop-editor .editor-heading-2 {
counter-reset: h2;
}
.desktop-editor .editor-heading-3 {
counter-reset: h3;
}
.desktop-editor .editor-heading-4 {
counter-reset: h4;
}
.desktop-editor .editor-heading-5 {
counter-reset: h5;
}
.desktop-editor .editor-heading-6 {
counter-reset: h6;
}
.desktop-editor .editor-heading-2 .editor-text-node::before {
counter-increment: nonTitleH1;
content: counter(nonTitleH1) ". ";
}
.desktop-editor .editor-heading-3 .editor-text-node::before {
counter-increment: h2;
content: counter(nonTitleH1) "." counter(h2) ". ";
}
.desktop-editor .editor-heading-4 .editor-text-node::before {
counter-increment: h3;
content: counter(nonTitleH1) "." counter(h2) "." counter(h3) ". ";
}
.desktop-editor .editor-heading-5 .editor-text-node::before {
counter-increment: h4;
content: counter(nonTitleH1) "." counter(h2) "." counter(h3) "." counter(h4) ". ";
}
.desktop-editor .editor-heading-6 .editor-text-node::before {
counter-increment: h5;
content: counter(nonTitleH1) "." counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) ". ";
}
.desktop-editor .editor-main .editor-block.table-block table {
padding: 0;
border-collapse: collapse;
border-spacing: 0;
font-size: 1em;
font: inherit;
border: 0;
margin: 0;
}
.desktop-editor .editor-main .editor-block.table-block table tbody {
margin: 0;
padding: 0;
border: 0;
}
.desktop-editor .editor-main .editor-block.table-block table table tr {
border: 0;
border-top: 1px solid #CCC;
background-color: white;
margin: 0;
padding: 0;
}
.desktop-editor .editor-main .editor-block.table-block table tr:nth-child(2n) {
background-color: #F8F8F8;
}
.desktop-editor .editor-main .editor-block.table-block table tr th,
.desktop-editor .editor-main .editor-block.table-block table tr td {
font-size: 16px;
border: 1px solid #CCC;
margin: 0;
padding: 5px 10px;
}
.desktop-editor .editor-main .root-container .editor-block.table-block table tr:first-of-type {
font-weight: bold;
color: #eee;
border: 1px solid #009688;
background-color: #009688 ;
}
.desktop-editor .editor-main .root-container .editor-block.table-block table tr:first-of-type .editor-block {
font-weight: bold;
color: #eee;
}
.desktop-editor .editor-main .root-container .editor-block.table-block .editor-block {
margin-top: 0.5em !important;
margin-bottom: 0.5em !important;
}
/**--- 大纲多级标题 --**/
.note-toc ul li ul {
counter-reset: H1;
}
.note-toc ul li ul li ul {
counter-reset: H2;
}
.note-toc ul li ul li ul li ul {
counter-reset: H3;
}
.note-toc ul li ul li ul li ul li ul {
counter-reset: H4;
}
.note-toc ul li ul li ul li ul li ul li ul {
counter-reset: H5;
}
.note-toc ul li ul li .MuiTypography-body2:before {
counter-increment: H1;
content: counter(H1) ". ";
}
.note-toc ul li ul li ul li .MuiTypography-body2:before {
counter-increment: H2;
content: counter(H1) "." counter(H2) ". ";
}
.note-toc ul li ul li ul li ul li .MuiTypography-body2:before {
counter-increment: H3;
content: counter(H1) "." counter(H2) "." counter(H3) ". ";
}
.note-toc ul li ul li ul li ul li ul li .MuiTypography-body2:before {
counter-increment: H4;
content: counter(H1) "." counter(H2) "." counter(H3) "." counter(H4) ". ";
}
.note-toc ul li ul li ul li ul li ul li ul li .MuiTypography-body2:before {
counter-increment: H5;
content: counter(H1) "." counter(H2) "." counter(H3) "." counter(H4) "." counter(H5) ". ";
}
/** 从标题1开始编号的规则 **/
/** 标题多级编号 **/
.desktop-editor .editor-main {
counter-reset: nonTitleH1;
}
.desktop-editor .editor-heading-1 {
counter-reset: h2;
}
.desktop-editor .editor-heading-2 {
counter-reset: h3;
}
.desktop-editor .editor-heading-3 {
counter-reset: h4;
}
.desktop-editor .editor-heading-4 {
counter-reset: h5;
}
.desktop-editor .editor-heading-1:not(.title-block) .editor-text-node::before {
counter-increment: nonTitleH1;
content: counter(nonTitleH1) ". ";
}
.desktop-editor .editor-heading-2 .editor-text-node::before {
counter-increment: h2;
content: counter(nonTitleH1) "." counter(h2) ". ";
}
.desktop-editor .editor-heading-3 .editor-text-node::before {
counter-increment: h3;
content: counter(nonTitleH1) "." counter(h2) "." counter(h3) ". ";
}
.desktop-editor .editor-heading-4 .editor-text-node::before {
counter-increment: h4;
content: counter(nonTitleH1) "." counter(h2) "." counter(h3) "." counter(h4) ". ";
}
.desktop-editor .editor-heading-5 .editor-text-node::before {
counter-increment: h5;
content: counter(nonTitleH1) "." counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) ". ";
}
.desktop-editor .editor-main .editor-block.table-block table {
padding: 0;
border-collapse: collapse;
border-spacing: 0;
font-size: 1em;
font: inherit;
border: 0;
margin: 0;
}
.desktop-editor .editor-main .editor-block.table-block table tbody {
margin: 0;
padding: 0;
border: 0;
}
.desktop-editor .editor-main .editor-block.table-block table table tr {
border: 0;
border-top: 1px solid #CCC;
background-color: white;
margin: 0;
padding: 0;
}
.desktop-editor .editor-main .editor-block.table-block table tr:nth-child(2n) {
background-color: #F8F8F8;
}
.desktop-editor .editor-main .editor-block.table-block table tr th,
.desktop-editor .editor-main .editor-block.table-block table tr td {
font-size: 16px;
border: 1px solid #CCC;
margin: 0;
padding: 5px 10px;
}
.desktop-editor .editor-main .root-container .editor-block.table-block table tr:first-of-type {
font-weight: bold;
color: #eee;
border: 1px solid #009688;
background-color: #009688 ;
}
.desktop-editor .editor-main .root-container .editor-block.table-block table tr:first-of-type .editor-block {
font-weight: bold;
color: #eee;
}
.desktop-editor .editor-main .root-container .editor-block.table-block .editor-block {
margin-top: 0.5em !important;
margin-bottom: 0.5em !important;
}
/**--- 大纲多级标题 --**/
.note-toc ul li ul {
counter-reset: H1;
}
.note-toc ul li ul li ul {
counter-reset: H2;
}
.note-toc ul li ul li ul li ul {
counter-reset: H3;
}
.note-toc ul li ul li ul li ul li ul {
counter-reset: H4;
}
.note-toc ul li ul li ul li ul li ul li ul {
counter-reset: H5;
}
.note-toc ul li ul li .MuiTypography-body2:before {
counter-increment: H1;
content: counter(H1) ". ";
}
.note-toc ul li ul li ul li .MuiTypography-body2:before {
counter-increment: H2;
content: counter(H1) "." counter(H2) ". ";
}
.note-toc ul li ul li ul li ul li .MuiTypography-body2:before {
counter-increment: H3;
content: counter(H1) "." counter(H2) "." counter(H3) ". ";
}
.note-toc ul li ul li ul li ul li ul li .MuiTypography-body2:before {
counter-increment: H4;
content: counter(H1) "." counter(H2) "." counter(H3) "." counter(H4) ". ";
}
.note-toc ul li ul li ul li ul li ul li ul li .MuiTypography-body2:before {
counter-increment: H5;
content: counter(H1) "." counter(H2) "." counter(H3) "." counter(H4) "." counter(H5) ". ";
}
@CowSmiles
Copy link
Author

CowSmiles commented Sep 29, 2021

适配v0.1.58

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment