@threepenny/md2pdf 2.2.3 → 2.4.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 +22 -14
- package/bin/md2pdf.js +75 -8
- package/lib/math.js +15 -8
- package/lib/render.js +24 -3
- package/lib/styles.js +4 -0
- package/package.json +2 -2
- package/styles/academic.css +18 -1
- package/styles/classic.css +18 -1
- package/styles/cyberpunk.css +710 -0
- package/styles/elvish.css +659 -0
- package/styles/fonts/chakra-petch/OFL.txt +93 -0
- package/styles/fonts/chakra-petch/chakra-petch-latin-400-italic.woff2 +0 -0
- package/styles/fonts/chakra-petch/chakra-petch-latin-400-normal.woff2 +0 -0
- package/styles/fonts/chakra-petch/chakra-petch-latin-700-italic.woff2 +0 -0
- package/styles/fonts/chakra-petch/chakra-petch-latin-700-normal.woff2 +0 -0
- package/styles/fonts/cormorant-garamond/OFL.txt +93 -0
- package/styles/fonts/cormorant-garamond/cormorant-garamond-latin-500-italic.woff2 +0 -0
- package/styles/fonts/cormorant-garamond/cormorant-garamond-latin-500-normal.woff2 +0 -0
- package/styles/fonts/cormorant-garamond/cormorant-garamond-latin-700-italic.woff2 +0 -0
- package/styles/fonts/cormorant-garamond/cormorant-garamond-latin-700-normal.woff2 +0 -0
- package/styles/fonts/cormorant-unicase/OFL.txt +93 -0
- package/styles/fonts/cormorant-unicase/cormorant-unicase-latin-600-normal.woff2 +0 -0
- package/styles/fonts/grenze-gotisch/OFL.txt +93 -0
- package/styles/fonts/grenze-gotisch/grenze-gotisch-latin-600-normal.woff2 +0 -0
- package/styles/fonts/im-fell-english/OFL.txt +93 -0
- package/styles/fonts/im-fell-english/im-fell-english-latin-400-italic.woff2 +0 -0
- package/styles/fonts/im-fell-english/im-fell-english-latin-400-normal.woff2 +0 -0
- package/styles/fonts/jetbrains-mono/OFL.txt +93 -0
- package/styles/fonts/jetbrains-mono/jetbrains-mono-latin-400-italic.woff2 +0 -0
- package/styles/fonts/jetbrains-mono/jetbrains-mono-latin-400-normal.woff2 +0 -0
- package/styles/fonts/jetbrains-mono/jetbrains-mono-latin-700-normal.woff2 +0 -0
- package/styles/fonts/michroma/OFL.txt +93 -0
- package/styles/fonts/michroma/michroma-latin-400-normal.woff2 +0 -0
- package/styles/fonts/space-mono/OFL.txt +93 -0
- package/styles/fonts/space-mono/space-mono-latin-400-italic.woff2 +0 -0
- package/styles/fonts/space-mono/space-mono-latin-400-normal.woff2 +0 -0
- package/styles/fonts/space-mono/space-mono-latin-700-normal.woff2 +0 -0
- package/styles/fonts/spectral/OFL.txt +93 -0
- package/styles/fonts/spectral/spectral-latin-400-italic.woff2 +0 -0
- package/styles/fonts/spectral/spectral-latin-400-normal.woff2 +0 -0
- package/styles/fonts/spectral/spectral-latin-600-italic.woff2 +0 -0
- package/styles/fonts/spectral/spectral-latin-600-normal.woff2 +0 -0
- package/styles/github.css +30 -0
- package/styles/gothic.css +503 -0
- package/styles/modern.css +18 -1
- package/styles/print/academic.css +9 -0
- package/styles/print/classic.css +9 -0
- package/styles/print/cyberpunk.css +101 -0
- package/styles/print/elvish.css +78 -0
- package/styles/print/github.css +9 -0
- package/styles/print/gothic.css +38 -0
- package/styles/print/modern.css +9 -0
- package/styles/print/report.css +9 -0
- package/styles/print/resume.css +9 -0
- package/styles/print/sandwake.css +56 -0
- package/styles/print/worksheet.css +9 -0
- package/styles/report.css +18 -1
- package/styles/resume.css +18 -1
- package/styles/sandwake.css +556 -0
- package/styles/worksheet.css +18 -1
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/* Elvish: the print-only rules (page margins, running headers and page numbers). Load after
|
|
2
|
+
../elvish.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
|
+
/* Margin boxes don't see the document's variables, so these repeat elvish.css's fonts, its muted and
|
|
10
|
+
rule colors and the stars' gold. */
|
|
11
|
+
@page {
|
|
12
|
+
margin: 1.1in 1.25in 1in;
|
|
13
|
+
/* Empty boxes carry the header rule across the page and stop browsers adding their own header. */
|
|
14
|
+
@top-left {
|
|
15
|
+
content: "";
|
|
16
|
+
margin-bottom: 26pt;
|
|
17
|
+
border-bottom: 0.75pt solid #8fa39a;
|
|
18
|
+
}
|
|
19
|
+
/* The title in capitals between two stars, in the unicase face: Chrome won't turn on lining
|
|
20
|
+
figures in a margin box, and Cormorant Garamond's old-style figures sink among capitals. */
|
|
21
|
+
@top-center {
|
|
22
|
+
content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='6' viewBox='0 0 16 16'%3E%3Cpath d='M8 0L10 6L16 8L10 10L8 16L6 10L0 8L6 6Z' fill='%23b8923a'/%3E%3C/svg%3E") "\a0\a0\a0" var(--document-title) "\a0\a0\a0" url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='6' viewBox='0 0 16 16'%3E%3Cpath d='M8 0L10 6L16 8L10 10L8 16L6 10L0 8L6 6Z' fill='%23b8923a'/%3E%3C/svg%3E");
|
|
23
|
+
vertical-align: bottom;
|
|
24
|
+
margin-bottom: 26pt;
|
|
25
|
+
padding-bottom: 7pt;
|
|
26
|
+
border-bottom: 0.75pt solid #8fa39a;
|
|
27
|
+
font-family: "md2pdf Cormorant Unicase", "md2pdf Cormorant Garamond", "Iowan Old Style", Georgia, serif;
|
|
28
|
+
font-size: 9.75pt;
|
|
29
|
+
font-weight: 600;
|
|
30
|
+
letter-spacing: 0.18em;
|
|
31
|
+
text-transform: uppercase;
|
|
32
|
+
color: #56635d;
|
|
33
|
+
}
|
|
34
|
+
@top-right {
|
|
35
|
+
content: "";
|
|
36
|
+
margin-bottom: 26pt;
|
|
37
|
+
border-bottom: 0.75pt solid #8fa39a;
|
|
38
|
+
}
|
|
39
|
+
/* The page number in italic Roman numerals between two stars. */
|
|
40
|
+
@bottom-center {
|
|
41
|
+
content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='6' viewBox='0 0 16 16'%3E%3Cpath d='M8 0L10 6L16 8L10 10L8 16L6 10L0 8L6 6Z' fill='%23b8923a'/%3E%3C/svg%3E") "\a0\a0\a0" counter(page, lower-roman) "\a0\a0\a0" url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='6' viewBox='0 0 16 16'%3E%3Cpath d='M8 0L10 6L16 8L10 10L8 16L6 10L0 8L6 6Z' fill='%23b8923a'/%3E%3C/svg%3E");
|
|
42
|
+
vertical-align: top;
|
|
43
|
+
padding-top: 26pt;
|
|
44
|
+
font-family: "md2pdf Cormorant Garamond", "Iowan Old Style", Palatino, Georgia, serif;
|
|
45
|
+
font-size: 12pt;
|
|
46
|
+
font-style: italic;
|
|
47
|
+
font-weight: 500;
|
|
48
|
+
color: #56635d;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/* No header on the first page, where the title usually is. */
|
|
52
|
+
@page :first {
|
|
53
|
+
@top-left {
|
|
54
|
+
border: 0;
|
|
55
|
+
}
|
|
56
|
+
@top-center {
|
|
57
|
+
content: "";
|
|
58
|
+
border: 0;
|
|
59
|
+
}
|
|
60
|
+
@top-right {
|
|
61
|
+
border: 0;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
html,
|
|
66
|
+
body {
|
|
67
|
+
margin: 0;
|
|
68
|
+
background: #fff;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* Nothing follows the document's last block, so Safari keeps no space below it: it starts a blank
|
|
72
|
+
page for that space when it runs past the end of a page. Only Safari, since Chrome's margin-trim
|
|
73
|
+
also drops the space above a block that a page break moves. */
|
|
74
|
+
@supports (font: -apple-system-body) {
|
|
75
|
+
.markdown-body {
|
|
76
|
+
margin-trim: block-end;
|
|
77
|
+
}
|
|
78
|
+
}
|
package/styles/print/github.css
CHANGED
|
@@ -30,3 +30,12 @@ body {
|
|
|
30
30
|
.markdown-body table {
|
|
31
31
|
overflow: visible;
|
|
32
32
|
}
|
|
33
|
+
|
|
34
|
+
/* Nothing follows the document's last block, so Safari keeps no space below it: it starts a blank
|
|
35
|
+
page for that space when it runs past the end of a page. Only Safari, since Chrome's margin-trim
|
|
36
|
+
also drops the space above a block that a page break moves. */
|
|
37
|
+
@supports (font: -apple-system-body) {
|
|
38
|
+
.markdown-body {
|
|
39
|
+
margin-trim: block-end;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/* Gothic: the print-only rules (page margins, running headers and page numbers). Load after
|
|
2
|
+
../gothic.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
|
+
/* Margin boxes don't see the document's variables, so these repeat gothic.css's body font and
|
|
11
|
+
accent. */
|
|
12
|
+
@bottom-center {
|
|
13
|
+
content: "— " counter(page) " —";
|
|
14
|
+
font-family: "md2pdf IM Fell English", "Iowan Old Style", Georgia, serif;
|
|
15
|
+
font-size: 11pt;
|
|
16
|
+
color: #7a1f1f;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
@page :first {
|
|
20
|
+
@bottom-center {
|
|
21
|
+
content: "";
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
html,
|
|
26
|
+
body {
|
|
27
|
+
margin: 0;
|
|
28
|
+
background: #fff;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* Nothing follows the document's last block, so Safari keeps no space below it: it starts a blank
|
|
32
|
+
page for that space when it runs past the end of a page. Only Safari, since Chrome's margin-trim
|
|
33
|
+
also drops the space above a block that a page break moves. */
|
|
34
|
+
@supports (font: -apple-system-body) {
|
|
35
|
+
.markdown-body {
|
|
36
|
+
margin-trim: block-end;
|
|
37
|
+
}
|
|
38
|
+
}
|
package/styles/print/modern.css
CHANGED
|
@@ -28,3 +28,12 @@ body {
|
|
|
28
28
|
margin: 0;
|
|
29
29
|
background: #fff;
|
|
30
30
|
}
|
|
31
|
+
|
|
32
|
+
/* Nothing follows the document's last block, so Safari keeps no space below it: it starts a blank
|
|
33
|
+
page for that space when it runs past the end of a page. Only Safari, since Chrome's margin-trim
|
|
34
|
+
also drops the space above a block that a page break moves. */
|
|
35
|
+
@supports (font: -apple-system-body) {
|
|
36
|
+
.markdown-body {
|
|
37
|
+
margin-trim: block-end;
|
|
38
|
+
}
|
|
39
|
+
}
|
package/styles/print/report.css
CHANGED
|
@@ -58,3 +58,12 @@ body {
|
|
|
58
58
|
margin: 0;
|
|
59
59
|
background: #fff;
|
|
60
60
|
}
|
|
61
|
+
|
|
62
|
+
/* Nothing follows the document's last block, so Safari keeps no space below it: it starts a blank
|
|
63
|
+
page for that space when it runs past the end of a page. Only Safari, since Chrome's margin-trim
|
|
64
|
+
also drops the space above a block that a page break moves. */
|
|
65
|
+
@supports (font: -apple-system-body) {
|
|
66
|
+
.markdown-body {
|
|
67
|
+
margin-trim: block-end;
|
|
68
|
+
}
|
|
69
|
+
}
|
package/styles/print/resume.css
CHANGED
|
@@ -17,3 +17,12 @@ body {
|
|
|
17
17
|
margin: 0;
|
|
18
18
|
background: #fff;
|
|
19
19
|
}
|
|
20
|
+
|
|
21
|
+
/* Nothing follows the document's last block, so Safari keeps no space below it: it starts a blank
|
|
22
|
+
page for that space when it runs past the end of a page. Only Safari, since Chrome's margin-trim
|
|
23
|
+
also drops the space above a block that a page break moves. */
|
|
24
|
+
@supports (font: -apple-system-body) {
|
|
25
|
+
.markdown-body {
|
|
26
|
+
margin-trim: block-end;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/* Sandwake: the print-only rules (page margins, running headers and page numbers). Load after
|
|
2
|
+
../sandwake.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
|
+
/* Margin boxes don't see the document's variables, so these repeat sandwake.css's label font and
|
|
10
|
+
muted color. The title page has its own title, so it has no running header, and no folio. */
|
|
11
|
+
@page {
|
|
12
|
+
margin: 1in 0.9in 0.9in;
|
|
13
|
+
@top-left {
|
|
14
|
+
content: var(--document-title);
|
|
15
|
+
font-family: "md2pdf Space Mono", "SF Mono", Menlo, Consolas, monospace;
|
|
16
|
+
font-size: 7.5pt;
|
|
17
|
+
letter-spacing: 0.14em;
|
|
18
|
+
text-transform: uppercase;
|
|
19
|
+
color: #5e5140;
|
|
20
|
+
}
|
|
21
|
+
/* An empty box stops browsers from adding their own date/title header. */
|
|
22
|
+
@top-center {
|
|
23
|
+
content: "";
|
|
24
|
+
}
|
|
25
|
+
@bottom-right {
|
|
26
|
+
content: "Folio " counter(page, decimal-leading-zero);
|
|
27
|
+
font-family: "md2pdf Space Mono", "SF Mono", Menlo, Consolas, monospace;
|
|
28
|
+
font-size: 7.5pt;
|
|
29
|
+
letter-spacing: 0.14em;
|
|
30
|
+
text-transform: uppercase;
|
|
31
|
+
color: #5e5140;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
@page :first {
|
|
35
|
+
@top-left {
|
|
36
|
+
content: "";
|
|
37
|
+
}
|
|
38
|
+
@bottom-right {
|
|
39
|
+
content: "";
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
html,
|
|
44
|
+
body {
|
|
45
|
+
margin: 0;
|
|
46
|
+
background: #fff;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/* Nothing follows the document's last block, so Safari keeps no space below it: it starts a blank
|
|
50
|
+
page for that space when it runs past the end of a page. Only Safari, since Chrome's margin-trim
|
|
51
|
+
also drops the space above a block that a page break moves. */
|
|
52
|
+
@supports (font: -apple-system-body) {
|
|
53
|
+
.markdown-body {
|
|
54
|
+
margin-trim: block-end;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -28,3 +28,12 @@ body {
|
|
|
28
28
|
margin: 0;
|
|
29
29
|
background: #fff;
|
|
30
30
|
}
|
|
31
|
+
|
|
32
|
+
/* Nothing follows the document's last block, so Safari keeps no space below it: it starts a blank
|
|
33
|
+
page for that space when it runs past the end of a page. Only Safari, since Chrome's margin-trim
|
|
34
|
+
also drops the space above a block that a page break moves. */
|
|
35
|
+
@supports (font: -apple-system-body) {
|
|
36
|
+
.markdown-body {
|
|
37
|
+
margin-trim: block-end;
|
|
38
|
+
}
|
|
39
|
+
}
|
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
|
+
}
|