Repository navigation
Expand file tree
/
Copy pathpdf-style.css
More file actions
124 lines (117 loc) · 4.17 KB
/
Copy pathpdf-style.css
File metadata and controls
124 lines (117 loc) · 4.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/* Print stylesheet for the AI in Education Knowledge Base PDF (weasyprint via pandoc) */
@page {
size: A4;
margin: 22mm 18mm 22mm 18mm;
/* Page number at the bottom-right of every page except the cover. */
@bottom-right { content: counter(page); font-size: 9pt; color: #888; }
}
/* Cover page: full-bleed, no footer. */
@page cover {
margin: 0;
@bottom-right { content: none; }
}
/* Notice page (the 2nd page): show the page number bottom-right like the body. */
@page notice {
margin: 22mm 18mm 22mm 18mm;
@bottom-right { content: counter(page); font-size: 9pt; color: #888; }
}
html { font-size: 11pt; }
body {
font-family: Georgia, "Times New Roman", serif;
color: #1a1a1a;
line-height: 1.5;
}
h1, h2, h3, h4, h5, h6 { font-family: Georgia, serif; }
h1 { font-size: 20pt; margin: 0 0 0.5em 0; }
h2 { font-size: 15pt; border-bottom: 1px solid #ccc; padding-bottom: 0.2em; }
h3 { font-size: 12.5pt; }
h4 { font-size: 11pt; }
/* Body links: blue so they look clickable (matching the TOC links) */
a { color: #0b5aa0; text-decoration: none; }
a:hover { text-decoration: underline; }
p { margin: 0.5em 0; }
ul, ol { margin: 0.5em 0 0.5em 1.5em; }
li { margin: 0.15em 0; }
blockquote {
margin: 0.6em 0 0.6em 1.2em;
padding: 0.5em 1em;
border-left: 3px solid #7dd3fc;
background: #f4f9fd;
color: #234;
}
pre, code { font-family: Menlo, Consolas, monospace; font-size: 9pt; background: #f5f5f5; }
pre { padding: 0.6em; white-space: pre-wrap; overflow-wrap: break-word; border: 1px solid #ddd; }
table { border-collapse: collapse; margin: 0.6em 0; }
th, td { border: 1px solid #ccc; padding: 0.3em 0.5em; text-align: left; font-size: 9.5pt; }
th { background: #eef2f6; }
hr { border: none; border-top: 1px solid #ccc; }
/* Cover page fills the sheet */
.cover-page {
width: 100%;
height: 100vh;
page: cover;
text-align: center;
}
.cover-page img {
width: 100%;
height: 100%;
object-fit: contain;
}
/* Notice page (same content as the EPUB's Notice page) */
.notice-page {
page: notice;
page-break-before: always;
}
.notice-page h1 { font-size: 18pt; margin-bottom: 0.6em; }
.notice-page p { margin: 0.7em 0; }
.notice-page .pd-mark { margin-top: 1.2em; }
/* The CC0 public-domain mark sits inline with its localized label, at the
surrounding text's size (the site's footer badge uses 1.15em too). The size
must be here and not in the <img>'s width/height: WeasyPrint ignores those
attributes and would draw the 256px raster at 2.7in. */
.notice-page .pd-mark img {
width: 1.15em;
height: 1.15em;
vertical-align: middle;
}
/* Table of contents — make entries visibly clickable (blue) and add
hierarchical numbering (1 / 1.1 / 1.2.1) via CSS counters. WeasyPrint
renders counters reliably, and scoping to #TOC keeps body headings clean
(matching the EPUB, where numbering appears only in the TOC). */
#TOC {
page-break-after: always;
}
#TOC ul {
list-style: none;
margin-left: 0;
}
#TOC > ul { counter-reset: toc1; }
#TOC > ul > li { counter-increment: toc1; margin-top: 6pt; }
#TOC > ul > li > a { font-weight: bold; }
#TOC > ul > li > a::before { content: counter(toc1) ". "; font-weight: bold; }
#TOC li > ul { counter-reset: toc2; }
#TOC li > ul > li { counter-increment: toc2; }
#TOC li > ul > li > a { font-weight: 600; }
#TOC li > ul > li > a::before { content: counter(toc1) "." counter(toc2) ". "; font-weight: bold; }
#TOC li > ul > li > ul { counter-reset: toc3; }
#TOC li > ul > li > ul > li { counter-increment: toc3; }
#TOC li > ul > li > ul > li > a { font-weight: normal; }
#TOC li > ul > li > ul > li > a::before { content: counter(toc1) "." counter(toc2) "." counter(toc3) ". "; font-weight: bold; }
#TOC a {
color: #0b5aa0;
text-decoration: none;
display: block;
}
#TOC a:hover { text-decoration: underline; }
/* Right-aligned page number for each TOC entry, with a dotted leader. */
#TOC a::after {
content: leader('. ') target-counter(attr(href), page);
float: right;
color: #888;
font-weight: normal;
}
/* Start each H1 (major section) on a new page */
h1 { page-break-before: always; }
#introduction, h1#introduction { page-break-before: auto; }
body > section:first-of-type h1 { page-break-before: auto; }
h1, h2, h3, h4 { page-break-after: avoid; }