Skip to main content

pdfsmith/
css.rs

1// ─────────────────────────────────────────────────────────────────────────────
2// css.rs — Clean, neutral default stylesheet
3//
4// Used when the user does not supply `custom_css`.
5// Intentionally minimal and professional — no brand colours, no opinions.
6// Users override with `custom_css` (full replace) or `extra_css` (append).
7// ─────────────────────────────────────────────────────────────────────────────
8
9/// The built-in default CSS stylesheet.
10///
11/// A clean, readable, print-friendly stylesheet.  Uses system font stacks
12/// and neutral colours so it looks good out of the box for any document.
13pub const DEFAULT_CSS: &str = r#"
14* { box-sizing: border-box; }
15
16body {
17  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
18  font-size: 10pt;
19  line-height: 1.5;
20  color: #24292e;
21  background: #fff;
22  margin: 0;
23  padding: 0;
24  word-wrap: break-word;
25}
26
27/* ── Headings ── */
28h1, h2, h3, h4, h5, h6 {
29  margin-top: 1.2em;
30  margin-bottom: 0.5em;
31  font-weight: 600;
32  line-height: 1.25;
33  color: #1a1a1a;
34}
35h1 { font-size: 2em;    margin-top: 0; padding-bottom: 0.3em; border-bottom: 1px solid #eee; }
36h2 { font-size: 1.5em;  padding-bottom: 0.3em; border-bottom: 1px solid #eee; }
37h3 { font-size: 1.25em; }
38h4 { font-size: 1em;    }
39h5 { font-size: 0.875em; }
40h6 { font-size: 0.85em; color: #555; }
41
42/* ── Paragraphs & blocks ── */
43p, blockquote, ul, ol, dl, table, pre, details {
44  margin-top: 0;
45  margin-bottom: 1em;
46}
47
48/* ── Links ── */
49a       { color: #0366d6; text-decoration: none; }
50a:hover { text-decoration: underline; }
51
52/* ── Inline code ── */
53code, tt {
54  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
55  font-size: 85%;
56  background: #f6f8fa;
57  border-radius: 3px;
58  padding: 0.2em 0.4em;
59}
60
61/* ── Code blocks ── */
62pre {
63  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
64  font-size: 85%;
65  background: #f6f8fa;
66  border-radius: 6px;
67  padding: 16px;
68  overflow-x: auto;
69  line-height: 1.45;
70}
71pre code {
72  background: transparent;
73  padding: 0;
74  border: 0;
75  font-size: 100%;
76}
77
78/* ── Blockquote ── */
79blockquote {
80  margin: 0 0 1em 0;
81  padding: 0 1em;
82  color: #6a737d;
83  border-left: 0.25em solid #dfe2e5;
84}
85
86/* ── Tables ── */
87table {
88  border-collapse: collapse;
89  width: 100%;
90  margin-bottom: 1em;
91}
92table th, table td {
93  padding: 8px 12px;
94  border: 1px solid #dfe2e5;
95}
96table th {
97  font-weight: 600;
98  background: #f6f8fa;
99}
100table tr:nth-child(even) {
101  background: #f9f9f9;
102}
103
104/* ── Images ── */
105img { max-width: 100%; }
106
107/* ── Lists ── */
108ul, ol { padding-left: 2em; }
109li { margin-top: 0.25em; }
110
111/* ── Horizontal rule ── */
112hr {
113  height: 1px;
114  margin: 1.5em 0;
115  padding: 0;
116  background: #e1e4e8;
117  border: 0;
118}
119
120/* ── Task list ── */
121.task-list-item          { list-style-type: none; }
122.task-list-item-checkbox { margin: 0 0.2em 0.25em -1.4em; vertical-align: middle; }
123
124/* ── kbd ── */
125kbd {
126  display: inline-block;
127  padding: 3px 5px;
128  font: 11px "SFMono-Regular", Consolas, monospace;
129  color: #444;
130  background: #fafbfc;
131  border: 1px solid #d1d5da;
132  border-radius: 3px;
133  box-shadow: inset 0 -1px 0 #d1d5da;
134}
135
136/* ── Strikethrough ── */
137del { color: #6a737d; }
138
139/* ── Footnotes ── */
140.footnotes    { font-size: 85%; color: #6a737d; }
141.footnotes ol { padding-left: 1.5em; }
142"#;