@threepenny/md2pdf 2.6.0 → 2.8.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.
Files changed (65) hide show
  1. package/README.md +24 -10
  2. package/bin/md2pdf.js +60 -16
  3. package/lib/address-links.js +38 -0
  4. package/lib/attributions.js +69 -0
  5. package/lib/fit.js +50 -9
  6. package/lib/italic-lines.js +27 -0
  7. package/lib/render.js +6 -0
  8. package/lib/styles.js +2 -0
  9. package/package.json +1 -1
  10. package/styles/academic.css +14 -0
  11. package/styles/classic.css +88 -2
  12. package/styles/fiendish.css +671 -0
  13. package/styles/fonts/andika/Andika-Bold.woff2 +0 -0
  14. package/styles/fonts/andika/Andika-BoldItalic.woff2 +0 -0
  15. package/styles/fonts/andika/Andika-Italic.woff2 +0 -0
  16. package/styles/fonts/andika/Andika-Regular.woff2 +0 -0
  17. package/styles/fonts/andika/OFL.txt +94 -93
  18. package/styles/fonts/bodoni-moda/OFL.txt +93 -0
  19. package/styles/fonts/bodoni-moda/bodoni-moda-latin-900-normal.woff2 +0 -0
  20. package/styles/fonts/cinzel/OFL.txt +93 -0
  21. package/styles/fonts/cinzel/cinzel-latin-400-normal.woff2 +0 -0
  22. package/styles/fonts/cinzel/cinzel-latin-700-normal.woff2 +0 -0
  23. package/styles/fonts/courier-prime/OFL.txt +93 -0
  24. package/styles/fonts/courier-prime/courier-prime-latin-400-italic.woff2 +0 -0
  25. package/styles/fonts/courier-prime/courier-prime-latin-400-normal.woff2 +0 -0
  26. package/styles/fonts/courier-prime/courier-prime-latin-700-normal.woff2 +0 -0
  27. package/styles/fonts/libre-caslon-text/OFL.txt +93 -0
  28. package/styles/fonts/libre-caslon-text/libre-caslon-text-latin-400-italic.woff2 +0 -0
  29. package/styles/fonts/libre-caslon-text/libre-caslon-text-latin-400-normal.woff2 +0 -0
  30. package/styles/fonts/libre-caslon-text/libre-caslon-text-latin-700-normal.woff2 +0 -0
  31. package/styles/fonts/literata/OFL.txt +93 -0
  32. package/styles/fonts/literata/literata-latin-400-italic.woff2 +0 -0
  33. package/styles/fonts/literata/literata-latin-400-normal.woff2 +0 -0
  34. package/styles/fonts/literata/literata-latin-700-italic.woff2 +0 -0
  35. package/styles/fonts/literata/literata-latin-700-normal.woff2 +0 -0
  36. package/styles/fonts/literata/literata-latin-ext-400-italic.woff2 +0 -0
  37. package/styles/fonts/literata/literata-latin-ext-400-normal.woff2 +0 -0
  38. package/styles/fonts/literata/literata-latin-ext-700-italic.woff2 +0 -0
  39. package/styles/fonts/literata/literata-latin-ext-700-normal.woff2 +0 -0
  40. package/styles/fonts/nunito-sans/OFL.txt +93 -0
  41. package/styles/fonts/nunito-sans/nunito-sans-latin-400-italic.woff2 +0 -0
  42. package/styles/fonts/nunito-sans/nunito-sans-latin-400-normal.woff2 +0 -0
  43. package/styles/fonts/nunito-sans/nunito-sans-latin-700-italic.woff2 +0 -0
  44. package/styles/fonts/nunito-sans/nunito-sans-latin-700-normal.woff2 +0 -0
  45. package/styles/fonts/nunito-sans/nunito-sans-latin-ext-400-italic.woff2 +0 -0
  46. package/styles/fonts/nunito-sans/nunito-sans-latin-ext-400-normal.woff2 +0 -0
  47. package/styles/fonts/nunito-sans/nunito-sans-latin-ext-700-italic.woff2 +0 -0
  48. package/styles/fonts/nunito-sans/nunito-sans-latin-ext-700-normal.woff2 +0 -0
  49. package/styles/fonts/old-standard-tt/OFL.txt +93 -0
  50. package/styles/fonts/old-standard-tt/old-standard-tt-latin-400-italic.woff2 +0 -0
  51. package/styles/fonts/old-standard-tt/old-standard-tt-latin-400-normal.woff2 +0 -0
  52. package/styles/fonts/old-standard-tt/old-standard-tt-latin-700-normal.woff2 +0 -0
  53. package/styles/gothic.css +15 -0
  54. package/styles/modern.css +62 -1
  55. package/styles/newspaper.css +899 -0
  56. package/styles/print/classic.css +1 -1
  57. package/styles/print/fiendish.css +92 -0
  58. package/styles/print/modern.css +1 -1
  59. package/styles/print/newspaper.css +95 -0
  60. package/styles/sandwake.css +14 -0
  61. package/styles/worksheet.css +10 -8
  62. package/styles/fonts/andika/andika-latin-400-italic.woff2 +0 -0
  63. package/styles/fonts/andika/andika-latin-400-normal.woff2 +0 -0
  64. package/styles/fonts/andika/andika-latin-700-italic.woff2 +0 -0
  65. package/styles/fonts/andika/andika-latin-700-normal.woff2 +0 -0
