8000 fix body font size regression · rnugraha/github-markdown-css@9bee1ac · GitHub
[go: up one dir, main page]

Skip to content

Commit 9bee1ac

Browse files
committed
fix body font size regression
1 parent cbefe87 commit 9bee1ac

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

github-markdown.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@
8888
box-sizing: border-box;
8989
}
9090

91-
.markdown-body,
9291
.markdown-body input {
9392
font: 13px Helvetica, arial, freesans, clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
9493
line-height: 1.4;

index.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,19 @@ function cleanupCss(str) {
5757
return false;
5858
}
5959

60+
// remove `body` from `body, input {}`
61+
if (el.selectors[0] === 'body' && el.selectors[1] === 'input') {
62+
el.selectors.shift();
63+
}
64+
6065
if (el.selectors.length === 1 && /^(?:html|body)$/.test(el.selectors[0])) {
6166
el.declarations = el.declarations.filter(function (declaration) {
62-
if (!/^font|^(?:line-height|color)$|text-size-adjust$/.test(declaration.property)) {
63-
return false;
67+
// remove everything from body/html other than these
68+
if (/^font|^(?:line-height|color)$|text-size-adjust$/.test(declaration.property)) {
69+
return true;
6470
}
6571

66-
return true;
72+
return false;
6773
});
6874
}
6975

@@ -72,6 +78,7 @@ function cleanupCss(str) {
7278
selector = '.markdown-body';
7379
}
7480

81+
7582
if (!/\.markdown-body/.test(selector)) {
7683
selector = '.markdown-body ' + selector;
7784
}

0 commit comments

Comments
 (0)
0