@threepenny/md2pdf 0.0.0-stage → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,365 @@
1
+ /* Modern: clean sans-serif type, generous whitespace and one accent color. */
2
+
3
+ /* Variables a page can override, on .markdown-body itself: for all its documents, or for one with
4
+ <article class="markdown-body" style="--md2pdf-font-size: 12pt">. A value set on :root or another
5
+ ancestor doesn't reach the document. :where() gives these defaults no specificity, so the page's
6
+ rule wins wherever it comes. Every style uses the same names. */
7
+ :where(.markdown-body) {
8
+ /* Size and spacing. --md2pdf-font-size is the body text size, an absolute length such as 11pt or 15px; headings and smaller text scale with
9
+ it. --md2pdf-leading scales each line height's excess over 1, and --md2pdf-space the vertical
10
+ gaps between blocks; both are 1 as designed. */
11
+ --md2pdf-font-size: 10.5pt;
12
+ --md2pdf-leading: 1;
13
+ --md2pdf-space: 1;
14
+ /* Colors: --md2pdf-background the document's background; --md2pdf-text body text; --md2pdf-muted
15
+ secondary text; --md2pdf-accent headings, links, quotes and list markers; --md2pdf-rule rules and
16
+ table lines; --md2pdf-surface code and callout backgrounds. */
17
+ --md2pdf-background: #fff;
18
+ --md2pdf-text: #1d2433;
19
+ --md2pdf-muted: #5c6577;
20
+ --md2pdf-accent: #3451b2;
21
+ --md2pdf-rule: #e3e7ef;
22
+ --md2pdf-surface: #f5f7fb;
23
+ /* Fonts: --md2pdf-font body text, --md2pdf-heading-font headings (the body font unless set),
24
+ --md2pdf-code-font code. */
25
+ --md2pdf-font: "Avenir Next", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
26
+ --md2pdf-heading-font: var(--md2pdf-font);
27
+ --md2pdf-code-font: "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
28
+ }
29
+
30
+ .markdown-body {
31
+ font-family: var(--md2pdf-font);
32
+ background: var(--md2pdf-background);
33
+ font-size: var(--md2pdf-font-size);
34
+ line-height: calc(1 + 0.65 * var(--md2pdf-leading));
35
+ color: var(--md2pdf-text);
36
+ -webkit-print-color-adjust: exact;
37
+ print-color-adjust: exact;
38
+ }
39
+
40
+ .markdown-body p {
41
+ margin: 0 0 calc(1em * var(--md2pdf-space));
42
+ orphans: 3;
43
+ widows: 3;
44
+ }
45
+
46
+ /* Headings */
47
+
48
+ .markdown-body h1,
49
+ .markdown-body h2,
50
+ .markdown-body h3,
51
+ .markdown-body h4,
52
+ .markdown-body h5,
53
+ .markdown-body h6 {
54
+ font-family: var(--md2pdf-heading-font);
55
+ font-weight: 600;
56
+ line-height: calc(1 + 0.25 * var(--md2pdf-leading));
57
+ letter-spacing: -0.01em;
58
+ break-after: avoid;
59
+ }
60
+
61
+ .markdown-body h1 {
62
+ font-size: calc(26 / 10.5 * var(--md2pdf-font-size));
63
+ font-weight: 700;
64
+ letter-spacing: -0.02em;
65
+ margin: 0 0 calc(0.9em * var(--md2pdf-space));
66
+ }
67
+ .markdown-body h1:not(:first-child) {
68
+ margin-top: calc(1.6em * var(--md2pdf-space));
69
+ }
70
+
71
+ /* A short accent bar above each section heading. */
72
+ .markdown-body h2 {
73
+ font-size: calc(16 / 10.5 * var(--md2pdf-font-size));
74
+ margin: calc(2em * var(--md2pdf-space)) 0 calc(0.7em * var(--md2pdf-space));
75
+ }
76
+ .markdown-body h2::before {
77
+ content: "";
78
+ display: block;
79
+ width: 2.2em;
80
+ margin-bottom: calc(0.6em * var(--md2pdf-space));
81
+ border-top: 3px solid var(--md2pdf-accent);
82
+ }
83
+
84
+ .markdown-body h3 {
85
+ font-size: calc(12.5 / 10.5 * var(--md2pdf-font-size));
86
+ color: var(--md2pdf-accent);
87
+ margin: calc(1.6em * var(--md2pdf-space)) 0 calc(0.5em * var(--md2pdf-space));
88
+ }
89
+ .markdown-body h4,
90
+ .markdown-body h5,
91
+ .markdown-body h6 {
92
+ font-size: var(--md2pdf-font-size);
93
+ margin: calc(1.4em * var(--md2pdf-space)) 0 calc(0.4em * var(--md2pdf-space));
94
+ }
95
+ .markdown-body h5,
96
+ .markdown-body h6 {
97
+ color: var(--md2pdf-muted);
98
+ }
99
+
100
+ /* Links */
101
+
102
+ .markdown-body a {
103
+ color: var(--md2pdf-accent);
104
+ text-decoration: none;
105
+ }
106
+ .markdown-body a.header-anchor {
107
+ display: none;
108
+ }
109
+
110
+ /* Lists */
111
+
112
+ .markdown-body ul,
113
+ .markdown-body ol {
114
+ margin: 0 0 calc(1em * var(--md2pdf-space));
115
+ padding-left: 1.5em;
116
+ }
117
+ .markdown-body li {
118
+ margin: calc(0.3em * var(--md2pdf-space)) 0;
119
+ }
120
+ .markdown-body li > ul,
121
+ .markdown-body li > ol {
122
+ margin: calc(0.3em * var(--md2pdf-space)) 0 0;
123
+ }
124
+ .markdown-body li::marker {
125
+ color: var(--md2pdf-accent);
126
+ }
127
+ .markdown-body .task-list-item {
128
+ list-style-type: none;
129
+ }
130
+ .markdown-body .task-list-item input {
131
+ margin: 0 0.5em 0.2em -1.5em;
132
+ vertical-align: middle;
133
+ accent-color: var(--md2pdf-accent);
134
+ }
135
+
136
+ /* Quotes */
137
+
138
+ .markdown-body blockquote {
139
+ margin: calc(1.4em * var(--md2pdf-space)) 0;
140
+ padding: 0.1em 0 0.1em 1.2em;
141
+ border-left: 3px solid var(--md2pdf-accent);
142
+ color: var(--md2pdf-muted);
143
+ font-size: calc(11.5 / 10.5 * var(--md2pdf-font-size));
144
+ break-inside: avoid;
145
+ }
146
+ .markdown-body blockquote p:last-child {
147
+ margin-bottom: 0;
148
+ }
149
+
150
+ /* Callouts (GitHub alerts and Obsidian callouts): a tinted card in the callout's color. */
151
+
152
+ .markdown-body .markdown-alert {
153
+ --md2pdf-callout: var(--md2pdf-accent);
154
+ margin: calc(1.4em * var(--md2pdf-space)) 0;
155
+ padding: 0.8em 1.1em;
156
+ border-left: 3px solid var(--md2pdf-callout);
157
+ border-radius: 0 8px 8px 0;
158
+ background: color-mix(in srgb, var(--md2pdf-callout) 7%, var(--md2pdf-background));
159
+ break-inside: avoid;
160
+ }
161
+ .markdown-body .markdown-alert-tip {
162
+ --md2pdf-callout: #1f7a4d;
163
+ }
164
+ .markdown-body .markdown-alert-important {
165
+ --md2pdf-callout: #7048b5;
166
+ }
167
+ .markdown-body .markdown-alert-warning {
168
+ --md2pdf-callout: #a5650b;
169
+ }
170
+ .markdown-body .markdown-alert-caution {
171
+ --md2pdf-callout: #c0392b;
172
+ }
173
+ .markdown-body .markdown-alert-quote {
174
+ --md2pdf-callout: var(--md2pdf-muted);
175
+ }
176
+ .markdown-body .markdown-alert-title {
177
+ margin-bottom: calc(0.4em * var(--md2pdf-space));
178
+ color: var(--md2pdf-callout);
179
+ font-weight: 600;
180
+ }
181
+ .markdown-body .markdown-alert-title .octicon {
182
+ margin-right: 0.5em;
183
+ vertical-align: -0.1em;
184
+ width: 1em;
185
+ height: 1em;
186
+ fill: currentColor;
187
+ }
188
+ .markdown-body .markdown-alert > :last-child {
189
+ margin-bottom: 0;
190
+ }
191
+
192
+ /* Code */
193
+
194
+ .markdown-body code,
195
+ .markdown-body kbd {
196
+ font-family: var(--md2pdf-code-font);
197
+ font-size: 0.86em;
198
+ }
199
+ .markdown-body :not(pre) > code {
200
+ background: var(--md2pdf-surface);
201
+ padding: 0.12em 0.35em;
202
+ border-radius: 4px;
203
+ }
204
+ .markdown-body kbd {
205
+ padding: 0.05em 0.4em;
206
+ border: 1px solid #cdd3df;
207
+ border-bottom-width: 2px;
208
+ border-radius: 4px;
209
+ }
210
+ .markdown-body pre {
211
+ margin: 0 0 calc(1.2em * var(--md2pdf-space));
212
+ padding: 1em 1.2em;
213
+ background: var(--md2pdf-surface);
214
+ border-radius: 8px;
215
+ line-height: calc(1 + 0.5 * var(--md2pdf-leading));
216
+ white-space: pre-wrap;
217
+ word-break: break-word;
218
+ break-inside: avoid;
219
+ }
220
+ .markdown-body pre code {
221
+ font-size: calc(8.5 / 10.5 * var(--md2pdf-font-size));
222
+ }
223
+ /* A highlight.js theme on the host page styles .hljs too; keep code blocks this style's own. */
224
+ .markdown-body pre code.hljs {
225
+ display: inline;
226
+ overflow: visible;
227
+ padding: 0;
228
+ color: inherit;
229
+ background: none;
230
+ }
231
+ /* And its tokens: this outranks a theme's token rules, and this style's colors come after it. */
232
+ .markdown-body [class*="hljs-"] {
233
+ color: inherit;
234
+ background: none;
235
+ font-style: inherit;
236
+ font-weight: inherit;
237
+ text-decoration: none;
238
+ }
239
+
240
+ .markdown-body .hljs-comment,
241
+ .markdown-body .hljs-quote {
242
+ color: #8790a3;
243
+ font-style: italic;
244
+ }
245
+ .markdown-body .hljs-keyword,
246
+ .markdown-body .hljs-selector-tag,
247
+ .markdown-body .hljs-literal,
248
+ .markdown-body .hljs-doctag {
249
+ color: #3451b2;
250
+ font-weight: 600;
251
+ }
252
+ .markdown-body .hljs-string,
253
+ .markdown-body .hljs-regexp,
254
+ .markdown-body .hljs-addition {
255
+ color: #2e7d5b;
256
+ }
257
+ .markdown-body .hljs-number,
258
+ .markdown-body .hljs-symbol,
259
+ .markdown-body .hljs-bullet {
260
+ color: #b5531d;
261
+ }
262
+ .markdown-body .hljs-title,
263
+ .markdown-body .hljs-section,
264
+ .markdown-body .hljs-name {
265
+ color: #1d2433;
266
+ font-weight: 600;
267
+ }
268
+ .markdown-body .hljs-built_in,
269
+ .markdown-body .hljs-type,
270
+ .markdown-body .hljs-attr,
271
+ .markdown-body .hljs-attribute,
272
+ .markdown-body .hljs-variable,
273
+ .markdown-body .hljs-template-variable {
274
+ color: #7a4fb8;
275
+ }
276
+ .markdown-body .hljs-meta,
277
+ .markdown-body .hljs-deletion {
278
+ color: #b42318;
279
+ }
280
+ .markdown-body .hljs-emphasis {
281
+ font-style: italic;
282
+ }
283
+ .markdown-body .hljs-strong {
284
+ font-weight: bold;
285
+ }
286
+
287
+ /* Tables: light rules between rows, a small muted header. */
288
+
289
+ .markdown-body table {
290
+ width: 100%;
291
+ border-collapse: collapse;
292
+ margin: calc(1.4em * var(--md2pdf-space)) 0;
293
+ font-size: calc(9.5 / 10.5 * var(--md2pdf-font-size));
294
+ font-variant-numeric: tabular-nums;
295
+ }
296
+ .markdown-body th,
297
+ .markdown-body td {
298
+ padding: 0.55em 0.8em;
299
+ text-align: left;
300
+ border-bottom: 1px solid var(--md2pdf-rule);
301
+ }
302
+ .markdown-body th {
303
+ font-size: calc(8 / 10.5 * var(--md2pdf-font-size));
304
+ font-weight: 600;
305
+ letter-spacing: 0.06em;
306
+ text-transform: uppercase;
307
+ color: var(--md2pdf-muted);
308
+ border-bottom: 1.5px solid var(--md2pdf-text);
309
+ }
310
+ .markdown-body tr {
311
+ break-inside: avoid;
312
+ }
313
+
314
+ /* Rules, images and diagrams */
315
+
316
+ .markdown-body hr {
317
+ margin: calc(2.2em * var(--md2pdf-space)) 0;
318
+ border: 0;
319
+ border-top: 1px solid var(--md2pdf-rule);
320
+ }
321
+
322
+ .markdown-body img {
323
+ display: block;
324
+ max-width: 100%;
325
+ margin: calc(1.4em * var(--md2pdf-space)) auto;
326
+ border-radius: 6px;
327
+ break-inside: avoid;
328
+ }
329
+
330
+ .markdown-body .mermaid-diagram {
331
+ margin: calc(1.6em * var(--md2pdf-space)) 0;
332
+ }
333
+
334
+ /* Footnotes */
335
+
336
+ .markdown-body hr.footnotes-sep {
337
+ display: none;
338
+ }
339
+ .markdown-body .footnotes {
340
+ margin-top: calc(3em * var(--md2pdf-space));
341
+ padding-top: 1em;
342
+ border-top: 1px solid var(--md2pdf-rule);
343
+ font-size: calc(8.5 / 10.5 * var(--md2pdf-font-size));
344
+ color: var(--md2pdf-muted);
345
+ }
346
+ .markdown-body .footnotes ol {
347
+ padding-left: 1.3em;
348
+ }
349
+ .markdown-body .footnotes li {
350
+ margin: calc(0.2em * var(--md2pdf-space)) 0;
351
+ }
352
+ .markdown-body .footnotes p {
353
+ margin: 0;
354
+ }
355
+
356
+ /* An Obsidian embed (![[Other note]]) that can't be shown: a muted placeholder. */
357
+ .markdown-body .markdown-embed {
358
+ color: var(--md2pdf-muted);
359
+ font-style: italic;
360
+ }
361
+
362
+ /* <div class="page-break"></div> starts a new page. */
363
+ .markdown-body .page-break {
364
+ break-after: page;
365
+ }
@@ -0,0 +1,22 @@
1
+ /* Academic: the print-only rules (page margins, running headers and page numbers). Load after
2
+ ../academic.css when printing; a page that only shows the document on screen leaves this out. */
3
+
4
+ @page {
5
+ margin: 1in 1.15in;
6
+ /* An empty top box stops browsers from adding their own date/title header. */
7
+ @top-center {
8
+ content: "";
9
+ }
10
+ @bottom-center {
11
+ content: counter(page);
12
+ font-family: Palatino, "Palatino Linotype", "Book Antiqua", "URW Palladio L", "TeX Gyre Pagella", Georgia, serif;
13
+ font-size: 10pt;
14
+ color: #111;
15
+ }
16
+ }
17
+
18
+ html,
19
+ body {
20
+ margin: 0;
21
+ background: #fff;
22
+ }
@@ -0,0 +1,27 @@
1
+ /* Classic: the print-only rules (page margins, running headers and page numbers). Load after
2
+ ../classic.css when printing; a page that only shows the document on screen leaves this out. */
3
+
4
+ @page {
5
+ margin: 1in 1.1in 0.9in;
6
+ /* An empty top box stops browsers from adding their own date/title header. */
7
+ @top-center {
8
+ content: "";
9
+ }
10
+ @bottom-center {
11
+ content: counter(page);
12
+ font-family: "Iowan Old Style", Charter, Palatino, Georgia, serif;
13
+ font-size: 9pt;
14
+ color: #6b645b;
15
+ }
16
+ }
17
+ @page :first {
18
+ @bottom-center {
19
+ content: "";
20
+ }
21
+ }
22
+
23
+ html,
24
+ body {
25
+ margin: 0;
26
+ background: #fff;
27
+ }
@@ -0,0 +1,26 @@
1
+ /* GitHub: the print-only rules (page margins). Load after ../github.css when printing; a page that
2
+ only shows the document on screen leaves this out. */
3
+
4
+ @page {
5
+ margin: 0.75in 0.7in;
6
+ /* Empty margin boxes stop browsers from adding their own date/URL headers and footers
7
+ when printing from the website. */
8
+ @top-center {
9
+ content: "";
10
+ }
11
+ @bottom-center {
12
+ content: "";
13
+ }
14
+ }
15
+
16
+ html,
17
+ body {
18
+ margin: 0;
19
+ background: #fff;
20
+ }
21
+
22
+ .markdown-body {
23
+ max-width: none;
24
+ margin: 0;
25
+ padding: 0;
26
+ }
@@ -0,0 +1,30 @@
1
+ /* Modern: the print-only rules (page margins, running headers and page numbers). Load after
2
+ ../modern.css when printing; a page that only shows the document on screen leaves this out. */
3
+
4
+ @page {
5
+ margin: 0.9in 1in;
6
+ /* Empty boxes stop browsers from adding their own date/title header and URL/page footer. */
7
+ @top-center {
8
+ content: "";
9
+ }
10
+ @bottom-center {
11
+ content: "";
12
+ }
13
+ @bottom-right {
14
+ content: counter(page);
15
+ font-family: "Avenir Next", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
16
+ font-size: 8.5pt;
17
+ color: #5c6577;
18
+ }
19
+ }
20
+ @page :first {
21
+ @bottom-right {
22
+ content: "";
23
+ }
24
+ }
25
+
26
+ html,
27
+ body {
28
+ margin: 0;
29
+ background: #fff;
30
+ }
@@ -0,0 +1,60 @@
1
+ /* Report: the print-only rules (page margins, running headers and page numbers). Load after
2
+ ../report.css when printing; a page that only shows the document on screen leaves this out. */
3
+
4
+ :root {
5
+ /* The document's first heading, for the running header; set by the renderer or the page showing it. */
6
+ --document-title: "";
7
+ }
8
+
9
+ @page {
10
+ margin: 1in 1in 0.9in;
11
+ @top-left {
12
+ content: var(--document-title);
13
+ vertical-align: bottom;
14
+ margin-bottom: 18pt;
15
+ padding-bottom: 6pt;
16
+ border-bottom: 0.75pt solid #b9c3cf;
17
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
18
+ font-size: 8pt;
19
+ color: #5f6b7a;
20
+ }
21
+ /* Empty boxes carry the header rule across the page and stop browsers adding their own header. */
22
+ @top-center {
23
+ content: "";
24
+ margin-bottom: 18pt;
25
+ border-bottom: 0.75pt solid #b9c3cf;
26
+ }
27
+ @top-right {
28
+ content: "";
29
+ margin-bottom: 18pt;
30
+ border-bottom: 0.75pt solid #b9c3cf;
31
+ }
32
+ @bottom-center {
33
+ content: "";
34
+ }
35
+ @bottom-right {
36
+ content: "Page " counter(page) " of " counter(pages);
37
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
38
+ font-size: 8pt;
39
+ color: #5f6b7a;
40
+ }
41
+ }
42
+ /* The title block replaces the header on the first page. */
43
+ @page :first {
44
+ @top-left {
45
+ content: "";
46
+ border: 0;
47
+ }
48
+ @top-center {
49
+ border: 0;
50
+ }
51
+ @top-right {
52
+ border: 0;
53
+ }
54
+ }
55
+
56
+ html,
57
+ body {
58
+ margin: 0;
59
+ background: #fff;
60
+ }
@@ -0,0 +1,19 @@
1
+ /* Résumé: the print-only rules (page margins, running headers and page numbers). Load after
2
+ ../resume.css when printing; a page that only shows the document on screen leaves this out. */
3
+
4
+ @page {
5
+ margin: 0.6in 0.7in;
6
+ /* Empty boxes stop browsers from adding their own date/title header and URL footer. */
7
+ @top-center {
8
+ content: "";
9
+ }
10
+ @bottom-center {
11
+ content: "";
12
+ }
13
+ }
14
+
15
+ html,
16
+ body {
17
+ margin: 0;
18
+ background: #fff;
19
+ }