@threepenny/md2pdf 2.3.0 → 2.5.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threepenny/md2pdf",
3
- "version": "2.3.0",
3
+ "version": "2.5.0",
4
4
  "description": "Markdown to beautifully styled PDF: the renderer and macOS CLI behind md2pdf.me",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -33,14 +33,15 @@
33
33
  "demo": "echo 'Open http://localhost:3900/demo/' && python3 -m http.server 3900 --bind 127.0.0.1"
34
34
  },
35
35
  "dependencies": {
36
+ "entities": "^8.0.0",
36
37
  "github-markdown-css": "5.9.0",
37
38
  "highlight.js": "^11.12.0",
39
+ "katex": "^0.19.1",
38
40
  "markdown-it": "^15.0.2",
39
41
  "markdown-it-emoji": "^3.1.0",
40
42
  "markdown-it-footnote": "^4.0.0"
41
43
  },
42
44
  "devDependencies": {
43
- "katex": "^0.19.1",
44
45
  "markdown-it-task-lists": "^2.1.1",
45
46
  "markdown-it-texmath": "^1.0.0"
46
47
  }
@@ -383,7 +383,8 @@
383
383
  break-after: avoid;
384
384
  }
385
385
  .markdown-body .footnotes ol {
386
- padding-left: 1.4em;
386
+ /* Room for numbers up to 99, which Safari sets further left than Chrome. */
387
+ padding-left: 2em;
387
388
  }
388
389
  .markdown-body .footnotes p + p {
389
390
  text-indent: 0;
@@ -397,6 +398,11 @@
397
398
  display: none;
398
399
  }
399
400
 
401
+ /* A word joiner keeps a footnote mark on the line with the word before it. */
402
+ .markdown-body .footnote-ref::before {
403
+ content: "\2060";
404
+ }
405
+
400
406
  /* An Obsidian embed (![[Other note]]) that can't be shown: a muted placeholder. */
401
407
  .markdown-body .markdown-embed {
402
408
  color: var(--md2pdf-muted);
@@ -407,3 +413,14 @@
407
413
  .markdown-body .page-break {
408
414
  break-after: page;
409
415
  }
416
+
417
+ /* Safari's PDFs copy a ligature as the wrong characters ("The" pastes as "!e", "ffi" as "ffi"), so it
418
+ prints without them. An element's own font-feature-settings or `font` shorthand undoes this; set
419
+ its features with font-variant-* instead. */
420
+ @media print {
421
+ @supports (font: -apple-system-body) {
422
+ .markdown-body {
423
+ font-feature-settings: "liga" 0, "clig" 0;
424
+ }
425
+ }
426
+ }
@@ -375,13 +375,19 @@
375
375
  break-after: avoid;
376
376
  }
377
377
  .markdown-body .footnotes ol {
378
- padding-left: 1.2em;
378
+ /* Room for numbers up to 99, which Safari sets further left than Chrome. */
379
+ padding-left: 2.2em;
379
380
  }
380
381
  .markdown-body .footnote-ref a,
381
382
  .markdown-body .footnote-backref {
382
383
  color: var(--md2pdf-accent);
383
384
  }
384
385
 
386
+ /* A word joiner keeps a footnote mark on the line with the word before it. */
387
+ .markdown-body .footnote-ref::before {
388
+ content: "\2060";
389
+ }
390
+
385
391
  /* An Obsidian embed (![[Other note]]) that can't be shown: a muted placeholder. */
386
392
  .markdown-body .markdown-embed {
387
393
  color: var(--md2pdf-muted);
@@ -392,3 +398,14 @@
392
398
  .markdown-body .page-break {
393
399
  break-after: page;
394
400
  }
401
+
402
+ /* Safari's PDFs copy a ligature as the wrong characters ("The" pastes as "!e", "ffi" as "ffi"), so it
403
+ prints without them. An element's own font-feature-settings or `font` shorthand undoes this; set
404
+ its features with font-variant-* instead. */
405
+ @media print {
406
+ @supports (font: -apple-system-body) {
407
+ .markdown-body {
408
+ font-feature-settings: "liga" 0, "clig" 0;
409
+ }
410
+ }
411
+ }
@@ -682,6 +682,11 @@
682
682
  text-decoration: none;
683
683
  }
