essay.css
/* page-break: Firefox, Chrome, 以及 Safari 不支持属性值 "avoid". */
body{
    /* border:1px solid black; for debug */
    padding:0 !important;
    margin:0 !important;
}
/* 正文区基本属性 */
#write {
   font-family:宋体;
   font-size:12pt;
   max-width: 21cm; /*A4标准宽度*/
   border:1px solid #CCC ; /* 添加一个淡灰色的边框 */
}
/*页边距处理*/
@media screen{
    #write{
       padding:2.54cm 3.18cm; 
    }
}
@media print{
    #write{
       padding:0 3.18cm !important; 
       margin:0 !important;
    }
}
@page{
	margin:2.54cm 0; /*上下/左右 边距，参考了word的默认边距*/
}


#write p{
	text-align:justify;
}
h1,h2,h3,h4,h5,h6 {
	font-weight:bold;
	@media print{
    page-break-after:avoid !important;
	}
}
/*引言*/
blockquote{
	font-family:楷体;
	/* border-left:3px solid black; */
	padding-left:10px;
	/*color:grey;*/
}
/* 标题属性 */
h1 {
	text-align:center;
    font-size:18pt;
    /*page-break-before:always!important;*/
}
h2 {
	font-family:仿宋;
	text-align:center;
	font-size:16pt;
}
h3 {
	font-family:黑体;
	font-size:14pt;
}
h4 {
	text-align:center;
	font-family:楷体;
	font-size:14pt;
}
/* 目录标题属性 */
.md-toc-h2 {
	font-family:仿宋;
}
.md-toc-h3 {
	font-family:黑体;
}
.md-toc-h4 {
	font-family:楷体;
}
/* 三线表 */
#write table{
	border-top: 1.5pt solid;
	border-bottom: 1.5pt solid;
	font-family:宋体;
	/*font-size:7.875pt;*/
	font-size:10.5pt;
	text-align:center;
    page-break-inside:avoid!important;
}
#write table td{
	padding:2px;
}
#write table tr{
	/* padding:3px; */
}
#write thead{
	border-bottom: 0.75pt solid;
	font-family:黑体;
	font-size:10.5pt;
}
/* @media print{
	img{
        page-break-inside:avoid !important;
        break-inside: avoid !important;
	}
} */
img{
    page-break-inside:avoid !important;
    break-inside: avoid !important;
}


/* 引用和尾注 */
sup.md-footnote{
    background-color: transparent;
    padding:0;
}
sup.md-footnote>a::before{
    content:'[';
}
sup.md-footnote>a::after{
    content:']';
}


div.footnotes-area{
    font-family:宋体;
    font-size:12pt !important;
    color: black;
    page-break-inside:avoid!important;
}
div.footnotes-area::before{
/*     content: "参考文献"; */
	text-align:center;
	width:100%;
    display:inline-block;
    font-size:16pt;
    font-family: 仿宋;
    font-weight: bold;
}
div.footnotes-area>hr{
    display:none;
}
div.footnote-line{
    font-family:宋体;
    font-size:10.5pt !important;
    color: black;     
    margin-top: 0;
}
span.md-fn-count::before{
    content:'[';
}
span.md-fn-count::after{
    content:']';
}
/* 以下开始为自动编号 */
#write{
    counter-reset: tableHead imgHead write-h2 write-h3 write-h4!important;/*修复缺失上级标题时无法递增*/
}
/* 编辑器内标题-重置 */
#write h1 {
    counter-reset: write-h2;
}
#write h2 {
    counter-reset: write-h3;
}
#write h3 {
    counter-reset: write-h4;
}
/* 表格自动编号 */
#write figure:after{
	counter-increment: tableHead;
	content: "表" counter(tableHead) " ";
	text-align:center;
	width:100%;
	display:inline-block;
}
/* 图片自动编号，导出PDF时暂时无法显示 */
#write .md-image:after{
	counter-increment: imgHead;
	content: "图" counter(imgHead) attr(alt) " " !important;
	text-align:center;
	width:100%;
	display:inline-block;
}
/* 编辑器内标题-显示 */
#write h2:before {
    counter-increment: write-h2;
    content: counter(write-h2, cjk-ideographic) "、";
}
#write h3:before {
    counter-increment: write-h3;
    content: "（" counter(write-h3, cjk-ideographic) "）";
}
#write h4:before {
    counter-increment: write-h4;
    content: counter(write-h4, decimal) ". ";
}
/* 目录标题-重置 */
.md-toc-content{
    margin-left: 8em;
    counter-reset: toc-h2 toc-h3 toc-h4 ;/*修复缺失上级标题时无法递增*/
    page-break-after: always;
}
.md-toc::before{
    content: "目录";
    font-family:仿宋;
	text-align:center;
    font-size:18pt;
    display:inline-block;
    font-weight: bold;
    width: 100%;
}
.md-toc-inner{
    margin-left:0 !important;
    color:black !important;
}
.md-toc-item{
    color:black !important;
    font-size: 11pt;
    font-family: "宋体";
}
.md-toc-content .md-toc-h1 {
    counter-reset: toc-h2;
}
.md-toc-content .md-toc-h2 {
    counter-reset: toc-h3;
}
.md-toc-content .md-toc-h3 {
    counter-reset: toc-h4;
}
.md-toc-content .md-toc-h4 {
    display: none;
}
.md-toc-content .md-toc-h5 {
    display: none;
}
/* 目录标题-显示*/
.md-toc-content .md-toc-h2:before {
    counter-increment: toc-h2;
    content: counter(toc-h2, cjk-ideographic) "、";
}
.md-toc-content .md-toc-h3:before {
    counter-increment: toc-h3;
    content: "（" counter(toc-h3, cjk-ideographic) "）";
}
.md-toc-content .md-toc-h4:before {
    counter-increment: toc-h4;
    content: counter(toc-h4, decimal) ". ";
}
/* 大纲标题 -重置*/
.sidebar-content{
    counter-reset: outline-h2 outline-h3 outline-h4;/*修复缺失上级标题时无法递增*/
}
.sidebar-content .outline-h1 {
    counter-reset: outline-h2;
}
.sidebar-content .outline-h2 {
    counter-reset: outline-h3;
}
.sidebar-content .outline-h3 {
    counter-reset: outline-h4;
}
/* 大纲标题 -显示*/
.sidebar-content .outline-h2 .outline-label:before {
    counter-increment: outline-h2;
    content: counter(outline-h2, cjk-ideographic) "、";
}
.sidebar-content .outline-h3 .outline-label:before {
    counter-increment: outline-h3;
    content: "（" counter(outline-h3, cjk-ideographic) "）";
}
.sidebar-content .outline-h4 .outline-label:before {
    counter-increment: outline-h4;
    content: counter(outline-h4, decimal) ". ";
}

