@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/README.md +21 -13
- package/bin/md2pdf.js +165 -28
- package/lib/css.js +35 -8
- package/lib/fit.js +266 -0
- package/lib/math.js +28 -16
- package/lib/page-size.js +20 -0
- package/lib/render.js +141 -15
- package/lib/typography.js +32 -0
- package/package.json +3 -2
- package/styles/academic.css +18 -1
- package/styles/classic.css +18 -1
- package/styles/cyberpunk.css +16 -0
- package/styles/elvish.css +16 -0
- package/styles/github.css +41 -1
- package/styles/gothic.css +34 -5
- package/styles/modern.css +18 -1
- package/styles/print/academic.css +33 -0
- package/styles/print/classic.css +33 -0
- package/styles/print/cyberpunk.css +33 -0
- package/styles/print/elvish.css +33 -0
- package/styles/print/github.css +29 -0
- package/styles/print/gothic.css +33 -0
- package/styles/print/modern.css +33 -0
- package/styles/print/report.css +33 -0
- package/styles/print/resume.css +33 -0
- package/styles/print/sandwake.css +33 -0
- package/styles/print/worksheet.css +33 -0
- package/styles/report.css +18 -1
- package/styles/resume.css +18 -1
- package/styles/sandwake.css +18 -2
- package/styles/worksheet.css +18 -1
package/styles/print/resume.css
CHANGED
|
@@ -17,3 +17,36 @@ body {
|
|
|
17
17
|
margin: 0;
|
|
18
18
|
background: #fff;
|
|
19
19
|
}
|
|
20
|
+
|
|
21
|
+
/* A PDF can't be clicked, so a collapsed section prints open, its summary kept with what follows. After it
|
|
22
|
+
comes a paragraph's space, or its last block's if that is more. A section that ends a quote, callout,
|
|
23
|
+
table cell, or the last item of a list inside one of those or another list, gives up that space, and so
|
|
24
|
+
do the sections and last block inside it, up to three sections deep, so none shows inside; at the end of
|
|
25
|
+
a nested list, the next item is then an item's space away, as after text. */
|
|
26
|
+
.markdown-body details {
|
|
27
|
+
margin-bottom: calc(0.45em * var(--md2pdf-space));
|
|
28
|
+
}
|
|
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,
|
|
30
|
+
.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,
|
|
31
|
+
.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,
|
|
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 > details:last-child > details:last-child > :last-child {
|
|
33
|
+
margin-bottom: 0;
|
|
34
|
+
}
|
|
35
|
+
.markdown-body details::details-content {
|
|
36
|
+
content-visibility: visible;
|
|
37
|
+
}
|
|
38
|
+
.markdown-body details:not([open]) > summary {
|
|
39
|
+
list-style-type: disclosure-open;
|
|
40
|
+
}
|
|
41
|
+
.markdown-body details > summary {
|
|
42
|
+
break-after: avoid;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* Nothing follows the document's last block, so Safari keeps no space below it: it starts a blank
|
|
46
|
+
page for that space when it runs past the end of a page. Only Safari, since Chrome's margin-trim
|
|
47
|
+
also drops the space above a block that a page break moves. */
|
|
48
|
+
@supports (font: -apple-system-body) {
|
|
49
|
+
.markdown-body {
|
|
50
|
+
margin-trim: block-end;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -45,3 +45,36 @@ body {
|
|
|
45
45
|
margin: 0;
|
|
46
46
|
background: #fff;
|
|
47
47
|
}
|
|
48
|
+
|
|
49
|
+
/* A PDF can't be clicked, so a collapsed section prints open, its summary kept with what follows. After it
|
|
50
|
+
comes a paragraph's space, or its last block's if that is more. A section that ends a quote, callout,
|
|
51
|
+
table cell, or the last item of a list inside one of those or another list, gives up that space, and so
|
|
52
|
+
do the sections and last block inside it, up to three sections deep, so none shows inside; at the end of
|
|
53
|
+
a nested list, the next item is then an item's space away, as after text. */
|
|
54
|
+
.markdown-body details {
|
|
55
|
+
margin-bottom: calc(0.75em * var(--md2pdf-space));
|
|
56
|
+
}
|
|
57
|
+
.markdown-body :is(blockquote, .markdown-alert, td, th, :is(blockquote, .markdown-alert, td, th, li) :is(ul, ol) > li:last-child) > details:last-child,
|
|
58
|
+
.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,
|
|
59
|
+
.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,
|
|
60
|
+
.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 {
|
|
61
|
+
margin-bottom: 0;
|
|
62
|
+
}
|
|
63
|
+
.markdown-body details::details-content {
|
|
64
|
+
content-visibility: visible;
|
|
65
|
+
}
|
|
66
|
+
.markdown-body details:not([open]) > summary {
|
|
67
|
+
list-style-type: disclosure-open;
|
|
68
|
+
}
|
|
69
|
+
.markdown-body details > summary {
|
|
70
|
+
break-after: avoid;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* Nothing follows the document's last block, so Safari keeps no space below it: it starts a blank
|
|
74
|
+
page for that space when it runs past the end of a page. Only Safari, since Chrome's margin-trim
|
|
75
|
+
also drops the space above a block that a page break moves. */
|
|
76
|
+
@supports (font: -apple-system-body) {
|
|
77
|
+
.markdown-body {
|
|
78
|
+
margin-trim: block-end;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -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(0.9em * 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
|
+
}
|
package/styles/report.css
CHANGED
|
@@ -345,12 +345,18 @@
|
|
|
345
345
|
color: var(--md2pdf-muted);
|
|
346
346
|
}
|
|
347
347
|
.markdown-body .footnotes ol {
|
|
348
|
-
|
|
348
|
+
/* Room for numbers up to 99, which Safari sets further left than Chrome. */
|
|
349
|
+
padding-left: 2.2em;
|
|
349
350
|
}
|
|
350
351
|
.markdown-body .footnotes p {
|
|
351
352
|
margin: 0 0 calc(0.3em * var(--md2pdf-space));
|
|
352
353
|
}
|
|
353
354
|
|
|
355
|
+
/* A word joiner keeps a footnote mark on the line with the word before it. */
|
|
356
|
+
.markdown-body .footnote-ref::before {
|
|
357
|
+
content: "\2060";
|
|
358
|
+
}
|
|
359
|
+
|
|
354
360
|
/* An Obsidian embed (![[Other note]]) that can't be shown: a muted placeholder. */
|
|
355
361
|
.markdown-body .markdown-embed {
|
|
356
362
|
color: var(--md2pdf-muted);
|
|
@@ -361,3 +367,14 @@
|
|
|
361
367
|
.markdown-body .page-break {
|
|
362
368
|
break-after: page;
|
|
363
369
|
}
|
|
370
|
+
|
|
371
|
+
/* Safari's PDFs copy a ligature as the wrong characters ("The" pastes as "!e", "ffi" as "ffi"), so it
|
|
372
|
+
prints without them. An element's own font-feature-settings or `font` shorthand undoes this; set
|
|
373
|
+
its features with font-variant-* instead. */
|
|
374
|
+
@media print {
|
|
375
|
+
@supports (font: -apple-system-body) {
|
|
376
|
+
.markdown-body {
|
|
377
|
+
font-feature-settings: "liga" 0, "clig" 0;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
package/styles/resume.css
CHANGED
|
@@ -343,7 +343,8 @@
|
|
|
343
343
|
color: var(--md2pdf-muted);
|
|
344
344
|
}
|
|
345
345
|
.markdown-body .footnotes ol {
|
|
346
|
-
|
|
346
|
+
/* Room for numbers up to 99, which Safari sets further left than Chrome. */
|
|
347
|
+
padding-left: 2.2em;
|
|
347
348
|
}
|
|
348
349
|
.markdown-body .footnotes p {
|
|
349
350
|
margin: 0;
|
|
@@ -352,6 +353,11 @@
|
|
|
352
353
|
display: none;
|
|
353
354
|
}
|
|
354
355
|
|
|
356
|
+
/* A word joiner keeps a footnote mark on the line with the word before it. */
|
|
357
|
+
.markdown-body .footnote-ref::before {
|
|
358
|
+
content: "\2060";
|
|
359
|
+
}
|
|
360
|
+
|
|
355
361
|
/* An Obsidian embed (![[Other note]]) that can't be shown: a muted placeholder. */
|
|
356
362
|
.markdown-body .markdown-embed {
|
|
357
363
|
color: var(--md2pdf-muted);
|
|
@@ -362,3 +368,14 @@
|
|
|
362
368
|
.markdown-body .page-break {
|
|
363
369
|
break-after: page;
|
|
364
370
|
}
|
|
371
|
+
|
|
372
|
+
/* Safari's PDFs copy a ligature as the wrong characters ("The" pastes as "!e", "ffi" as "ffi"), so it
|
|
373
|
+
prints without them. An element's own font-feature-settings or `font` shorthand undoes this; set
|
|
374
|
+
its features with font-variant-* instead. */
|
|
375
|
+
@media print {
|
|
376
|
+
@supports (font: -apple-system-body) {
|
|
377
|
+
.markdown-body {
|
|
378
|
+
font-feature-settings: "liga" 0, "clig" 0;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
package/styles/sandwake.css
CHANGED
|
@@ -520,14 +520,19 @@
|
|
|
520
520
|
break-after: avoid;
|
|
521
521
|
}
|
|
522
522
|
.markdown-body .footnotes ol {
|
|
523
|
-
/* Room for
|
|
524
|
-
padding-left:
|
|
523
|
+
/* Room for numbers up to 99, which Safari sets further left than Chrome. */
|
|
524
|
+
padding-left: 2.4em;
|
|
525
525
|
}
|
|
526
526
|
.markdown-body .footnote-ref a,
|
|
527
527
|
.markdown-body .footnote-backref {
|
|
528
528
|
color: var(--md2pdf-accent);
|
|
529
529
|
}
|
|
530
530
|
|
|
531
|
+
/* A word joiner keeps a footnote mark on the line with the word before it. */
|
|
532
|
+
.markdown-body .footnote-ref::before {
|
|
533
|
+
content: "\2060";
|
|
534
|
+
}
|
|
535
|
+
|
|
531
536
|
/* An Obsidian embed (![[Other note]]) that can't be shown: a muted placeholder. */
|
|
532
537
|
.markdown-body .markdown-embed {
|
|
533
538
|
color: var(--md2pdf-muted);
|
|
@@ -538,3 +543,14 @@
|
|
|
538
543
|
.markdown-body .page-break {
|
|
539
544
|
break-after: page;
|
|
540
545
|
}
|
|
546
|
+
|
|
547
|
+
/* Safari's PDFs copy a ligature as the wrong characters ("The" pastes as "!e", "ffi" as "ffi"), so it
|
|
548
|
+
prints without them. An element's own font-feature-settings or `font` shorthand undoes this; set
|
|
549
|
+
its features with font-variant-* instead. */
|
|
550
|
+
@media print {
|
|
551
|
+
@supports (font: -apple-system-body) {
|
|
552
|
+
.markdown-body {
|
|
553
|
+
font-feature-settings: "liga" 0, "clig" 0;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
}
|
package/styles/worksheet.css
CHANGED
|
@@ -462,7 +462,8 @@
|
|
|
462
462
|
color: var(--md2pdf-muted);
|
|
463
463
|
}
|
|
464
464
|
.markdown-body .footnotes ol {
|
|
465
|
-
|
|
465
|
+
/* Room for numbers up to 99, which Safari sets further left than Chrome. */
|
|
466
|
+
padding-left: 2.2em;
|
|
466
467
|
}
|
|
467
468
|
.markdown-body .footnotes li {
|
|
468
469
|
margin: calc(0.2em * var(--md2pdf-space)) 0;
|
|
@@ -471,6 +472,11 @@
|
|
|
471
472
|
margin: 0;
|
|
472
473
|
}
|
|
473
474
|
|
|
475
|
+
/* A word joiner keeps a footnote mark on the line with the word before it. */
|
|
476
|
+
.markdown-body .footnote-ref::before {
|
|
477
|
+
content: "\2060";
|
|
478
|
+
}
|
|
479
|
+
|
|
474
480
|
/* An Obsidian embed (![[Other note]]) that can't be shown: a muted placeholder. */
|
|
475
481
|
.markdown-body .markdown-embed {
|
|
476
482
|
color: var(--md2pdf-muted);
|
|
@@ -481,3 +487,14 @@
|
|
|
481
487
|
.markdown-body .page-break {
|
|
482
488
|
break-after: page;
|
|
483
489
|
}
|
|
490
|
+
|
|
491
|
+
/* Safari's PDFs copy a ligature as the wrong characters ("The" pastes as "!e", "ffi" as "ffi"), so it
|
|
492
|
+
prints without them. An element's own font-feature-settings or `font` shorthand undoes this; set
|
|
493
|
+
its features with font-variant-* instead. */
|
|
494
|
+
@media print {
|
|
495
|
+
@supports (font: -apple-system-body) {
|
|
496
|
+
.markdown-body {
|
|
497
|
+
font-feature-settings: "liga" 0, "clig" 0;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
}
|