Skip to content

Commit 568c040

Browse files
author
elonz
committed
update: 更改默认样式的排版
Change-Id: Id4757a62c3a04237054dae5a4c74a34f95f25e3a
1 parent 448e3b7 commit 568c040

File tree

4 files changed

+30
-25
lines changed

4 files changed

+30
-25
lines changed

scripts/gallery/utils.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ const postcss = require("postcss");
55
const cssnano = require("cssnano");
66
const { rollup } = require("rollup");
77
const virtual = require("@rollup/plugin-virtual");
8-
const themes = require("../../static/js/themes");
98
const pkg = require('../../package.json');
109
const _ = require("lodash")
1110
const prefixer = require('postcss-prefix-selector')
@@ -14,6 +13,8 @@ const toRootPrefix = "../../";
1413
const fromRoot = (pathFromRoot) => toRootPrefix + pathFromRoot;
1514
const filePath = (file) => path.join(__dirname, `${file}`);
1615

16+
const themes = require(fromRoot("src/themes/config"));
17+
1718
const buildScss= async ({ distPath, minify }) => {
1819
fs.ensureDirSync(filePath(distPath + "/js"))
1920

src/themes/core/base.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
@import "prism.scss";
22

3+
/*
4+
* 包含 markdown 的常见元素,各个属性通过 scss 变量控制;
5+
* 增加了一些 CSS Reset 代码;
6+
* 默认值使用 chrome 的默认样式,见 variables/default.scss。
7+
*/
8+
9+
// html、body 标签适用于 MWeb(html 中只包含 markdown 内容)
10+
// 在用于 jujin 等网站时,需要转为 .markdown-body
311
html {
412
font-family: $font-family;
513
font-size: $font-size;

src/themes/variables/default.scss

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/*
22
* Default theme
33
* 这个文件只应该包含变量
4+
* 取值参考 chrome user agent stylesheet:
5+
* https://chromium.googlesource.com/chromium/blink/+/refs/heads/main/Source/core/css/html.css
46
*/
57

68
/* color */
@@ -52,30 +54,24 @@ $md-body-mg-v: 0px;
5254
$md-body-pd-h: 3.2rem;
5355
$md-body-pd-v: 1.6rem;
5456

55-
$h1-mg-v: 0.67em;
56-
$h1-mg-t: $h1-mg-v;
57-
$h1-mg-b: $h1-mg-v;
58-
$h2-mg-v: 0.83em;
59-
$h2-mg-t: $h2-mg-v;
60-
$h2-mg-b: $h2-mg-v;
61-
$h3-mg-v: 1em;
62-
$h3-mg-t: $h3-mg-v;
63-
$h3-mg-b: $h3-mg-v;
64-
$h4-mg-v: 1.33em;
65-
$h4-mg-t: $h4-mg-v;
66-
$h4-mg-b: $h4-mg-v;
67-
$h5-mg-v: 1.67em;
68-
$h5-mg-t: $h5-mg-v;
69-
$h5-mg-b: $h5-mg-v;
70-
$h6-mg-v: 2.33em;
71-
$h6-mg-t: $h6-mg-v;
72-
$h6-mg-b: $h6-mg-v;
73-
$block-mg-t: 1em;
74-
$block-mg-b: 1em;
75-
$th-pd-v: 1px;
76-
$th-pd-h: 1px;
77-
$td-pd-v: 1px;
78-
$td-pd-h: 1px;
57+
$block-mg-t: 0.75em;
58+
$block-mg-b: 0.75em;
59+
$h1-mg-t: 2 * $block-mg-t;
60+
$h1-mg-b: $block-mg-b;
61+
$h2-mg-t: 2 * $block-mg-t;
62+
$h2-mg-b: $block-mg-b;
63+
$h3-mg-t: 2 * $block-mg-t;
64+
$h3-mg-b: $block-mg-b;
65+
$h4-mg-t: 2 * $block-mg-t;
66+
$h4-mg-b: $block-mg-b;
67+
$h5-mg-t: 2 * $block-mg-t;
68+
$h5-mg-b: $block-mg-b;
69+
$h6-mg-t: 2 * $block-mg-t;
70+
$h6-mg-b: $block-mg-b;
71+
$th-pd-v: 2px;
72+
$th-pd-h: 4px;
73+
$td-pd-v: 2px;
74+
$td-pd-h: 4px;
7975
$li-mg-t: .25em;
8076

8177
/* elememts */

0 commit comments

Comments
 (0)