From 9bee1ac647be6aabf0a7423ea91964e830707c07 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Mon, 1 Sep 2014 00:41:10 +0200 Subject: [PATCH] fix body font size regression --- github-markdown.css | 1 - index.js | 13 ++++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/github-markdown.css b/github-markdown.css index 8d102b2..120994c 100644 --- a/github-markdown.css +++ b/github-markdown.css @@ -88,7 +88,6 @@ box-sizing: border-box; } -.markdown-body, .markdown-body input { font: 13px Helvetica, arial, freesans, clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol"; line-height: 1.4; diff --git a/index.js b/index.js index e8d5e47..de8f1c4 100644 --- a/index.js +++ b/index.js @@ -57,13 +57,19 @@ function cleanupCss(str) { return false; } + // remove `body` from `body, input {}` + if (el.selectors[0] === 'body' && el.selectors[1] === 'input') { + el.selectors.shift(); + } + if (el.selectors.length === 1 && /^(?:html|body)$/.test(el.selectors[0])) { el.declarations = el.declarations.filter(function (declaration) { - if (!/^font|^(?:line-height|color)$|text-size-adjust$/.test(declaration.property)) { - return false; + // remove everything from body/html other than these + if (/^font|^(?:line-height|color)$|text-size-adjust$/.test(declaration.property)) { + return true; } - return true; + return false; }); } @@ -72,6 +78,7 @@ function cleanupCss(str) { selector = '.markdown-body'; } + if (!/\.markdown-body/.test(selector)) { selector = '.markdown-body ' + selector; }