@@ -1,4 +1,5 @@
1
- /* Classic: book-like serif typography using fonts that ship with macOS. */
1
+ /* Classic: book-like serif typography in Iowan Old Style, which ships with macOS, or the bundled Literata
2
+ on computers without it. */
2
3
 
3
4
  /* Variables a page can override, on .markdown-body itself: for all its documents, or for one with
4
5
  <article class="markdown-body" style="--md2pdf-font-size: 12pt">. A value set on :root or another
@@ -22,11 +23,81 @@
22
23
  --md2pdf-surface: #f7f4ee;
23
24
  /* Fonts: --md2pdf-font body text, --md2pdf-heading-font headings (the body font unless set),
24
25
  --md2pdf-code-font code. */
25
- --md2pdf-font: "Iowan Old Style", Charter, Palatino, Georgia, serif;
26
+ --md2pdf-font: "Iowan Old Style", "md2pdf Literata", Charter, Palatino, Georgia, serif;
26
27
  --md2pdf-heading-font: var(--md2pdf-font);
27
28
  --md2pdf-code-font: "SF Mono", Menlo, monospace;
28
29
  }
29
30
 
31
+ /* Literata (The Literata Project Authors), under the SIL Open Font License; the licence is in
32
+ fonts/literata/OFL.txt. It stands in for Iowan Old Style on computers without it, at 95%, where it
33
+ matches Iowan's width and x-height. Its latin and latin-ext subsets cover most languages written in
34
+ Latin letters; it has no small capitals or old-style figures, so browsers draw the small caps from
35
+ scaled capitals. */
36
+ @font-face {
37
+ font-family: "md2pdf Literata";
38
+ font-weight: 400;
39
+ font-style: normal;
40
+ size-adjust: 95%;
41
+ src: url("fonts/literata/literata-latin-ext-400-normal.woff2") format("woff2");
42
+ unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
43
+ }
44
+ @font-face {
45
+ font-family: "md2pdf Literata";
46
+ font-weight: 400;
47
+ font-style: normal;
48
+ size-adjust: 95%;
49
+ src: url("fonts/literata/literata-latin-400-normal.woff2") format("woff2");
50
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
51
+ }
52
+ @font-face {
53
+ font-family: "md2pdf Literata";
54
+ font-weight: 400;
55
+ font-style: italic;
56
+ size-adjust: 95%;
57
+ src: url("fonts/literata/literata-latin-ext-400-italic.woff2") format("woff2");
58
+ unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
59
+ }
60
+ @font-face {
61
+ font-family: "md2pdf Literata";
62
+ font-weight: 400;
63
+ font-style: italic;
64
+ size-adjust: 95%;
65
+ src: url("fonts/literata/literata-latin-400-italic.woff2") format("woff2");
66
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
67
+ }
68
+ @font-face {
69
+ font-family: "md2pdf Literata";
70
+ font-weight: 700;
71
+ font-style: normal;
72
+ size-adjust: 95%;
73
+ src: url("fonts/literata/literata-latin-ext-700-normal.woff2") format("woff2");
74
+ unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
75
+ }
76
+ @font-face {
77
+ font-family: "md2pdf Literata";
78
+ font-weight: 700;
79
+ font-style: normal;
80
+ size-adjust: 95%;
81
+ src: url("fonts/literata/literata-latin-700-normal.woff2") format("woff2");
82
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
83
+ }
84
+ @font-face {
85
+ font-family: "md2pdf Literata";
86
+ font-weight: 700;
87
+ font-style: italic;
88
+ size-adjust: 95%;
89
+ src: url("fonts/literata/literata-latin-ext-700-italic.woff2") format("woff2");
90
+ unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
91
+ }
92
+ @font-face {
93
+ font-family: "md2pdf Literata";
94
+ font-weight: 700;
95
+ font-style: italic;
96
+ size-adjust: 95%;
97
+ src: url("fonts/literata/literata-latin-700-italic.woff2") format("woff2");
98
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
99
+ }
100
+
30
101
  .markdown-body {
31
102
  font-family: var(--md2pdf-font);
32
103
  background: var(--md2pdf-background);
@@ -35,6 +106,8 @@
35
106
  color: var(--md2pdf-text);
36
107
  /* A long web address wraps at the margin instead of making Chrome shrink the page to fit it. */
37
108
  overflow-wrap: break-word;
109
+ /* Whether a long address may break anywhere, set beside each text-align: only in justified text. */
110
+ --md2pdf-address-break: normal;
38
111
  font-variant-numeric: oldstyle-nums proportional-nums;
39
112
  font-kerning: normal;
40
113
  -webkit-print-color-adjust: exact;
@@ -44,6 +117,7 @@
44
117
  .markdown-body p,
45
118
  .markdown-body li {
46
119
  text-align: justify;
120
+ --md2pdf-address-break: break-all;
47
121
  hyphens: auto;
48
122
  orphans: 3;
49
123
  widows: 3;
@@ -71,6 +145,7 @@
71
145
  .markdown-body h1 {
72
146
  font-size: calc(24 / 11 * var(--md2pdf-font-size));
73
147
  text-align: center;
148
+ --md2pdf-address-break: normal;
74
149
  letter-spacing: 0.01em;
75
150
  margin: 0 0 calc(1.4em * var(--md2pdf-space));
76
151
  /* The rule is a block inside the heading; without this a page can break between them. */
@@ -115,10 +190,16 @@
115
190
  .markdown-body a {
116
191
  color: var(--md2pdf-accent);
117
192
  text-decoration: none;
193
+ hyphens: manual;
118
194
  }
119
195
  .markdown-body a.header-anchor {
120
196
  display: none;
121
197
  }
198
+ /* A long address in justified text may break anywhere, without a hyphen, so it starts on the line where it
199
+ falls rather than dropping whole and leaving wide gaps in the line before (#150). */
200
+ .markdown-body a.markdown-address {
201
+ word-break: var(--md2pdf-address-break);
202
+ }
122
203
 
123
204
  /* Lists */
124
205
 
@@ -167,6 +248,7 @@
167
248
  }
168
249
  .markdown-body blockquote p {
169
250
  text-align: left;
251
+ --md2pdf-address-break: normal;
170
252
  }
171
253
 
172
254
  /* Callouts (GitHub alerts and Obsidian callouts): a ruled box on paper, its title in small caps. */
@@ -201,6 +283,7 @@
201
283
  font-weight: 600;
202
284
  letter-spacing: 0.04em;
203
285
  text-align: left;
286
+ --md2pdf-address-break: normal;
204
287
  hyphens: manual;
205
288
  }
206
289
  .markdown-body .markdown-alert-title .octicon {
@@ -219,6 +302,7 @@
219
302
  .markdown-body code,
220
303
  .markdown-body kbd {
221
304
  font-family: var(--md2pdf-code-font);
305
+ hyphens: manual;
222
306
  font-size: 0.82em;
223
307
  font-variant-numeric: normal;
224
308
  }
@@ -324,6 +408,8 @@
324
408
  .markdown-body td {
325
409
  padding: 0.35em 0.9em;
326
410
  text-align: left;
411
+ --md2pdf-address-break: normal;
412
+ hyphens: manual;
327
413
  }
328
414
  .markdown-body th {
329
415
  font-weight: normal;