diff options
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Set every monospace element in the theme font
Only some pre elements named --font-mono, so code in a readme took the browser's own font, Courier in Chrome and Safari, rather than a theme's.
Diffstat (limited to '')
-rw-r--r--assets/cgit.css10
-rwxr-xr-xtests/t0005-markup.sh8
2 files changed, 15 insertions, 3 deletions
diff --git a/assets/cgit.css b/assets/cgit.css
index 0149519..540480c 100644
--- a/assets/cgit.css
+++ b/assets/cgit.css
@@ -127,6 +127,13 @@ div#cgit table {
border-collapse: collapse;
}
+div#cgit code,
+div#cgit kbd,
+div#cgit pre,
+div#cgit samp {
+ font-family: var(--font-mono);
+}
+
div#cgit select,
div#cgit input {
font-family: inherit;
@@ -448,7 +455,6 @@ div#cgit div#about pre {
div#cgit pre.plaintext {
white-space: pre-wrap;
overflow-wrap: anywhere;
- font-family: var(--font-mono);
line-height: 1.5;
margin: 0;
}
@@ -642,7 +648,6 @@ div#cgit table.blob td.linenumbers {
div#cgit table.blob pre {
padding: 0;
margin: 0;
- font-family: var(--font-mono);
}
/*
@@ -757,7 +762,6 @@ div#cgit table.blame td.lines > div > pre {
padding: 0 0 0 0.5em;
position: absolute;
top: 0;
- font-family: var(--font-mono);
}
div#cgit table.blame .oid {
diff --git a/tests/t0005-markup.sh b/tests/t0005-markup.sh
index 829c839..5d802a7 100755
--- a/tests/t0005-markup.sh
+++ b/tests/t0005-markup.sh
@@ -90,6 +90,14 @@ test_expect_success 'the blob, blame and about pages open with their own contain
grep "<div id=.about.>" tmp
'
+# A browser gives these elements a monospace font of its own, which would
+# otherwise win over the one a theme sets through --font-mono.
+test_expect_success 'every monospace element takes the theme font' '
+ sed -n "/^div#cgit code,$/,/^}/p" "$TEST_OUTPUT_DIRECTORY/../assets/cgit.css" >rule &&
+ grep "^div#cgit pre,$" rule &&
+ grep "^ font-family: var(--font-mono);$" rule
+'
+
test_expect_success 'the stylesheet and the script name only the current hooks' '
! grep "_dark\|#summary\|ul.pager\|td:empty" "$TEST_OUTPUT_DIRECTORY/../assets/cgit.css" &&
grep "window.cgit.updateAges" "$TEST_OUTPUT_DIRECTORY/../assets/cgit.js" &&