/* 代码块样式 */
/*基准样式来自 https://support.typora.io/Code-Block-Styles/ */
code{/* 行内代码 */
    font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace;
}
/*.cm-s-inner .CodeMirror-matchingbracket {
  text-decoration: underline;
  font-weight:bold;
}*/

/**apply to code fences with plan text**/
.md-fences .code-tooltip {
  background-color: white;
}
.cm-s-inner {
    background-color: white;
    color: black;
    border-top: solid 1.5pt black;
    border-bottom: solid 1.5pt black;
    font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace;
    font-size: 10pt;
    padding: 5pt;
}
/*.cm-s-inner .CodeMirror-gutters {
   background: black;
  color: rgb(83,127,126);
  border: none; 
}*/

/* 与用户操作相关，如光标，选中区域等 */

.cm-s-inner .CodeMirror-guttermarker, .cm-s-inner .CodeMirror-guttermarker-subtle, .cm-s-inner .CodeMirror-linenumber 
{ color: black; }/* 行号 */
.cm-s-inner .CodeMirror-cursor { border-left: 1px solid black; } /* 光标 */

/* 选中 */
.cm-s-inner div.CodeMirror-selected { background: rgba(255, 255, 255, 0.15); }
.cm-s-inner.CodeMirror-focused div.CodeMirror-selected { background: rgba(255, 255, 255, 0.10); }
.cm-s-inner .CodeMirror-line::selection, .cm-s-inner .CodeMirror-line > span::selection, .cm-s-inner .CodeMirror-line > span > span::selection 
{ background: rgba(255, 255, 255, 0.10); }
.cm-s-inner .CodeMirror-line::-moz-selection, .cm-s-inner .CodeMirror-line > span::-moz-selection, .cm-s-inner .CodeMirror-line > span > span::-moz-selection 
{ background: rgba(255, 255, 255, 0.10); }

/* .cm-s-inner .CodeMirror-activeline-background { background: rgba(255, 255, 255, 0.10); }/* 高亮当前行 */ 
.cm-s-inner .cm-keyword { color: black; font-weight: bold;}/* 语言关键字 */
.cm-s-inner .cm-operator { color: black; font-weight:bold;} /* 语言操作符 */
.cm-s-inner .cm-variable { color: black; font-style: italic;} /* 变量 */
.cm-s-inner .cm-variable-2 { color: black; /*font-style: italic;*/ }
.cm-s-inner .cm-variable-3 { color: black; font-weight: bold;}/* 语言内置类型 */
.cm-s-inner .cm-builtin { color: black; }
.cm-s-inner .cm-number { color: black; }/* 数字 */
.cm-s-inner .cm-def { color: black; }/*函数定义*/
.cm-s-inner .cm-string { color: gray; font-weight:bold }/* 字符串 */
.cm-s-inner .cm-string-2 { color: gray; font-weight:bold }/* 字符串 */
.cm-s-inner .cm-comment { color: gray; }/* 注释 */
.cm-s-inner .cm-meta { color: black; }/* 头文件，宏定义等*/
/* HTML 相关 */
.cm-s-inner .cm-tag { color: black; font-weight: bold;}/* HTML 标签 */
.cm-s-inner .cm-attribute { color: black; }
.cm-s-inner .cm-property { color: black; font-style: italic;}/*CSS属性名称*/
.cm-s-inner .cm-atom { color: black; }/*CSS属性值*/
.cm-s-inner .cm-qualifier { color: black; font-weight:bold;}/*css选择器等*/
.cm-s-inner .cm-error {
  color: rgba(255, 255, 255, 1.0);
  background-color: red;
}

/* override the default style for focused headings */
#write>h3.md-focus:before,
#write>h4.md-focus:before,
#write>h5.md-focus:before,
#write>h6.md-focus:before,
h3.md-focus:before,
h4.md-focus:before,
h5.md-focus:before,
h6.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;
}
