Commit ffe6501 h
Pat Ambrosio · 26-08-31 12:23
Set section headings in bold
Changes: 3 files
+25
-0
Changes (Side-by-Side)
share/jenny/layout/page.sh +8 -0
cat << _EOF_ |
| 882 |
background-color: var(--bg-secondary); |
882 |
background-color: var(--bg-secondary); |
| 883 |
padding: 1em; border-radius: 3px; } |
883 |
padding: 1em; border-radius: 3px; } |
| 884 |
h1, h2, h3, h4, h5, h6 { font-size: 1em; font-weight: normal; text-transform: uppercase; margin: 2em 0 1em; } |
884 |
h1, h2, h3, h4, h5, h6 { font-size: 1em; font-weight: normal; text-transform: uppercase; margin: 2em 0 1em; } |
| |
885 |
/* Bold carries the two levels that open a section, since every heading |
| |
886 |
is body size and uppercase alone did not separate a heading from the |
| |
887 |
prose around it. h1 as well as h2: a page's own title repeat is an |
| |
888 |
h1, and so is any second top-level heading an author writes, so |
| |
889 |
bolding h2 alone would leave those reading as the lighter level |
| |
890 |
while their siblings were bold. Deeper headings stay regular -- they |
| |
891 |
sit inside a section rather than opening one. */ |
| |
892 |
.contents :is(h1, h2) { font-weight: bold; } |
| 885 |
/* Every heading is body size, which keeps the page even but leaves a |
893 |
/* Every heading is body size, which keeps the page even but leaves a |
| 886 |
section heading reading as a stray line of capitals: uppercase alone |
894 |
section heading reading as a stray line of capitals: uppercase alone |
| 887 |
does not say "new section". A rule above says it structurally rather |
895 |
does not say "new section". A rule above says it structurally rather |
share/jenny/layout/post.sh +8 -0
cat << _EOF_ |
| 703 |
background-color: var(--bg-secondary); |
703 |
background-color: var(--bg-secondary); |
| 704 |
padding: 1em; border-radius: 3px; } |
704 |
padding: 1em; border-radius: 3px; } |
| 705 |
h1, h2, h3, h4, h5, h6 { font-size: 1em; font-weight: normal; text-transform: uppercase; margin: 2em 0 1em; } |
705 |
h1, h2, h3, h4, h5, h6 { font-size: 1em; font-weight: normal; text-transform: uppercase; margin: 2em 0 1em; } |
| |
706 |
/* Bold carries the two levels that open a section, since every heading |
| |
707 |
is body size and uppercase alone did not separate a heading from the |
| |
708 |
prose around it. h1 as well as h2: a page's own title repeat is an |
| |
709 |
h1, and so is any second top-level heading an author writes, so |
| |
710 |
bolding h2 alone would leave those reading as the lighter level |
| |
711 |
while their siblings were bold. Deeper headings stay regular -- they |
| |
712 |
sit inside a section rather than opening one. */ |
| |
713 |
.contents :is(h1, h2) { font-weight: bold; } |
| 706 |
/* Every heading is body size, which keeps the page even but leaves a |
714 |
/* Every heading is body size, which keeps the page even but leaves a |
| 707 |
section heading reading as a stray line of capitals: uppercase alone |
715 |
section heading reading as a stray line of capitals: uppercase alone |
| 708 |
does not say "new section". A rule above says it structurally rather |
716 |
does not say "new section". A rule above says it structurally rather |
test/regressions.sh +9 -0
assert_file_contains "$dg/.dist/post/charted.html" '.contents :is(h1, h2) {' |
| 1386 |
assert_file_contains "$dg/.dist/chart.html" 'width: 3ch;' |
1386 |
assert_file_contains "$dg/.dist/chart.html" 'width: 3ch;' |
| 1387 |
assert_file_contains "$dg/.dist/chart.html" '.contents :is(h1, h2)::before {' |
1387 |
assert_file_contains "$dg/.dist/chart.html" '.contents :is(h1, h2)::before {' |
| 1388 |
|
1388 |
|
| |
1389 |
it "a section heading is bold" |
| |
1390 |
# Every heading is body size, so weight is what separates a section heading |
| |
1391 |
# from the prose around it. h1 as well as h2: a page's title repeat is an h1, |
| |
1392 |
# and so is a second top-level heading an author writes, so bolding h2 alone |
| |
1393 |
# would leave those lighter than their siblings. Deeper levels stay regular -- |
| |
1394 |
# they sit inside a section rather than opening one. |
| |
1395 |
assert_file_contains "$dg/.dist/chart.html" '.contents :is(h1, h2) { font-weight: bold; }' |
| |
1396 |
assert_file_contains "$dg/.dist/post/charted.html" '.contents :is(h1, h2) { font-weight: bold; }' |
| |
1397 |
|
| 1389 |
it "the body's repeat of the page title carries no rule" |
1398 |
it "the body's repeat of the page title carries no rule" |
| 1390 |
# A page repeats its title as the body's opening h1, and a rule there draws a |
1399 |
# A page repeats its title as the body's opening h1, and a rule there draws a |
| 1391 |
# line immediately under the title in the header. An h1 with no heading before |
1400 |
# line immediately under the title in the header. An h1 with no heading before |
Raw
commit ffe65015dbfffeed0f7b0cd92d5b7b3db10a5104
Author: Pat Ambrosio <cp.ambrosio@gmail.com>
Date: Mon Aug 31 12:23:09 2026 +0800
Set section headings in bold
Every heading is body size, so uppercase was carrying the whole burden of
separating a heading from the prose around it, and it was not enough. Bold
gives the two levels that open a section a weight the eye catches without
touching the size.
h1 as well as h2. A page's body repeats its title as an h1, and an author
may write a second top-level heading -- the flow page has one -- so
bolding h2 alone would have left those lighter than the sections beside
them, reading as a lesser level than their own siblings. h3 and deeper
stay regular: they sit inside a section rather than opening one, which is
the same line the section mark draws.
Scoped to .contents, so the header title, which is bold already and lives
outside it, is untouched.
diff --git a/share/jenny/layout/page.sh b/share/jenny/layout/page.sh
index 5530259..672f7ba 100755
--- a/share/jenny/layout/page.sh
+++ b/share/jenny/layout/page.sh
@@ -882,6 +882,14 @@ cat << _EOF_
background-color: var(--bg-secondary);
padding: 1em; border-radius: 3px; }
h1, h2, h3, h4, h5, h6 { font-size: 1em; font-weight: normal; text-transform: uppercase; margin: 2em 0 1em; }
+ /* Bold carries the two levels that open a section, since every heading
+ is body size and uppercase alone did not separate a heading from the
+ prose around it. h1 as well as h2: a page's own title repeat is an
+ h1, and so is any second top-level heading an author writes, so
+ bolding h2 alone would leave those reading as the lighter level
+ while their siblings were bold. Deeper headings stay regular -- they
+ sit inside a section rather than opening one. */
+ .contents :is(h1, h2) { font-weight: bold; }
/* Every heading is body size, which keeps the page even but leaves a
section heading reading as a stray line of capitals: uppercase alone
does not say "new section". A rule above says it structurally rather
diff --git a/share/jenny/layout/post.sh b/share/jenny/layout/post.sh
index e917096..926a1c8 100755
--- a/share/jenny/layout/post.sh
+++ b/share/jenny/layout/post.sh
@@ -703,6 +703,14 @@ cat << _EOF_
background-color: var(--bg-secondary);
padding: 1em; border-radius: 3px; }
h1, h2, h3, h4, h5, h6 { font-size: 1em; font-weight: normal; text-transform: uppercase; margin: 2em 0 1em; }
+ /* Bold carries the two levels that open a section, since every heading
+ is body size and uppercase alone did not separate a heading from the
+ prose around it. h1 as well as h2: a page's own title repeat is an
+ h1, and so is any second top-level heading an author writes, so
+ bolding h2 alone would leave those reading as the lighter level
+ while their siblings were bold. Deeper headings stay regular -- they
+ sit inside a section rather than opening one. */
+ .contents :is(h1, h2) { font-weight: bold; }
/* Every heading is body size, which keeps the page even but leaves a
section heading reading as a stray line of capitals: uppercase alone
does not say "new section". A rule above says it structurally rather
diff --git a/test/regressions.sh b/test/regressions.sh
index e520beb..f234b8e 100755
--- a/test/regressions.sh
+++ b/test/regressions.sh
@@ -1386,6 +1386,15 @@ assert_file_contains "$dg/.dist/post/charted.html" '.contents :is(h1, h2) {'
assert_file_contains "$dg/.dist/chart.html" 'width: 3ch;'
assert_file_contains "$dg/.dist/chart.html" '.contents :is(h1, h2)::before {'
+it "a section heading is bold"
+# Every heading is body size, so weight is what separates a section heading
+# from the prose around it. h1 as well as h2: a page's title repeat is an h1,
+# and so is a second top-level heading an author writes, so bolding h2 alone
+# would leave those lighter than their siblings. Deeper levels stay regular --
+# they sit inside a section rather than opening one.
+assert_file_contains "$dg/.dist/chart.html" '.contents :is(h1, h2) { font-weight: bold; }'
+assert_file_contains "$dg/.dist/post/charted.html" '.contents :is(h1, h2) { font-weight: bold; }'
+
it "the body's repeat of the page title carries no rule"
# A page repeats its title as the body's opening h1, and a rule there draws a
# line immediately under the title in the header. An h1 with no heading before