├── a.jpg ├── README.md ├── report-essay.css ├── report-markdown.css ├── paper-markdown.css └── README.html /a.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AndSonder/report-typora-theme/HEAD/a.jpg -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # report-typora-theme 2 | 3 | 我们一种有两种主题: 4 | 5 | 1. 写报告专用的report-markdown.css 6 | 2. 写小论文/大作业文档专用的paper-markdown.css 7 | 8 | 9 | 10 |  11 | 12 | ## 如何使用? 13 | 14 | 搭配typora即可轻松使用该主题: 15 | 16 | 可参见[Typora官方主题文档](http://support.typora.io/About-Themes/) 17 | 18 | 太长不看版: 19 | 20 | 1. 打开Typora 21 | 2. 菜单栏“文件”选项卡-偏好设置(Ctrl +,) 22 | 3. 外观-主题-打开主题文件夹themes 23 | 4. 将下载的report-markdown.css文件放入此文件夹 24 | 5. 重启Typora,打开xxx.md文件 25 | 6. 菜单栏“主题”选项卡: Report Markdown 26 | 27 | ## 样式展示 28 | 29 | ### 自动编号 30 | 31 | 改模版根据传统实验报告的编号需求进行了编号 32 | 33 |  34 | 35 | ### 代码块优化 36 | 37 | 如果是计算机专业的同学可以用这个代码块,这个代码块的样式打印出来也是不错滴。 38 | 39 |  40 | 41 | ## 如何导出为pdf 42 | 43 | 使用typora自带的导出为pdf可能会出现一些奇怪的问题,所以我推荐先到处为html然后使用Chrome打开,使用Chrome自带的打印功能去导出为PDF格式。 44 | 45 |  46 | 47 | 48 | 49 | 接下来使用Chrome自带的导出(Ctrl/Commond+P)上下边距调整为25.5mm就可以导出一个完美的报告啦! 50 | 51 |  52 | 53 | ## 声明 54 | 55 | 该代码的代码在[该仓库](https://github.com/du33169/typora-theme-essay_cn)的记录上进行修改,并非100%本人完成,模版只是自用。希望给各位苦逼的报告人节省一些时间。 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /report-essay.css: -------------------------------------------------------------------------------- 1 | /* page-break: Firefox, Chrome, 以及 Safari 不支持属性值 "avoid". */ 2 | body{ 3 | /* border:1px solid black; for debug */ 4 | padding:0 !important; 5 | margin:0 !important; 6 | } 7 | /* 正文区基本属性 */ 8 | #write { 9 | font-family:宋体; 10 | font-size:12pt; 11 | max-width: 21cm; /*A4标准宽度*/ 12 | border:1px solid #CCC ; /* 添加一个淡灰色的边框 */ 13 | } 14 | /*页边距处理*/ 15 | @media screen{ 16 | #write{ 17 | padding:0cm 3.18cm; 18 | } 19 | } 20 | 21 | @media print{ 22 | #write{ 23 | padding:0 3.18cm !important; 24 | margin:0 !important; 25 | } 26 | } 27 | 28 | @page{ 29 | margin:2.5cm 0; /*上下/左右 边距,参考了word的默认边距*/ 30 | } 31 | 32 | 33 | #write p{ 34 | text-align:justify; 35 | } 36 | h1,h2,h3,h4,h5,h6 { 37 | font-weight:bold; 38 | @media print{ 39 | page-break-after:avoid !important; 40 | } 41 | } 42 | /*引言*/ 43 | blockquote{ 44 | font-family:楷体; 45 | /* border-left:3px solid black; */ 46 | padding-left:10px; 47 | /*color:grey;*/ 48 | } 49 | /* 标题属性 */ 50 | h1 { 51 | text-align:center; 52 | font-size:18pt; 53 | /*page-break-before:always!important;*/ 54 | } 55 | h2 { 56 | font-family:仿宋; 57 | /*text-align:center;*/ 58 | font-size:16pt; 59 | } 60 | h3 { 61 | font-family:黑体; 62 | font-size:14pt; 63 | } 64 | h4 { 65 | /*text-align:center;*/ 66 | font-family:楷体; 67 | font-size:14pt; 68 | } 69 | /* 目录标题属性 */ 70 | .md-toc-h2 { 71 | font-family:仿宋; 72 | } 73 | .md-toc-h3 { 74 | font-family:黑体; 75 | } 76 | .md-toc-h4 { 77 | font-family:楷体; 78 | } 79 | /* 三线表 */ 80 | #write table{ 81 | border-top: 1.5pt solid; 82 | border-bottom: 1.5pt solid; 83 | font-family:宋体; 84 | /*font-size:7.875pt;*/ 85 | font-size:10.5pt; 86 | text-align:center; 87 | page-break-inside:avoid!important; 88 | } 89 | #write table td{ 90 | padding:2px; 91 | } 92 | #write table tr{ 93 | /* padding:3px; */ 94 | } 95 | #write thead{ 96 | border-bottom: 0.75pt solid; 97 | font-family:黑体; 98 | font-size:10.5pt; 99 | } 100 | 101 | /* @media print{ 102 | img{ 103 | page-break-inside:avoid !important; 104 | break-inside: avoid !important; 105 | } 106 | } */ 107 | img{ 108 | page-break-inside:avoid !important; 109 | break-inside: avoid !important; 110 | } 111 | 112 | 113 | /* 引用和尾注 */ 114 | sup.md-footnote{ 115 | background-color: transparent; 116 | padding:0; 117 | } 118 | sup.md-footnote>a::before{ 119 | content:'['; 120 | } 121 | sup.md-footnote>a::after{ 122 | content:']'; 123 | } 124 | 125 | 126 | div.footnotes-area{ 127 | font-family:宋体; 128 | font-size:12pt !important; 129 | color: black; 130 | page-break-inside:avoid!important; 131 | } 132 | div.footnotes-area::before{ 133 | /* content: "参考文献"; */ 134 | text-align:center; 135 | width:100%; 136 | display:inline-block; 137 | font-size:16pt; 138 | font-family: 仿宋; 139 | font-weight: bold; 140 | } 141 | div.footnotes-area>hr{ 142 | display:none; 143 | } 144 | div.footnote-line{ 145 | font-family:宋体; 146 | font-size:10.5pt !important; 147 | color: black; 148 | margin-top: 0; 149 | } 150 | span.md-fn-count::before{ 151 | content:'['; 152 | } 153 | span.md-fn-count::after{ 154 | content:']'; 155 | } 156 | 157 | 158 | 159 | /* 以下开始为自动编号 */ 160 | #write{ 161 | counter-reset: tableHead imgHead write-h2 write-h3 write-h4!important;/*修复缺失上级标题时无法递增*/ 162 | } 163 | /* 编辑器内标题-重置 */ 164 | #write h1 { 165 | counter-reset: write-h2; 166 | } 167 | #write h2 { 168 | counter-reset: write-h3; 169 | } 170 | #write h3 { 171 | counter-reset: write-h4; 172 | } 173 | /* 表格自动编号 */ 174 | /*#write figure:after{ 175 | counter-increment: tableHead; 176 | content: "表" counter(tableHead) " "; 177 | text-align:center; 178 | width:100%; 179 | display:inline-block; 180 | }*/ 181 | /* 图片自动编号,导出PDF时暂时无法显示 */ 182 | /*#write .md-image:after{ 183 | counter-increment: imgHead; 184 | content: "图" counter(imgHead) attr(alt) " " !important; 185 | text-align:center; 186 | width:100%; 187 | display:inline-block; 188 | }*/ 189 | /* 编辑器内标题-显示 */ 190 | #write h2:before { 191 | counter-increment: write-h2; 192 | content: counter(write-h2, cjk-ideographic) "、"; 193 | } 194 | #write h3:before { 195 | counter-increment: write-h3; 196 | content: "(" counter(write-h3, cjk-ideographic) ")"; 197 | } 198 | #write h4:before { 199 | counter-increment: write-h4; 200 | content: counter(write-h4, decimal) ". "; 201 | } 202 | /* 目录标题-重置 */ 203 | .md-toc-content{ 204 | margin-left: 8em; 205 | counter-reset: toc-h2 toc-h3 toc-h4 ;/*修复缺失上级标题时无法递增*/ 206 | page-break-after: always; 207 | } 208 | .md-toc::before{ 209 | content: "目录"; 210 | font-family:仿宋; 211 | text-align:center; 212 | font-size:18pt; 213 | display:inline-block; 214 | font-weight: bold; 215 | width: 100%; 216 | } 217 | .md-toc-inner{ 218 | margin-left:0 !important; 219 | color:black !important; 220 | } 221 | .md-toc-item{ 222 | color:black !important; 223 | font-size: 11pt; 224 | font-family: "宋体"; 225 | } 226 | .md-toc-content .md-toc-h1 { 227 | counter-reset: toc-h2; 228 | } 229 | .md-toc-content .md-toc-h2 { 230 | counter-reset: toc-h3; 231 | } 232 | .md-toc-content .md-toc-h3 { 233 | counter-reset: toc-h4; 234 | } 235 | .md-toc-content .md-toc-h4 { 236 | display: none; 237 | } 238 | .md-toc-content .md-toc-h5 { 239 | display: none; 240 | } 241 | /* 目录标题-显示*/ 242 | .md-toc-content .md-toc-h2:before { 243 | counter-increment: toc-h2; 244 | content: counter(toc-h2, cjk-ideographic) "、"; 245 | } 246 | .md-toc-content .md-toc-h3:before { 247 | counter-increment: toc-h3; 248 | content: "(" counter(toc-h3, cjk-ideographic) ")"; 249 | } 250 | .md-toc-content .md-toc-h4:before { 251 | counter-increment: toc-h4; 252 | content: counter(toc-h4, decimal) ". "; 253 | } 254 | /* 大纲标题 -重置*/ 255 | .sidebar-content{ 256 | counter-reset: outline-h2 outline-h3 outline-h4;/*修复缺失上级标题时无法递增*/ 257 | } 258 | .sidebar-content .outline-h1 { 259 | counter-reset: outline-h2; 260 | } 261 | .sidebar-content .outline-h2 { 262 | counter-reset: outline-h3; 263 | } 264 | .sidebar-content .outline-h3 { 265 | counter-reset: outline-h4; 266 | } 267 | /* 大纲标题 -显示*/ 268 | .sidebar-content .outline-h2 .outline-label:before { 269 | counter-increment: outline-h2; 270 | content: counter(outline-h2, cjk-ideographic) "、"; 271 | } 272 | .sidebar-content .outline-h3 .outline-label:before { 273 | counter-increment: outline-h3; 274 | content: "(" counter(outline-h3, cjk-ideographic) ")"; 275 | } 276 | .sidebar-content .outline-h4 .outline-label:before { 277 | counter-increment: outline-h4; 278 | content: counter(outline-h4, decimal) ". "; 279 | } 280 | 281 | /* 代码块样式 */ 282 | /*基准样式来自 https://support.typora.io/Code-Block-Styles/ */ 283 | code{/* 行内代码 */ 284 | font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace; 285 | padding: 2px 4px; 286 | border-radius: 2px; 287 | font-size: 90%; 288 | color: #000000; 289 | background-color: #f8f8f8; 290 | } 291 | /*.cm-s-inner .CodeMirror-matchingbracket { 292 | text-decoration: underline; 293 | font-weight:bold; 294 | }*/ 295 | 296 | /**apply to code fences with plan text**/ 297 | .md-fences .code-tooltip { 298 | background-color: white; 299 | } 300 | .cm-s-inner { 301 | background-color: white; 302 | color: black; 303 | border-top: solid 1.5pt black; 304 | border-bottom: solid 1.5pt black; 305 | /*font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace;*/ 306 | font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace; 307 | font-size: 10pt; 308 | padding: 5pt; 309 | } 310 | /*.cm-s-inner .CodeMirror-gutters { 311 | background: black; 312 | color: rgb(83,127,126); 313 | border: none; 314 | }*/ 315 | 316 | /* 与用户操作相关,如光标,选中区域等 */ 317 | 318 | .cm-s-inner .CodeMirror-guttermarker, .cm-s-inner .CodeMirror-guttermarker-subtle, .cm-s-inner .CodeMirror-linenumber 319 | { color: black; }/* 行号 */ 320 | .cm-s-inner .CodeMirror-cursor { border-left: 1px solid black; } /* 光标 */ 321 | 322 | /* 选中 */ 323 | .cm-s-inner div.CodeMirror-selected { background: rgba(255, 255, 255, 0.15); } 324 | .cm-s-inner.CodeMirror-focused div.CodeMirror-selected { background: rgba(255, 255, 255, 0.10); } 325 | .cm-s-inner .CodeMirror-line::selection, .cm-s-inner .CodeMirror-line > span::selection, .cm-s-inner .CodeMirror-line > span > span::selection 326 | { background: rgba(255, 255, 255, 0.10); } 327 | .cm-s-inner .CodeMirror-line::-moz-selection, .cm-s-inner .CodeMirror-line > span::-moz-selection, .cm-s-inner .CodeMirror-line > span > span::-moz-selection 328 | { background: rgba(255, 255, 255, 0.10); } 329 | 330 | /* .cm-s-inner .CodeMirror-activeline-background { background: rgba(255, 255, 255, 0.10); }/* 高亮当前行 */ 331 | .cm-s-inner .cm-keyword { color: black; font-weight: bold;}/* 语言关键字 */ 332 | .cm-s-inner .cm-operator { color: black; } /* 语言操作符 */ 333 | .cm-s-inner .cm-variable { color: black;} /* 变量 */ 334 | .cm-s-inner .cm-variable-2 { color: black; /*font-style: italic;*/ } 335 | .cm-s-inner .cm-variable-3 { color: black; font-weight: bold;}/* 语言内置类型 */ 336 | .cm-s-inner .cm-builtin { color: black; } 337 | .cm-s-inner .cm-number { color: black; }/* 数字 */ 338 | .cm-s-inner .cm-def { color: black; }/*函数定义*/ 339 | .cm-s-inner .cm-string { color: gray; font-weight:bold }/* 字符串 */ 340 | .cm-s-inner .cm-string-2 { color: gray; font-weight:bold }/* 字符串 */ 341 | .cm-s-inner .cm-comment { color: gray; font-style: italic;}/* 注释 */ 342 | .cm-s-inner .cm-meta { color: black; }/* 头文件,宏定义等*/ 343 | /* HTML 相关 */ 344 | .cm-s-inner .cm-tag { color: black; font-weight: bold;}/* HTML 标签 */ 345 | .cm-s-inner .cm-attribute { color: black; } 346 | .cm-s-inner .cm-property { color: black; }/*CSS属性名称*/ 347 | .cm-s-inner .cm-atom { color: black; }/*CSS属性值*/ 348 | .cm-s-inner .cm-qualifier { color: black; font-weight:bold;}/*css选择器等*/ 349 | .cm-s-inner .cm-error { 350 | color: rgba(255, 255, 255, 1.0); 351 | background-color: red; 352 | } 353 | 354 | /* override the default style for focused headings */ 355 | #write>h3.md-focus:before, 356 | #write>h4.md-focus:before, 357 | #write>h5.md-focus:before, 358 | #write>h6.md-focus:before, 359 | h3.md-focus:before, 360 | h4.md-focus:before, 361 | h5.md-focus:before, 362 | h6.md-focus:before { 363 | color: inherit; 364 | border: inherit; 365 | border-radius: inherit; 366 | position: inherit; 367 | left:initial; 368 | float: none; 369 | top:initial; 370 | font-size: inherit; 371 | padding-left: inherit; 372 | padding-right: inherit; 373 | vertical-align: inherit; 374 | font-weight: inherit; 375 | line-height: inherit; 376 | } 377 | 378 | 379 | 380 | 381 | -------------------------------------------------------------------------------- /report-markdown.css: -------------------------------------------------------------------------------- 1 | /* page-break: Firefox, Chrome, 以及 Safari 不支持属性值 "avoid". */ 2 | body{ 3 | /* border:1px solid black; for debug */ 4 | padding:0 !important; 5 | margin:0 !important; 6 | } 7 | /* 正文区基本属性 */ 8 | #write { 9 | font-family:"Times New Roman", 宋体; 10 | font-size:12pt; 11 | max-width: 21cm; /*A4标准宽度*/ 12 | border:1px solid #CCC ; /* 添加一个淡灰色的边框 */ 13 | /*box-shadow: 0 0 5px 5px #CCC;*/ 14 | } 15 | /*页边距处理*/ 16 | @media screen{ 17 | #write{ 18 | padding:0cm 3.18cm; 19 | } 20 | } 21 | 22 | @media print{ 23 | #write{ 24 | padding:0 3.18cm !important; 25 | margin:0 !important; 26 | } 27 | } 28 | 29 | @page{ 30 | margin:2.5cm 0; /*上下/左右 边距,参考了word的默认边距*/ 31 | } 32 | 33 | 34 | #write p{ 35 | text-align:justify; 36 | } 37 | h1,h2,h3,h4,h5,h6 { 38 | font-weight:bold; 39 | @media print{ 40 | page-break-after:avoid !important; 41 | } 42 | } 43 | /*引言*/ 44 | blockquote{ 45 | font-family:楷体; 46 | /* border-left:3px solid black; */ 47 | padding-left:10px; 48 | /*color:grey;*/ 49 | } 50 | /* 标题属性 */ 51 | h1 { 52 | text-align:center; 53 | font-size:18pt; 54 | /*page-break-before:always!important;*/ 55 | } 56 | h2 { 57 | font-family:仿宋; 58 | /*text-align:center;*/ 59 | font-size:16pt; 60 | } 61 | h3 { 62 | font-family:黑体; 63 | font-size:14pt; 64 | } 65 | h4 { 66 | /*text-align:center;*/ 67 | font-family:楷体; 68 | font-size:14pt; 69 | } 70 | /* 目录标题属性 */ 71 | .md-toc-h2 { 72 | font-family:仿宋; 73 | } 74 | .md-toc-h3 { 75 | font-family:黑体; 76 | } 77 | .md-toc-h4 { 78 | font-family:楷体; 79 | } 80 | /* 三线表 */ 81 | #write table{ 82 | border-top: 1.5pt solid; 83 | border-bottom: 1.5pt solid; 84 | font-family:宋体; 85 | /*font-size:7.875pt;*/ 86 | font-size:10.5pt; 87 | text-align:center; 88 | page-break-inside:avoid!important; 89 | } 90 | #write table td{ 91 | padding:2px; 92 | } 93 | #write table tr{ 94 | /* padding:3px; */ 95 | } 96 | #write thead{ 97 | border-bottom: 0.75pt solid; 98 | font-family:黑体; 99 | font-size:10.5pt; 100 | } 101 | 102 | /* @media print{ 103 | img{ 104 | page-break-inside:avoid !important; 105 | break-inside: avoid !important; 106 | } 107 | } */ 108 | img{ 109 | page-break-inside:avoid !important; 110 | break-inside: avoid !important; 111 | } 112 | 113 | 114 | /* 引用和尾注 */ 115 | sup.md-footnote{ 116 | background-color: transparent; 117 | padding:0; 118 | } 119 | sup.md-footnote>a::before{ 120 | content:'['; 121 | } 122 | sup.md-footnote>a::after{ 123 | content:']'; 124 | } 125 | 126 | 127 | div.footnotes-area{ 128 | font-family:宋体; 129 | font-size:12pt !important; 130 | color: black; 131 | page-break-inside:avoid!important; 132 | } 133 | div.footnotes-area::before{ 134 | /* content: "参考文献"; */ 135 | text-align:center; 136 | width:100%; 137 | display:inline-block; 138 | font-size:16pt; 139 | font-family: 仿宋; 140 | font-weight: bold; 141 | } 142 | div.footnotes-area>hr{ 143 | display:none; 144 | } 145 | div.footnote-line{ 146 | font-family:宋体; 147 | font-size:10.5pt !important; 148 | color: black; 149 | margin-top: 0; 150 | } 151 | span.md-fn-count::before{ 152 | content:'['; 153 | } 154 | span.md-fn-count::after{ 155 | content:']'; 156 | } 157 | 158 | 159 | 160 | /* 以下开始为自动编号 */ 161 | #write{ 162 | counter-reset: tableHead imgHead write-h2 write-h3 write-h4!important;/*修复缺失上级标题时无法递增*/ 163 | } 164 | /* 编辑器内标题-重置 */ 165 | #write h1 { 166 | counter-reset: write-h2; 167 | } 168 | #write h2 { 169 | counter-reset: write-h3; 170 | } 171 | #write h3 { 172 | counter-reset: write-h4; 173 | } 174 | /* 表格自动编号 */ 175 | /*#write figure:after{ 176 | counter-increment: tableHead; 177 | content: "表" counter(tableHead) " "; 178 | text-align:center; 179 | width:100%; 180 | display:inline-block; 181 | }*/ 182 | /* 图片自动编号,导出PDF时暂时无法显示 */ 183 | /*#write .md-image:after{ 184 | counter-increment: imgHead; 185 | content: "图" counter(imgHead) attr(alt) " " !important; 186 | text-align:center; 187 | width:100%; 188 | display:inline-block; 189 | }*/ 190 | /* 编辑器内标题-显示 */ 191 | #write h2:before { 192 | counter-increment: write-h2; 193 | content: counter(write-h2, cjk-ideographic) "、"; 194 | } 195 | #write h3:before { 196 | counter-increment: write-h3; 197 | content: "(" counter(write-h3, cjk-ideographic) ")"; 198 | } 199 | #write h4:before { 200 | counter-increment: write-h4; 201 | content: counter(write-h4, decimal) ". "; 202 | } 203 | /* 目录标题-重置 */ 204 | .md-toc-content{ 205 | margin-left: 8em; 206 | counter-reset: toc-h2 toc-h3 toc-h4 ;/*修复缺失上级标题时无法递增*/ 207 | page-break-after: always; 208 | } 209 | .md-toc::before{ 210 | content: "目录"; 211 | font-family:仿宋; 212 | text-align:center; 213 | font-size:18pt; 214 | display:inline-block; 215 | font-weight: bold; 216 | width: 100%; 217 | } 218 | .md-toc-inner{ 219 | margin-left:0 !important; 220 | color:black !important; 221 | } 222 | .md-toc-item{ 223 | color:black !important; 224 | font-size: 11pt; 225 | font-family: "宋体"; 226 | } 227 | .md-toc-content .md-toc-h1 { 228 | counter-reset: toc-h2; 229 | } 230 | .md-toc-content .md-toc-h2 { 231 | counter-reset: toc-h3; 232 | } 233 | .md-toc-content .md-toc-h3 { 234 | counter-reset: toc-h4; 235 | } 236 | .md-toc-content .md-toc-h4 { 237 | display: none; 238 | } 239 | .md-toc-content .md-toc-h5 { 240 | display: none; 241 | } 242 | /* 目录标题-显示*/ 243 | .md-toc-content .md-toc-h2:before { 244 | counter-increment: toc-h2; 245 | content: counter(toc-h2, cjk-ideographic) "、"; 246 | } 247 | .md-toc-content .md-toc-h3:before { 248 | counter-increment: toc-h3; 249 | content: "(" counter(toc-h3, cjk-ideographic) ")"; 250 | } 251 | .md-toc-content .md-toc-h4:before { 252 | counter-increment: toc-h4; 253 | content: counter(toc-h4, decimal) ". "; 254 | } 255 | /* 大纲标题 -重置*/ 256 | .sidebar-content{ 257 | counter-reset: outline-h2 outline-h3 outline-h4;/*修复缺失上级标题时无法递增*/ 258 | } 259 | .sidebar-content .outline-h1 { 260 | counter-reset: outline-h2; 261 | } 262 | .sidebar-content .outline-h2 { 263 | counter-reset: outline-h3; 264 | } 265 | .sidebar-content .outline-h3 { 266 | counter-reset: outline-h4; 267 | } 268 | /* 大纲标题 -显示*/ 269 | .sidebar-content .outline-h2 .outline-label:before { 270 | counter-increment: outline-h2; 271 | content: counter(outline-h2, cjk-ideographic) "、"; 272 | } 273 | .sidebar-content .outline-h3 .outline-label:before { 274 | counter-increment: outline-h3; 275 | content: "(" counter(outline-h3, cjk-ideographic) ")"; 276 | } 277 | .sidebar-content .outline-h4 .outline-label:before { 278 | counter-increment: outline-h4; 279 | content: counter(outline-h4, decimal) ". "; 280 | } 281 | 282 | /* 代码块样式 */ 283 | /*基准样式来自 https://support.typora.io/Code-Block-Styles/ */ 284 | code{/* 行内代码 */ 285 | font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace; 286 | padding: 2px 4px; 287 | border-radius: 2px; 288 | font-size: 90%; 289 | color: #000000; 290 | background-color: #f8f8f8; 291 | } 292 | /*.cm-s-inner .CodeMirror-matchingbracket { 293 | text-decoration: underline; 294 | font-weight:bold; 295 | }*/ 296 | 297 | /**apply to code fences with plan text**/ 298 | .md-fences .code-tooltip { 299 | background-color: white; 300 | } 301 | .cm-s-inner { 302 | background-color: white; 303 | color: black; 304 | border-top: solid 1.5pt black; 305 | border-bottom: solid 1.5pt black; 306 | /*font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace;*/ 307 | font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace; 308 | font-size: 10pt; 309 | padding: 5pt; 310 | } 311 | /*.cm-s-inner .CodeMirror-gutters { 312 | background: black; 313 | color: rgb(83,127,126); 314 | border: none; 315 | }*/ 316 | 317 | /* 与用户操作相关,如光标,选中区域等 */ 318 | 319 | .cm-s-inner .CodeMirror-guttermarker, .cm-s-inner .CodeMirror-guttermarker-subtle, .cm-s-inner .CodeMirror-linenumber 320 | { color: black; }/* 行号 */ 321 | .cm-s-inner .CodeMirror-cursor { border-left: 1px solid black; } /* 光标 */ 322 | 323 | /* 选中 */ 324 | .cm-s-inner div.CodeMirror-selected { background: rgba(255, 255, 255, 0.15); } 325 | .cm-s-inner.CodeMirror-focused div.CodeMirror-selected { background: rgba(255, 255, 255, 0.10); } 326 | .cm-s-inner .CodeMirror-line::selection, .cm-s-inner .CodeMirror-line > span::selection, .cm-s-inner .CodeMirror-line > span > span::selection 327 | { background: rgba(255, 255, 255, 0.10); } 328 | .cm-s-inner .CodeMirror-line::-moz-selection, .cm-s-inner .CodeMirror-line > span::-moz-selection, .cm-s-inner .CodeMirror-line > span > span::-moz-selection 329 | { background: rgba(255, 255, 255, 0.10); } 330 | 331 | /* .cm-s-inner .CodeMirror-activeline-background { background: rgba(255, 255, 255, 0.10); }/* 高亮当前行 */ 332 | .cm-s-inner .cm-keyword { color: black; font-weight: bold;}/* 语言关键字 */ 333 | .cm-s-inner .cm-operator { color: black; } /* 语言操作符 */ 334 | .cm-s-inner .cm-variable { color: black;} /* 变量 */ 335 | .cm-s-inner .cm-variable-2 { color: black; /*font-style: italic;*/ } 336 | .cm-s-inner .cm-variable-3 { color: black; font-weight: bold;}/* 语言内置类型 */ 337 | .cm-s-inner .cm-builtin { color: black; } 338 | .cm-s-inner .cm-number { color: black; }/* 数字 */ 339 | .cm-s-inner .cm-def { color: black; }/*函数定义*/ 340 | .cm-s-inner .cm-string { color: gray; font-weight:bold }/* 字符串 */ 341 | .cm-s-inner .cm-string-2 { color: gray; font-weight:bold }/* 字符串 */ 342 | .cm-s-inner .cm-comment { color: gray; font-style: italic;}/* 注释 */ 343 | .cm-s-inner .cm-meta { color: black; }/* 头文件,宏定义等*/ 344 | /* HTML 相关 */ 345 | .cm-s-inner .cm-tag { color: black; font-weight: bold;}/* HTML 标签 */ 346 | .cm-s-inner .cm-attribute { color: black; } 347 | .cm-s-inner .cm-property { color: black; }/*CSS属性名称*/ 348 | .cm-s-inner .cm-atom { color: black; }/*CSS属性值*/ 349 | .cm-s-inner .cm-qualifier { color: black; font-weight:bold;}/*css选择器等*/ 350 | .cm-s-inner .cm-error { 351 | color: rgba(255, 255, 255, 1.0); 352 | background-color: red; 353 | } 354 | 355 | /* override the default style for focused headings */ 356 | #write>h3.md-focus:before, 357 | #write>h4.md-focus:before, 358 | #write>h5.md-focus:before, 359 | #write>h6.md-focus:before, 360 | h3.md-focus:before, 361 | h4.md-focus:before, 362 | h5.md-focus:before, 363 | h6.md-focus:before { 364 | color: inherit; 365 | border: inherit; 366 | border-radius: inherit; 367 | position: inherit; 368 | left:initial; 369 | float: none; 370 | top:initial; 371 | font-size: inherit; 372 | padding-left: inherit; 373 | padding-right: inherit; 374 | vertical-align: inherit; 375 | font-weight: inherit; 376 | line-height: inherit; 377 | } 378 | 379 | a { 380 | color: #42b983; 381 | padding: 0 2px; 382 | text-decoration: none; 383 | } 384 | 385 | 386 | -------------------------------------------------------------------------------- /paper-markdown.css: -------------------------------------------------------------------------------- 1 | /* page-break: Firefox, Chrome, 以及 Safari 不支持属性值 "avoid". */ 2 | body{ 3 | /* border:1px solid black; for debug */ 4 | padding:0 !important; 5 | margin:0 !important; 6 | } 7 | /* 正文区基本属性 */ 8 | #write { 9 | font-family:"Times New Roman", 宋体; 10 | font-size:12pt; 11 | max-width: 21cm; /*A4标准宽度*/ 12 | border:1px solid #CCC ; /* 添加一个淡灰色的边框 */ 13 | /*box-shadow: 0 0 5px 5px #CCC;*/ 14 | } 15 | /*页边距处理*/ 16 | @media screen{ 17 | #write{ 18 | padding:0cm 3.18cm; 19 | } 20 | } 21 | 22 | @media print{ 23 | #write{ 24 | padding:0 3.18cm !important; 25 | margin:0 !important; 26 | } 27 | } 28 | 29 | @page{ 30 | margin:2.5cm 0; /*上下/左右 边距,参考了word的默认边距*/ 31 | } 32 | 33 | 34 | #write p{ 35 | text-align:justify; 36 | } 37 | h1,h2,h3,h4,h5,h6 { 38 | font-weight:bold; 39 | @media print{ 40 | page-break-after:avoid !important; 41 | } 42 | } 43 | /*引言*/ 44 | blockquote{ 45 | font-family:楷体; 46 | /* border-left:3px solid black; */ 47 | padding-left:10px; 48 | /*color:grey;*/ 49 | } 50 | /* 标题属性 */ 51 | h1 { 52 | text-align:center; 53 | font-size:14pt; 54 | font-family:Helvetica, Tahoma, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", STXihei, "Microsoft YaHei", SimHei, "WenQuanYi Micro Hei"; 55 | font-weight:bold; 56 | /*page-break-before:always!important;*/ 57 | } 58 | h2 { 59 | font-family:Helvetica, Tahoma, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", STXihei, "Microsoft YaHei", SimHei, "WenQuanYi Micro Hei"; 60 | text-align:center; 61 | font-size:14pt; 62 | font-weight:bold; 63 | } 64 | h3 { 65 | font-family:Helvetica, Tahoma, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", STXihei, "Microsoft YaHei", SimHei, "WenQuanYi Micro Hei"; 66 | font-size:12pt; 67 | font-weight:bold; 68 | } 69 | h4 { 70 | /*text-align:center;*/ 71 | font-family:楷体; 72 | font-size:12pt; 73 | font-weight:bold; 74 | } 75 | 76 | h6 { 77 | text-align:center; 78 | font-size:16pt; 79 | font-family:Helvetica, Tahoma, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", STXihei, "Microsoft YaHei", SimHei, "WenQuanYi Micro Hei"; 80 | font-weight:bold; 81 | /*page-break-before:always!important;*/ 82 | } 83 | 84 | /* 目录标题属性 */ 85 | .md-toc-h2 { 86 | font-family:黑体; 87 | } 88 | .md-toc-h3 { 89 | font-family:黑体; 90 | } 91 | .md-toc-h4 { 92 | font-family:黑体; 93 | } 94 | /* 三线表 */ 95 | #write table{ 96 | border-top: 1.5pt solid; 97 | border-bottom: 1.5pt solid; 98 | font-family:宋体; 99 | /*font-size:7.875pt;*/ 100 | font-size:10.5pt; 101 | text-align:center; 102 | page-break-inside:avoid!important; 103 | } 104 | #write table td{ 105 | padding:2px; 106 | } 107 | #write table tr{ 108 | /* padding:3px; */ 109 | } 110 | #write thead{ 111 | border-bottom: 0.75pt solid; 112 | font-family:黑体; 113 | font-size:10.5pt; 114 | } 115 | 116 | /* @media print{ 117 | img{ 118 | page-break-inside:avoid !important; 119 | break-inside: avoid !important; 120 | } 121 | } */ 122 | img{ 123 | page-break-inside:avoid !important; 124 | break-inside: avoid !important; 125 | } 126 | 127 | 128 | /* 引用和尾注 */ 129 | sup.md-footnote{ 130 | background-color: transparent; 131 | padding:0; 132 | } 133 | sup.md-footnote>a::before{ 134 | content:'['; 135 | } 136 | sup.md-footnote>a::after{ 137 | content:']'; 138 | } 139 | 140 | 141 | div.footnotes-area{ 142 | font-family:宋体; 143 | font-size:12pt !important; 144 | color: black; 145 | page-break-inside:avoid!important; 146 | } 147 | div.footnotes-area::before{ 148 | /* content: "参考文献"; */ 149 | text-align:center; 150 | width:100%; 151 | display:inline-block; 152 | font-size:16pt; 153 | font-family: 仿宋; 154 | font-weight: bold; 155 | } 156 | div.footnotes-area>hr{ 157 | display:none; 158 | } 159 | div.footnote-line{ 160 | font-family:宋体; 161 | font-size:10.5pt !important; 162 | color: black; 163 | margin-top: 0; 164 | } 165 | span.md-fn-count::before{ 166 | content:'['; 167 | } 168 | span.md-fn-count::after{ 169 | content:']'; 170 | } 171 | 172 | 173 | 174 | /* 以下开始为自动编号 */ 175 | #write{ 176 | counter-reset: tableHead imgHead write-h2 write-h3 write-h4!important; /*修复缺失上级标题时无法递增*/ 177 | } 178 | /* 编辑器内标题-重置 */ 179 | /* #write h1 { 180 | counter-reset: write-h2; 181 | } */ 182 | #write h2 { 183 | counter-reset: write-h3; 184 | } 185 | #write h3 { 186 | counter-reset: write-h4; 187 | } 188 | /* 表格自动编号 */ 189 | /*#write figure:after{ 190 | counter-increment: tableHead; 191 | content: "表" counter(tableHead) " "; 192 | text-align:center; 193 | width:100%; 194 | display:inline-block; 195 | }*/ 196 | /* 图片自动编号,导出PDF时暂时无法显示 */ 197 | /*#write .md-image:after{ 198 | counter-increment: imgHead; 199 | content: "图" counter(imgHead) attr(alt) " " !important; 200 | text-align:center; 201 | width:100%; 202 | display:inline-block; 203 | }*/ 204 | /* 编辑器内标题-显示 */ 205 | #write h2:before { 206 | counter-increment: write-h2; 207 | content: "第" counter(write-h2, cjk-ideographic) "章 "; 208 | } 209 | #write h3:before { 210 | counter-increment: write-h3; 211 | content: counter(write-h2) ". " counter(write-h3) " "; 212 | } 213 | 214 | #write h4:before { 215 | counter-increment: write-h4; 216 | content: counter(write-h2) ". " counter(write-h3) ". " counter(write-h4) " "; 217 | } 218 | 219 | /*#write h4:before { 220 | counter-increment: write-h4; 221 | content: counter(write-h4, decimal) ". "; 222 | }*/ 223 | /* 目录标题-重置 */ 224 | .md-toc-content{ 225 | margin-left: 8em; 226 | counter-reset: toc-h2 toc-h3 toc-h4 ;/*修复缺失上级标题时无法递增*/ 227 | page-break-after: always; 228 | } 229 | .md-toc::before{ 230 | content: "目录"; 231 | font-family:仿宋; 232 | text-align:center; 233 | font-size:18pt; 234 | display:inline-block; 235 | font-weight: bold; 236 | width: 100%; 237 | } 238 | .md-toc-inner{ 239 | margin-left:0 !important; 240 | color:black !important; 241 | } 242 | .md-toc-item{ 243 | color:black !important; 244 | font-size: 11pt; 245 | font-family: "宋体"; 246 | } 247 | .md-toc-content .md-toc-h1 { 248 | counter-reset: toc-h2; 249 | } 250 | .md-toc-content .md-toc-h2 { 251 | counter-reset: toc-h3; 252 | } 253 | .md-toc-content .md-toc-h3 { 254 | counter-reset: toc-h4; 255 | } 256 | .md-toc-content .md-toc-h4 { 257 | display: none; 258 | } 259 | .md-toc-content .md-toc-h5 { 260 | display: none; 261 | } 262 | /* 目录标题-显示*/ 263 | .md-toc-content .md-toc-h2:before { 264 | counter-increment: toc-h2; 265 | content: counter(toc-h2, cjk-ideographic) "、"; 266 | } 267 | .md-toc-content .md-toc-h3:before { 268 | counter-increment: toc-h3; 269 | content: "(" counter(toc-h3, cjk-ideographic) ")"; 270 | } 271 | .md-toc-content .md-toc-h4:before { 272 | counter-increment: toc-h4; 273 | content: counter(toc-h4, decimal) ". "; 274 | } 275 | /* 大纲标题 -重置*/ 276 | .sidebar-content{ 277 | counter-reset: outline-h2 outline-h3 outline-h4;/*修复缺失上级标题时无法递增*/ 278 | } 279 | .sidebar-content .outline-h1 { 280 | counter-reset: outline-h2; 281 | } 282 | .sidebar-content .outline-h2 { 283 | counter-reset: outline-h3; 284 | } 285 | .sidebar-content .outline-h3 { 286 | counter-reset: outline-h4; 287 | } 288 | /* 大纲标题 -显示*/ 289 | .sidebar-content .outline-h2 .outline-label:before { 290 | counter-increment: outline-h2; 291 | content: counter(outline-h2, cjk-ideographic) "、"; 292 | } 293 | .sidebar-content .outline-h3 .outline-label:before { 294 | counter-increment: outline-h3; 295 | content: "(" counter(outline-h3, cjk-ideographic) ")"; 296 | } 297 | .sidebar-content .outline-h4 .outline-label:before { 298 | counter-increment: outline-h4; 299 | content: counter(outline-h4, decimal) ". "; 300 | } 301 | 302 | /* 代码块样式 */ 303 | /*基准样式来自 https://support.typora.io/Code-Block-Styles/ */ 304 | code{/* 行内代码 */ 305 | font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace; 306 | padding: 2px 4px; 307 | border-radius: 2px; 308 | font-size: 90%; 309 | color: #000000; 310 | background-color: #f8f8f8; 311 | } 312 | /*.cm-s-inner .CodeMirror-matchingbracket { 313 | text-decoration: underline; 314 | font-weight:bold; 315 | }*/ 316 | 317 | /**apply to code fences with plan text**/ 318 | .md-fences .code-tooltip { 319 | background-color: white; 320 | } 321 | .cm-s-inner { 322 | background-color: white; 323 | color: black; 324 | border-top: solid 1.5pt black; 325 | border-bottom: solid 1.5pt black; 326 | /*font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace;*/ 327 | font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace; 328 | font-size: 10pt; 329 | padding: 5pt; 330 | } 331 | /*.cm-s-inner .CodeMirror-gutters { 332 | background: black; 333 | color: rgb(83,127,126); 334 | border: none; 335 | }*/ 336 | 337 | /* 与用户操作相关,如光标,选中区域等 */ 338 | 339 | .cm-s-inner .CodeMirror-guttermarker, .cm-s-inner .CodeMirror-guttermarker-subtle, .cm-s-inner .CodeMirror-linenumber 340 | { color: black; }/* 行号 */ 341 | .cm-s-inner .CodeMirror-cursor { border-left: 1px solid black; } /* 光标 */ 342 | 343 | /* 选中 */ 344 | .cm-s-inner div.CodeMirror-selected { background: rgba(255, 255, 255, 0.15); } 345 | .cm-s-inner.CodeMirror-focused div.CodeMirror-selected { background: rgba(255, 255, 255, 0.10); } 346 | .cm-s-inner .CodeMirror-line::selection, .cm-s-inner .CodeMirror-line > span::selection, .cm-s-inner .CodeMirror-line > span > span::selection 347 | { background: rgba(255, 255, 255, 0.10); } 348 | .cm-s-inner .CodeMirror-line::-moz-selection, .cm-s-inner .CodeMirror-line > span::-moz-selection, .cm-s-inner .CodeMirror-line > span > span::-moz-selection 349 | { background: rgba(255, 255, 255, 0.10); } 350 | 351 | /* .cm-s-inner .CodeMirror-activeline-background { background: rgba(255, 255, 255, 0.10); }/* 高亮当前行 */ 352 | .cm-s-inner .cm-keyword { color: black; font-weight: bold;}/* 语言关键字 */ 353 | .cm-s-inner .cm-operator { color: black; } /* 语言操作符 */ 354 | .cm-s-inner .cm-variable { color: black;} /* 变量 */ 355 | .cm-s-inner .cm-variable-2 { color: black; /*font-style: italic;*/ } 356 | .cm-s-inner .cm-variable-3 { color: black; font-weight: bold;}/* 语言内置类型 */ 357 | .cm-s-inner .cm-builtin { color: black; } 358 | .cm-s-inner .cm-number { color: black; }/* 数字 */ 359 | .cm-s-inner .cm-def { color: black; }/*函数定义*/ 360 | .cm-s-inner .cm-string { color: gray; font-weight:bold }/* 字符串 */ 361 | .cm-s-inner .cm-string-2 { color: gray; font-weight:bold }/* 字符串 */ 362 | .cm-s-inner .cm-comment { color: gray; font-style: italic;}/* 注释 */ 363 | .cm-s-inner .cm-meta { color: black; }/* 头文件,宏定义等*/ 364 | /* HTML 相关 */ 365 | .cm-s-inner .cm-tag { color: black; font-weight: bold;}/* HTML 标签 */ 366 | .cm-s-inner .cm-attribute { color: black; } 367 | .cm-s-inner .cm-property { color: black; }/*CSS属性名称*/ 368 | .cm-s-inner .cm-atom { color: black; }/*CSS属性值*/ 369 | .cm-s-inner .cm-qualifier { color: black; font-weight:bold;}/*css选择器等*/ 370 | .cm-s-inner .cm-error { 371 | color: rgba(255, 255, 255, 1.0); 372 | background-color: red; 373 | } 374 | 375 | /* override the default style for focused headings */ 376 | #write>h3.md-focus:before, 377 | #write>h4.md-focus:before, 378 | #write>h5.md-focus:before, 379 | #write>h6.md-focus:before, 380 | h3.md-focus:before, 381 | h4.md-focus:before, 382 | h5.md-focus:before, 383 | h6.md-focus:before { 384 | color: inherit; 385 | border: inherit; 386 | border-radius: inherit; 387 | position: inherit; 388 | left:initial; 389 | float: none; 390 | top:initial; 391 | font-size: inherit; 392 | padding-left: inherit; 393 | padding-right: inherit; 394 | vertical-align: inherit; 395 | font-weight: inherit; 396 | line-height: inherit; 397 | } 398 | 399 | /* 超链接样式 */ 400 | a { 401 | color: #42b983; 402 | padding: 0 2px; 403 | text-decoration: none; 404 | } 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | -------------------------------------------------------------------------------- /README.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 |搭配typora即可轻松使用该主题:
将该仓库最新的release下载后解压到typora的主题文件夹,或者直接clone下来也是可以的。
改模版根据传统实验报告的编号需求进行了编号

如果是计算机专业的同学可以用这个代码块,这个代码块的样式打印出来也是不错滴。

使用typora自带的导出为pdf可能会出现一些奇怪的问题,所以我推荐先到处为html然后使用Chrome打开,使用Chrome自带的打印功能去导出为PDF格式。