684
684
 
685
+ /* A word joiner keeps a footnote mark on the line with the word before it. */
686
+ .markdown-body .footnote-ref::before {
687
+ content: "\2060";
688
+ }
689
+
685
690
  /* An Obsidian embed (![[Other note]]) that can't be shown: a muted placeholder. */
686
691
  .markdown-body .markdown-embed {
687
692
  color: var(--md2pdf-muted);
@@ -692,3 +697,14 @@
692
697
  .markdown-body .page-break {
693
698
  break-after: page;
694
699
  }
700
+
701
+ /* Safari's PDFs copy a ligature as the wrong characters ("The" pastes as "!e", "ffi" as "ffi"), so it
702
+ prints without them. An element's own font-feature-settings or `font` shorthand undoes this; set
703
+ its features with font-variant-* instead. */
704
+ @media print {
705
+ @supports (font: -apple-system-body) {
706
+ .markdown-body {
707
+ font-feature-settings: "liga" 0, "clig" 0;
708
+ }
709
+ }
710
+ }
package/styles/elvish.css CHANGED
@@ -631,6 +631,11 @@
631
631
  text-decoration: none;
632
632
  }
633
633
 
634
+ /* A word joiner keeps a footnote mark on the line with the word before it. */
635
+ .markdown-body .footnote-ref::before {
636
+ content: "\2060";
637
+ }
638
+
634
639
  /* An Obsidian embed (![[Other note]]) that can't be shown: a muted placeholder. */
635
640
  .markdown-body .markdown-embed {
636
641
  color: var(--md2pdf-muted);
@@ -641,3 +646,14 @@
641
646
  .markdown-body .page-break {
642
647
  break-after: page;
643
648
  }
649
+
650
+ /* Safari's PDFs copy a ligature as the wrong characters ("The" pastes as "!e", "ffi" as "ffi"), so it
651
+ prints without them. An element's own font-feature-settings or `font` shorthand undoes this; set
652
+ its features with font-variant-* instead. */
653
+ @media print {
654
+ @supports (font: -apple-system-body) {
655
+ .markdown-body {
656
+ font-feature-settings: "liga" 0, "clig" 0;
657
+ }
658
+ }
659
+ }
package/styles/github.css CHANGED
@@ -12,7 +12,7 @@
12
12
  --md2pdf-leading: 1;
13
13
  --md2pdf-space: 1;
14
14
  /* Colors: --md2pdf-background the document's background; --md2pdf-text body text; --md2pdf-muted
15
- quotes, footnotes and secondary text; --md2pdf-accent links. */
15
+ quotes, footnotes and secondary text; --md2pdf-accent links and focus rings. */
16
16
  --md2pdf-background: #fff;
17
17
  --md2pdf-text: #1f2328;
18
18
  --md2pdf-muted: #59636e;
@@ -24,6 +24,14 @@
24
24
  --md2pdf-code-font: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;
25
25
  }
26
26
 
27
+ /* github-markdown-light.css draws focus rings, and <kbd>'s border and shadow, in these colors but
28
+ leaves them to github-markdown.css to define. Undefined, the ring turns off the browser's own, and
29
+ <kbd> loses its border and shadow. --borderColor-muted is github-markdown.css's light value (5.9.0). */
30
+ :where(.markdown-body) {
31
+ --borderColor-accent-emphasis: var(--md2pdf-accent);
32
+ --borderColor-muted: #d1d9e0b3;
33
+ }
34
+
27
35
  /* highlight.js's GitHub theme, limited to the document. From highlight.js 11.12.0.
28
36
  On .hljs itself, :where() keeps each selector's specificity what it is in the theme, so the rules
29
37
  below still override it. The token rules take .markdown-body's specificity, to outrank a theme on
@@ -188,6 +196,18 @@
188
196
  font-family: var(--md2pdf-code-font);
189
197
  }
190
198
 
199
+ /* github-markdown-css sets footnotes and keys in px, so they're restated as their share of the text
200
+ size, the same at 11pt. A key's padding stays github-markdown-css's 0.25rem (3pt here) but shrinks
201
+ with smaller text, or the key, border included, makes its line taller. */
202
+ .markdown-body .footnotes {
203
+ font-size: calc(9 / 11 * var(--md2pdf-font-size));
204
+ }
205
+ .markdown-body kbd {
206
+ padding: min(0.25rem, calc(3 / 11 * var(--md2pdf-font-size)));
207
+ font-size: calc(8.25 / 11 * var(--md2pdf-font-size));
208
+ line-height: calc(7.5 / 11 * var(--md2pdf-font-size));
209
+ }
210
+
191
211
  /* github-markdown-css sets line heights in px and gaps in rem (12pt here), so they're restated with the
192
212
  spacing variables applied, and the gaps as multiples of the text size so they follow it rather than
193
213
  the page's root font size. */
@@ -319,6 +339,15 @@
319
339
  .markdown-body hr.footnotes-sep {
320
340
  display: none;
321
341
  }
342
+ .markdown-body .footnotes ol {
343
+ /* Room for numbers up to 99, which Safari sets further left than Chrome. */
344
+ padding-left: 2.4em;
345
+ }
346
+
347
+ /* A word joiner keeps a footnote mark on the line with the word before it. */
348
+ .markdown-body .footnote-ref::before {
349
+ content: "\2060";
350
+ }
322
351
 
323
352
  /* An Obsidian embed (![[Other note]]) that can't be shown: a muted placeholder. */
324
353
  .markdown-body .markdown-embed {
@@ -330,3 +359,14 @@
330
359
  .markdown-body .page-break {
331
360
  break-after: page;
332
361
  }
362
+
363
+ /* Safari's PDFs copy a ligature as the wrong characters ("The" pastes as "!e", "ffi" as "ffi"), so it
364
+ prints without them. An element's own font-feature-settings or `font` shorthand undoes this; set
365
+ its features with font-variant-* instead. */
366
+ @media print {
367
+ @supports (font: -apple-system-body) {
368
+ .markdown-body {
369
+ font-feature-settings: "liga" 0, "clig" 0;
370
+ }
371
+ }
372
+ }
package/styles/gothic.css CHANGED
@@ -15,9 +15,9 @@
15
15
  --md2pdf-leading: 1;
16
16
  --md2pdf-space: 1;
17
17
  /* Colors: --md2pdf-background the document's background; --md2pdf-text body text; --md2pdf-muted
18
- secondary text; --md2pdf-accent h1, h2 and h4, the drop cap, links, list markers, quote bars,
19
- tick boxes, caution callouts, table headings and rules, and the footnote rule (the leaf ornaments
20
- stay oxblood); --md2pdf-rule thin rules and borders;
18
+ secondary text; --md2pdf-accent h1, h2 and h4, the drop cap, links, bold text, list markers,
19
+ quote bars, tick boxes, caution callouts, table headings and rules, and the footnote rule (the
20
+ leaf ornaments stay oxblood); --md2pdf-rule thin rules and borders;
21
21
  --md2pdf-surface code and callout backgrounds. */
22
22
  --md2pdf-background: #fff;
23
23
  --md2pdf-text: #1c1916;
@@ -35,8 +35,8 @@
35
35
  /* IM Fell English (Igino Marini) and Grenze Gotisch (Omnibus-Type), both under the SIL Open Font
36
36
  License; the licences are in fonts/im-fell-english/OFL.txt and fonts/grenze-gotisch/OFL.txt. Their
37
37
  latin subsets cover English and Western European languages (Basic Latin and Latin-1, plus œ and
38
- €); other letters come from the fallbacks. IM Fell has no bold, so bold text is the browser's
39
- thickening of the regular face. */
38
+ €); other letters come from the fallbacks. IM Fell has no bold, so bold text is set in color
39
+ instead (see Bold below). */
40
40
  @font-face {
41
41
  font-family: "md2pdf IM Fell English";
42
42
  font-weight: 400;
@@ -199,6 +199,19 @@
199
199
  display: none;
200
200
  }
201
201
 
202
+ /* Bold: oxblood at the weight around it, and body-text color inside text that's already oxblood or a
203
+ callout's color. IM Fell has no bold, and Safari fakes one by drawing each letter three times,
204
+ which puts every bold word in the PDF's text three times. */
205
+
206
+ .markdown-body strong,
207
+ .markdown-body b {
208
+ font-weight: inherit;
209
+ color: var(--md2pdf-accent);
210
+ }
211
+ .markdown-body :is(h1, h2, h4, a, th, .markdown-alert-title) :is(strong, b) {
212
+ color: var(--md2pdf-text);
213
+ }
214
+
202
215
  /* Lists */
203
216
 
204
217
  .markdown-body ul,
@@ -462,6 +475,11 @@
462
475
  color: var(--md2pdf-accent);
463
476
  }
464
477
 
478
+ /* A word joiner keeps a footnote mark on the line with the word before it. */
479
+ .markdown-body .footnote-ref::before {
480
+ content: "\2060";
481
+ }
482
+
465
483
  /* An Obsidian embed (![[Other note]]) that can't be shown: a muted placeholder. */
466
484
  .markdown-body .markdown-embed {
467
485
  color: var(--md2pdf-muted);
@@ -472,3 +490,14 @@
472
490
  .markdown-body .page-break {
473
491
  break-after: page;
474
492
  }
493
+
494
+ /* Safari's PDFs copy a ligature as the wrong characters ("The" pastes as "!e", "ffi" as "ffi"), so it
495
+ prints without them. An element's own font-feature-settings or `font` shorthand undoes this; set
496
+ its features with font-variant-* instead. */
497
+ @media print {
498
+ @supports (font: -apple-system-body) {
499
+ .markdown-body {
500
+ font-feature-settings: "liga" 0, "clig" 0;
501
+ }
502
+ }
503
+ }
package/styles/modern.css CHANGED
@@ -357,7 +357,8 @@
357
357
  color: var(--md2pdf-muted);
358
358
  }
359
359
  .markdown-body .footnotes ol {
360
- padding-left: 1.3em;
360
+ /* Room for numbers up to 99, which Safari sets further left than Chrome. */
361
+ padding-left: 2.2em;
361
362
  }
362
363
  .markdown-body .footnotes li {
363
364
  margin: calc(0.2em * var(--md2pdf-space)) 0;
@@ -366,6 +367,11 @@
366
367
  margin: 0;
367
368
  }
368
369
 
370
+ /* A word joiner keeps a footnote mark on the line with the word before it. */
371
+ .markdown-body .footnote-ref::before {
372
+ content: "\2060";
373
+ }
374
+
369
375
  /* An Obsidian embed (![[Other note]]) that can't be shown: a muted placeholder. */
370
376
  .markdown-body .markdown-embed {
371
377
  color: var(--md2pdf-muted);
@@ -376,3 +382,14 @@
376
382
  .markdown-body .page-break {
377
383
  break-after: page;
378
384
  }
385
+
386
+ /* Safari's PDFs copy a ligature as the wrong characters ("The" pastes as "!e", "ffi" as "ffi"), so it
387
+ prints without them. An element's own font-feature-settings or `font` shorthand undoes this; set
388
+ its features with font-variant-* instead. */
389
+ @media print {
390
+ @supports (font: -apple-system-body) {
391
+ .markdown-body {
392
+ font-feature-settings: "liga" 0, "clig" 0;
393
+ }
394
+ }
395
+ }
@@ -20,3 +20,36 @@ body {
20
20
  margin: 0;
21
21
  background: #fff;
22
22
  }
23
+
24
+ /* A PDF can't be clicked, so a collapsed section prints open, its summary kept with what follows. After it
25
+ comes a paragraph's space, or its last block's if that is more. A section that ends a quote, callout,
26
+ table cell, or the last item of a list inside one of those or another list, gives up that space, and so
27
+ do the sections and last block inside it, up to three sections deep, so none shows inside; at the end of
28
+ a nested list, the next item is then an item's space away, as after text. */
29
+ .markdown-body details {
30
+ margin-bottom: calc(0.6em * var(--md2pdf-space));
31
+ }
32
+ .markdown-body :is(blockquote, .markdown-alert, td, th, :is(blockquote, .markdown-alert, td, th, li) :is(ul, ol) > li:last-child) > details:last-child,
33
+ .markdown-body :is(blockquote, .markdown-alert, td, th, :is(blockquote, .markdown-alert, td, th, li) :is(ul, ol) > li:last-child) > details:last-child > :last-child,
34
+ .markdown-body :is(blockquote, .markdown-alert, td, th, :is(blockquote, .markdown-alert, td, th, li) :is(ul, ol) > li:last-child) > details:last-child > details:last-child > :last-child,
35
+ .markdown-body :is(blockquote, .markdown-alert, td, th, :is(blockquote, .markdown-alert, td, th, li) :is(ul, ol) > li:last-child) > details:last-child > details:last-child > details:last-child > :last-child {
36
+ margin-bottom: 0;
37
+ }
38
+ .markdown-body details::details-content {
39
+ content-visibility: visible;
40
+ }
41
+ .markdown-body details:not([open]) > summary {
42
+ list-style-type: disclosure-open;
43
+ }
44
+ .markdown-body details > summary {
45
+ break-after: avoid;
46
+ }
47
+
48
+ /* Nothing follows the document's last block, so Safari keeps no space below it: it starts a blank
49
+ page for that space when it runs past the end of a page. Only Safari, since Chrome's margin-trim
50
+ also drops the space above a block that a page break moves. */
51
+ @supports (font: -apple-system-body) {
52
+ .markdown-body {
53
+ margin-trim: block-end;
54
+ }
55
+ }
@@ -25,3 +25,36 @@ body {
25
25
  margin: 0;
26
26
  background: #fff;
27
27
  }
28
+
29
+ /* A PDF can't be clicked, so a collapsed section prints open, its summary kept with what follows. After it
30
+ comes a paragraph's space, or its last block's if that is more. A section that ends a quote, callout,
31
+ table cell, or the last item of a list inside one of those or another list, gives up that space, and so
32
+ do the sections and last block inside it, up to three sections deep, so none shows inside; at the end of
33
+ a nested list, the next item is then an item's space away, as after text. */
34
+ .markdown-body details {
35
+ margin-bottom: calc(0.75em * var(--md2pdf-space));
36
+ }
37
+ .markdown-body :is(blockquote, .markdown-alert, td, th, :is(blockquote, .markdown-alert, td, th, li) :is(ul, ol) > li:last-child) > details:last-child,
38
+ .markdown-body :is(blockquote, .markdown-alert, td, th, :is(blockquote, .markdown-alert, td, th, li) :is(ul, ol) > li:last-child) > details:last-child > :last-child,
39
+ .markdown-body :is(blockquote, .markdown-alert, td, th, :is(blockquote, .markdown-alert, td, th, li) :is(ul, ol) > li:last-child) > details:last-child > details:last-child > :last-child,
40
+ .markdown-body :is(blockquote, .markdown-alert, td, th, :is(blockquote, .markdown-alert, td, th, li) :is(ul, ol) > li:last-child) > details:last-child > details:last-child > details:last-child > :last-child {
41
+ margin-bottom: 0;
42
+ }
43
+ .markdown-body details::details-content {
44
+ content-visibility: visible;
45
+ }
46
+ .markdown-body details:not([open]) > summary {
47
+ list-style-type: disclosure-open;
48
+ }
49
+ .markdown-body details > summary {
50
+ break-after: avoid;
51
+ }
52
+
53
+ /* Nothing follows the document's last block, so Safari keeps no space below it: it starts a blank
54
+ page for that space when it runs past the end of a page. Only Safari, since Chrome's margin-trim
55
+ also drops the space above a block that a page break moves. */
56
+ @supports (font: -apple-system-body) {
57
+ .markdown-body {
58
+ margin-trim: block-end;
59
+ }
60
+ }
@@ -90,3 +90,36 @@ body {
90
90
  margin: 0;
91
91
  background: #fff;
92
92
  }
93
+
94
+ /* A PDF can't be clicked, so a collapsed section prints open, its summary kept with what follows. After it
95
+ comes a paragraph's space, or its last block's if that is more. A section that ends a quote, callout,
96
+ table cell, or the last item of a list inside one of those or another list, gives up that space, and so
97
+ do the sections and last block inside it, up to three sections deep, so none shows inside; at the end of
98
+ a nested list, the next item is then an item's space away, as after text. */
99
+ .markdown-body details {
100
+ margin-bottom: calc(0.8em * var(--md2pdf-space));
101
+ }
102
+ .markdown-body :is(blockquote, .markdown-alert, td, th, :is(blockquote, .markdown-alert, td, th, li) :is(ul, ol) > li:last-child) > details:last-child,
103
+ .markdown-body :is(blockquote, .markdown-alert, td, th, :is(blockquote, .markdown-alert, td, th, li) :is(ul, ol) > li:last-child) > details:last-child > :last-child,
104
+ .markdown-body :is(blockquote, .markdown-alert, td, th, :is(blockquote, .markdown-alert, td, th, li) :is(ul, ol) > li:last-child) > details:last-child > details:last-child > :last-child,
105
+ .markdown-body :is(blockquote, .markdown-alert, td, th, :is(blockquote, .markdown-alert, td, th, li) :is(ul, ol) > li:last-child) > details:last-child > details:last-child > details:last-child > :last-child {
106
+ margin-bottom: 0;
107
+ }
108
+ .markdown-body details::details-content {
109
+ content-visibility: visible;
110
+ }
111
+ .markdown-body details:not([open]) > summary {
112
+ list-style-type: disclosure-open;
113
+ }
114
+ .markdown-body details > summary {
115
+ break-after: avoid;
116
+ }
117
+
118
+ /* Nothing follows the document's last block, so Safari keeps no space below it: it starts a blank
119
+ page for that space when it runs past the end of a page. Only Safari, since Chrome's margin-trim
120
+ also drops the space above a block that a page break moves. */
121
+ @supports (font: -apple-system-body) {
122
+ .markdown-body {
123
+ margin-trim: block-end;
124
+ }
125
+ }
@@ -67,3 +67,36 @@ body {
67
67
  margin: 0;
68
68
  background: #fff;
69
69
  }
70
+
71
+ /* A PDF can't be clicked, so a collapsed section prints open, its summary kept with what follows. After it
72
+ comes a paragraph's space, or its last block's if that is more. A section that ends a quote, callout,
73
+ table cell, or the last item of a list inside one of those or another list, gives up that space, and so
74
+ do the sections and last block inside it, up to three sections deep, so none shows inside; at the end of
75
+ a nested list, the next item is then an item's space away, as after text. */
76
+ .markdown-body details {
77
+ margin-bottom: calc(0.75em * var(--md2pdf-space));
78
+ }
79
+ .markdown-body :is(blockquote, .markdown-alert, td, th, :is(blockquote, .markdown-alert, td, th, li) :is(ul, ol) > li:last-child) > details:last-child,
80
+ .markdown-body :is(blockquote, .markdown-alert, td, th, :is(blockquote, .markdown-alert, td, th, li) :is(ul, ol) > li:last-child) > details:last-child > :last-child,
81
+ .markdown-body :is(blockquote, .markdown-alert, td, th, :is(blockquote, .markdown-alert, td, th, li) :is(ul, ol) > li:last-child) > details:last-child > details:last-child > :last-child,
82
+ .markdown-body :is(blockquote, .markdown-alert, td, th, :is(blockquote, .markdown-alert, td, th, li) :is(ul, ol) > li:last-child) > details:last-child > details:last-child > details:last-child > :last-child {
83
+ margin-bottom: 0;
84
+ }
85
+ .markdown-body details::details-content {
86
+ content-visibility: visible;
87
+ }
88
+ .markdown-body details:not([open]) > summary {
89
+ list-style-type: disclosure-open;
90
+ }
91
+ .markdown-body details > summary {
92
+ break-after: avoid;
93
+ }
94
+
95
+ /* Nothing follows the document's last block, so Safari keeps no space below it: it starts a blank
96
+ page for that space when it runs past the end of a page. Only Safari, since Chrome's margin-trim
97
+ also drops the space above a block that a page break moves. */
98
+ @supports (font: -apple-system-body) {
99
+ .markdown-body {
100
+ margin-trim: block-end;
101
+ }
102
+ }
@@ -19,6 +19,26 @@ body {
19
19
  background: #fff;
20
20
  }
21
21
 
22
+ /* A PDF can't be clicked, so a collapsed section prints open, its summary kept with what follows. A
23
+ section that ends a quote, callout, table cell, or the last item of a list inside one of those or another
24
+ list, gives up the space below it, and so do the sections and last block inside it, up to three sections
25
+ deep, so none shows inside. */
26
+ .markdown-body :is(blockquote, .markdown-alert, td, th, :is(blockquote, .markdown-alert, td, th, li) :is(ul, ol) > li:last-child) > details:last-child,
27
+ .markdown-body :is(blockquote, .markdown-alert, td, th, :is(blockquote, .markdown-alert, td, th, li) :is(ul, ol) > li:last-child) > details:last-child > :last-child,
28
+ .markdown-body :is(blockquote, .markdown-alert, td, th, :is(blockquote, .markdown-alert, td, th, li) :is(ul, ol) > li:last-child) > details:last-child > details:last-child > :last-child,
29
+ .markdown-body :is(blockquote, .markdown-alert, td, th, :is(blockquote, .markdown-alert, td, th, li) :is(ul, ol) > li:last-child) > details:last-child > details:last-child > details:last-child > :last-child {
30
+ margin-bottom: 0;
31
+ }
32
+ .markdown-body details::details-content {
33
+ content-visibility: visible;
34
+ }
35
+ .markdown-body details:not([open]) > summary {
36
+ list-style-type: disclosure-open;
37
+ }
38
+ .markdown-body details > summary {
39
+ break-after: avoid;
40
+ }
41
+
22
42
  .markdown-body {
23
43
  max-width: none;
24
44
  margin: 0;
@@ -30,3 +50,12 @@ body {
30
50
  .markdown-body table {
31
51
  overflow: visible;
32
52
  }
53
+
54
+ /* Nothing follows the document's last block, so Safari keeps no space below it: it starts a blank
55
+ page for that space when it runs past the end of a page. Only Safari, since Chrome's margin-trim
56
+ also drops the space above a block that a page break moves. */
57
+ @supports (font: -apple-system-body) {
58
+ .markdown-body {
59
+ margin-trim: block-end;
60
+ }
61
+ }
@@ -27,3 +27,36 @@ body {
27
27
  margin: 0;
28
28
  background: #fff;
29
29
  }
30
+
31
+ /* A PDF can't be clicked, so a collapsed section prints open, its summary kept with what follows. After it
32
+ comes a paragraph's space, or its last block's if that is more. A section that ends a quote, callout,
33
+ table cell, or the last item of a list inside one of those or another list, gives up that space, and so
34
+ do the sections and last block inside it, up to three sections deep, so none shows inside; at the end of
35
+ a nested list, the next item is then an item's space away, as after text. */
36
+ .markdown-body details {
37
+ margin-bottom: calc(0.75em * var(--md2pdf-space));
38
+ }
39
+ .markdown-body :is(blockquote, .markdown-alert, td, th, :is(blockquote, .markdown-alert, td, th, li) :is(ul, ol) > li:last-child) > details:last-child,
40
+ .markdown-body :is(blockquote, .markdown-alert, td, th, :is(blockquote, .markdown-alert, td, th, li) :is(ul, ol) > li:last-child) > details:last-child > :last-child,
41
+ .markdown-body :is(blockquote, .markdown-alert, td, th, :is(blockquote, .markdown-alert, td, th, li) :is(ul, ol) > li:last-child) > details:last-child > details:last-child > :last-child,
42
+ .markdown-body :is(blockquote, .markdown-alert, td, th, :is(blockquote, .markdown-alert, td, th, li) :is(ul, ol) > li:last-child) > details:last-child > details:last-child > details:last-child > :last-child {
43
+ margin-bottom: 0;
44
+ }
45
+ .markdown-body details::details-content {
46
+ content-visibility: visible;
47
+ }
48
+ .markdown-body details:not([open]) > summary {
49
+ list-style-type: disclosure-open;
50
+ }
51
+ .markdown-body details > summary {
52
+ break-after: avoid;
53
+ }
54
+
55
+ /* Nothing follows the document's last block, so Safari keeps no space below it: it starts a blank
56
+ page for that space when it runs past the end of a page. Only Safari, since Chrome's margin-trim
57
+ also drops the space above a block that a page break moves. */
58
+ @supports (font: -apple-system-body) {
59
+ .markdown-body {
60
+ margin-trim: block-end;
61
+ }
62
+ }
@@ -28,3 +28,36 @@ body {
28
28
  margin: 0;
29
29
  background: #fff;
30
30
  }
31
+
32
+ /* A PDF can't be clicked, so a collapsed section prints open, its summary kept with what follows. After it
33
+ comes a paragraph's space, or its last block's if that is more. A section that ends a quote, callout,
34
+ table cell, or the last item of a list inside one of those or another list, gives up that space, and so
35
+ do the sections and last block inside it, up to three sections deep, so none shows inside; at the end of
36
+ a nested list, the next item is then an item's space away, as after text. */
37
+ .markdown-body details {
38
+ margin-bottom: calc(1em * var(--md2pdf-space));
39
+ }
40
+ .markdown-body :is(blockquote, .markdown-alert, td, th, :is(blockquote, .markdown-alert, td, th, li) :is(ul, ol) > li:last-child) > details:last-child,
41
+ .markdown-body :is(blockquote, .markdown-alert, td, th, :is(blockquote, .markdown-alert, td, th, li) :is(ul, ol) > li:last-child) > details:last-child > :last-child,
42
+ .markdown-body :is(blockquote, .markdown-alert, td, th, :is(blockquote, .markdown-alert, td, th, li) :is(ul, ol) > li:last-child) > details:last-child > details:last-child > :last-child,
43
+ .markdown-body :is(blockquote, .markdown-alert, td, th, :is(blockquote, .markdown-alert, td, th, li) :is(ul, ol) > li:last-child) > details:last-child > details:last-child > details:last-child > :last-child {
44
+ margin-bottom: 0;
45
+ }
46
+ .markdown-body details::details-content {
47
+ content-visibility: visible;
48
+ }
49
+ .markdown-body details:not([open]) > summary {
50
+ list-style-type: disclosure-open;
51
+ }
52
+ .markdown-body details > summary {
53
+ break-after: avoid;
54
+ }
55
+
56
+ /* Nothing follows the document's last block, so Safari keeps no space below it: it starts a blank
57
+ page for that space when it runs past the end of a page. Only Safari, since Chrome's margin-trim
58
+ also drops the space above a block that a page break moves. */
59
+ @supports (font: -apple-system-body) {
60
+ .markdown-body {
61
+ margin-trim: block-end;
62
+ }
63
+ }
@@ -58,3 +58,36 @@ body {
58
58
  margin: 0;
59
59
  background: #fff;
60
60
  }
61
+
62
+ /* A PDF can't be clicked, so a collapsed section prints open, its summary kept with what follows. After it
63
+ comes a paragraph's space, or its last block's if that is more. A section that ends a quote, callout,
64
+ table cell, or the last item of a list inside one of those or another list, gives up that space, and so
65
+ do the sections and last block inside it, up to three sections deep, so none shows inside; at the end of
66
+ a nested list, the next item is then an item's space away, as after text. */
67
+ .markdown-body details {
68
+ margin-bottom: calc(0.8em * var(--md2pdf-space));
69
+ }
70
+ .markdown-body :is(blockquote, .markdown-alert, td, th, :is(blockquote, .markdown-alert, td, th, li) :is(ul, ol) > li:last-child) > details:last-child,
71
+ .markdown-body :is(blockquote, .markdown-alert, td, th, :is(blockquote, .markdown-alert, td, th, li) :is(ul, ol) > li:last-child) > details:last-child > :last-child,
72
+ .markdown-body :is(blockquote, .markdown-alert, td, th, :is(blockquote, .markdown-alert, td, th, li) :is(ul, ol) > li:last-child) > details:last-child > details:last-child > :last-child,
73
+ .markdown-body :is(blockquote, .markdown-alert, td, th, :is(blockquote, .markdown-alert, td, th, li) :is(ul, ol) > li:last-child) > details:last-child > details:last-child > details:last-child > :last-child {
74
+ margin-bottom: 0;
75
+ }
76
+ .markdown-body details::details-content {
77
+ content-visibility: visible;
78
+ }
79
+ .markdown-body details:not([open]) > summary {
80
+ list-style-type: disclosure-open;
81
+ }
82
+ .markdown-body details > summary {
83
+ break-after: avoid;
84
+ }
85
+
86
+ /* Nothing follows the document's last block, so Safari keeps no space below it: it starts a blank
87
+ page for that space when it runs past the end of a page. Only Safari, since Chrome's margin-trim
88
+ also drops the space above a block that a page break moves. */
89
+ @supports (font: -apple-system-body) {
90
+ .markdown-body {
91
+ margin-trim: block-end;
92
+ }
93
+ }