@threepenny/md2pdf 2.5.0 → 2.7.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 +5 -4
- package/bin/md2pdf.js +62 -5
- package/lib/fit.js +153 -26
- package/package.json +1 -1
- package/styles/classic.css +73 -2
- package/styles/fonts/literata/OFL.txt +93 -0
- package/styles/fonts/literata/literata-latin-400-italic.woff2 +0 -0
- package/styles/fonts/literata/literata-latin-400-normal.woff2 +0 -0
- package/styles/fonts/literata/literata-latin-700-italic.woff2 +0 -0
- package/styles/fonts/literata/literata-latin-700-normal.woff2 +0 -0
- package/styles/fonts/literata/literata-latin-ext-400-italic.woff2 +0 -0
- package/styles/fonts/literata/literata-latin-ext-400-normal.woff2 +0 -0
- package/styles/fonts/literata/literata-latin-ext-700-italic.woff2 +0 -0
- package/styles/fonts/literata/literata-latin-ext-700-normal.woff2 +0 -0
- package/styles/fonts/nunito-sans/OFL.txt +93 -0
- package/styles/fonts/nunito-sans/nunito-sans-latin-400-italic.woff2 +0 -0
- package/styles/fonts/nunito-sans/nunito-sans-latin-400-normal.woff2 +0 -0
- package/styles/fonts/nunito-sans/nunito-sans-latin-700-italic.woff2 +0 -0
- package/styles/fonts/nunito-sans/nunito-sans-latin-700-normal.woff2 +0 -0
- package/styles/fonts/nunito-sans/nunito-sans-latin-ext-400-italic.woff2 +0 -0
- package/styles/fonts/nunito-sans/nunito-sans-latin-ext-400-normal.woff2 +0 -0
- package/styles/fonts/nunito-sans/nunito-sans-latin-ext-700-italic.woff2 +0 -0
- package/styles/fonts/nunito-sans/nunito-sans-latin-ext-700-normal.woff2 +0 -0
- package/styles/modern.css +62 -1
- package/styles/print/classic.css +1 -1
- package/styles/print/modern.css +1 -1
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ Supports GitHub-flavored Markdown: tables, task lists, footnotes, emoji shortcod
|
|
|
10
10
|
|
|
11
11
|
# Command-line tool (macOS)
|
|
12
12
|
|
|
13
|
-
Markdown is rendered to HTML with [markdown-it](https://github.com/markdown-it/markdown-it) and printed to PDF by headless Chrome. Formulas (`$…$`, `$$…$$`, `\(…\)`, `\[…\]`, and environments such as `\begin{aligned}…\end{aligned}` or `\begin{align*}…\end{align*}` that start a block) are drawn with [KaTeX](https://katex.org), as on md2pdf.me; the HTML that `--html` writes also carries MathML for screen readers, which the PDF doesn't. Prices such as $5 and $10 stay text, even beside a formula. A displayed formula wider than the page shrinks until it fits, so a very long one prints small; split it over lines with `aligned` to keep it full size. A table wider than the page fits by
|
|
13
|
+
Markdown is rendered to HTML with [markdown-it](https://github.com/markdown-it/markdown-it) and printed to PDF by headless Chrome. Formulas (`$…$`, `$$…$$`, `\(…\)`, `\[…\]`, and environments such as `\begin{aligned}…\end{aligned}` or `\begin{align*}…\end{align*}` that start a block) are drawn with [KaTeX](https://katex.org), as on md2pdf.me; the HTML that `--html` writes also carries MathML for screen readers, which the PDF doesn't. Prices such as $5 and $10 stay text, even beside a formula. A displayed formula wider than the page shrinks until it fits, so a very long one prints small; split it over lines with `aligned` to keep it full size. A table wider than the page fits by letting the inline code and links in its widest columns break after a slash, then before a dot or an underscore too, so `@threepenny/md2pdf/render` can break after `@threepenny/`. If that isn't enough, a formula in one of its cells shrinks, to as little as half size. If it still doesn't fit, the long words in those columns break mid-word, without a hyphen, then their headers, then every cell as a last resort; a formula shrinks further only if the table still doesn't fit. A table that fits prints as written.
|
|
14
14
|
|
|
15
15
|
## Install
|
|
16
16
|
|
|
@@ -59,9 +59,9 @@ From Finder, a single file opens in Preview when done; multiple files show a not
|
|
|
59
59
|
| Style | Look |
|
|
60
60
|
| --------- | ---- |
|
|
61
61
|
| `github` | GitHub's Markdown rendering: sans-serif, boxed tables, GitHub syntax colors |
|
|
62
|
-
| `classic` | Book-like: Iowan Old Style serif, justified text, small-caps headings, ruled tables, page numbers |
|
|
62
|
+
| `classic` | Book-like: Iowan Old Style serif (bundled Literata on computers without it), justified text, small-caps headings, ruled tables, page numbers |
|
|
63
63
|
| `academic` | Journal article: Palatino, numbered sections (1, 1.1, 1.1.1), booktabs tables, journal-style footnotes |
|
|
64
|
-
| `modern` | Clean sans-serif
|
|
64
|
+
| `modern` | Clean sans-serif: Avenir Next (bundled Nunito Sans on computers without it), generous whitespace, one blue accent |
|
|
65
65
|
| `report` | Business or technical report: title block from the first heading, running header with the title, "Page N of M" footers, gridded tables |
|
|
66
66
|
| `resume` | Compact and one-page friendly: the first heading is your name, the paragraph after it your contact line, `##` headings are ruled section dividers |
|
|
67
67
|
| `worksheet` | For worksheets, stories and class handouts: Andika body text and rounded Fredoka headings (both bundled), larger type, bright headings that change color each section, outlined rounded boxes and big tick boxes for task lists |
|
|
@@ -93,11 +93,12 @@ Register it in `STYLES` and add its page margin to `pageMargins` in `lib/styles.
|
|
|
93
93
|
A style can bundle fonts, so it looks the same on every computer:
|
|
94
94
|
|
|
95
95
|
- Put each family in `styles/fonts/<family>/`: its `.woff2` files (the smallest format, and every current browser reads it) and its `OFL.txt`, and nothing else. Only fonts under the SIL Open Font License, which allows bundling. Fonts are the only files a style bundles.
|
|
96
|
+
- Check whether the font reserves its name, in the copyright lines at the top of upstream's `OFL.txt` or in the font's own copyright notice; a Fontsource or Google Fonts copy of `OFL.txt` can leave the name out. A modified font can't use a reserved name, and subsetting counts as modifying, so subset files like Fontsource's can't be bundled under it. Bundle upstream's own `.woff2` files, unchanged, and add the family's folder name to `RESERVED_NAME_FONTS` in `test/run.js` with the reason; or pick another font. IM Fell English is listed there for another reason: its files reserve the name, but Google Fonts' licence for them doesn't, and John decided that's the one that counts (#37).
|
|
96
97
|
- Declare them in the on-screen file with `@font-face`, relative to it: `src: url("fonts/<family>/<file>.woff2") format("woff2")`, with a `font-weight` and `font-style` for each face. The print file can use them without declaring them again.
|
|
97
98
|
- Name each family `md2pdf <Name>`, so it can't collide with a font on a page that embeds the style. Don't use `local()`, which would bring back the differences between computers, or `font-display: optional`, which lets the browser skip the font.
|
|
98
99
|
- Set the bundled family through the font variables, e.g. `--md2pdf-font: "md2pdf Andika", sans-serif`, so they can still be overridden.
|
|
99
100
|
|
|
100
|
-
The CLI resolves a stylesheet's relative `url()`s against the stylesheet, and loads every declared font before printing, including one used only in a page header. `npm test` checks the file layout, the licence, the family names, `local()` and `font-display`.
|
|
101
|
+
The CLI resolves a stylesheet's relative `url()`s against the stylesheet, and loads every declared font before printing, including one used only in a page header. `npm test` checks the file layout, the licence and any reserved font name, the family names, `local()` and `font-display`.
|
|
101
102
|
|
|
102
103
|
End the on-screen file with the rule the other styles end with, which turns off ligatures when Safari prints: Safari's PDFs copy a ligature as the wrong characters ("The" pastes as "!e"), while Chrome's, the CLI's and on-screen text are unaffected. It belongs in the on-screen file, not the print file, because a page that embeds a style prints without the print file. On a Mac with `swiftc`, `npm test` prints every style through WebKit and checks the copied text.
|
|
103
104
|
|
package/bin/md2pdf.js
CHANGED
|
@@ -223,6 +223,45 @@ for (const signal of ['SIGINT', 'SIGTERM', 'SIGHUP']) {
|
|
|
223
223
|
});
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
+
// What went wrong and what to do on the first line, the only one the Quick Action's notification shows,
|
|
227
|
+
// so it never suggests setting CHROME_PATH, which a Quick Action can't see. The Chrome that ran and its
|
|
228
|
+
// own output go below.
|
|
229
|
+
function chromeFailed(chrome, first, { output = '', suggestChromePath = true } = {}) {
|
|
230
|
+
const lines = [first];
|
|
231
|
+
if (suggestChromePath) lines.push(' If it keeps failing, set CHROME_PATH to a different Chrome-based browser.');
|
|
232
|
+
lines.push(` Chrome: ${chrome}`);
|
|
233
|
+
if (output.trim()) lines.push(" Chrome's output:", ...output.trim().split('\n').map((l) => ` ${l}`));
|
|
234
|
+
return new Error(lines.join('\n'));
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
const TRY_AGAIN = 'It may be updating; try again in a moment.';
|
|
238
|
+
|
|
239
|
+
function cantStart(chrome, err) {
|
|
240
|
+
if (!process.env.CHROME_PATH) return chromeFailed(chrome, `Chrome couldn't start (${err.code ?? err.message}). ${TRY_AGAIN}`);
|
|
241
|
+
let folder = false;
|
|
242
|
+
try {
|
|
243
|
+
folder = statSync(chrome).isDirectory();
|
|
244
|
+
} catch {
|
|
245
|
+
// Missing, or in a folder md2pdf can't read: not a folder it can name.
|
|
246
|
+
}
|
|
247
|
+
if (folder) {
|
|
248
|
+
return chromeFailed(
|
|
249
|
+
chrome,
|
|
250
|
+
`Chrome couldn't start: CHROME_PATH names a folder (${err.code ?? err.message}). ` +
|
|
251
|
+
'For an app, give the program inside it, such as /Applications/Google Chrome.app/Contents/MacOS/Google Chrome.',
|
|
252
|
+
{ suggestChromePath: false },
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
const why = {
|
|
256
|
+
ENOENT: "there's no file at CHROME_PATH",
|
|
257
|
+
ENOTDIR: "there's no file at CHROME_PATH",
|
|
258
|
+
EACCES: "the file at CHROME_PATH can't be run",
|
|
259
|
+
}[err.code] ?? "the file at CHROME_PATH didn't run";
|
|
260
|
+
return chromeFailed(chrome, `Chrome couldn't start: ${why} (${err.code ?? err.message}). Check that it names a Chrome-based browser.`, {
|
|
261
|
+
suggestChromePath: false,
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
|
|
226
265
|
function runChrome(chrome, htmlPath, pdfPath) {
|
|
227
266
|
// A throwaway profile keeps headless Chrome separate from any Chrome you have open.
|
|
228
267
|
const profile = makeTempDir('md2pdf-chrome-');
|
|
@@ -239,20 +278,32 @@ function runChrome(chrome, htmlPath, pdfPath) {
|
|
|
239
278
|
pathToFileURL(htmlPath).href,
|
|
240
279
|
];
|
|
241
280
|
return new Promise((resolvePromise, reject) => {
|
|
242
|
-
|
|
281
|
+
let proc;
|
|
282
|
+
try {
|
|
283
|
+
proc = chromeProc = spawn(chrome, args, { stdio: ['ignore', 'ignore', 'pipe'] });
|
|
284
|
+
} catch (err) {
|
|
285
|
+
// Most failures to start arrive as 'error' below; some (ENOTDIR, say) are thrown here.
|
|
286
|
+
removeTempDir(profile);
|
|
287
|
+
reject(cantStart(chrome, err));
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
243
290
|
let stderr = '';
|
|
244
291
|
proc.stderr.on('data', (d) => (stderr += d));
|
|
245
292
|
// A Chrome that fails to start emits 'error' first, and main() may exit before its 'close' arrives.
|
|
246
293
|
proc.on('error', (err) => {
|
|
247
294
|
if (chromeProc === proc) chromeProc = null;
|
|
248
295
|
removeTempDir(profile);
|
|
249
|
-
reject(err);
|
|
296
|
+
reject(cantStart(chrome, err));
|
|
250
297
|
});
|
|
251
|
-
proc.on('close', (code) => {
|
|
298
|
+
proc.on('close', (code, signal) => {
|
|
252
299
|
if (chromeProc === proc) chromeProc = null;
|
|
253
300
|
removeTempDir(profile);
|
|
254
301
|
if (code === 0 && existsSync(pdfPath)) resolvePromise();
|
|
255
|
-
else reject(
|
|
302
|
+
else if (code === 0) reject(chromeFailed(chrome, `Chrome quit without printing. ${TRY_AGAIN}`, { output: stderr }));
|
|
303
|
+
else {
|
|
304
|
+
const how = signal ? `stopped by ${signal}` : `exit ${code}`;
|
|
305
|
+
reject(chromeFailed(chrome, `Chrome quit before printing (${how}). ${TRY_AGAIN}`, { output: stderr }));
|
|
306
|
+
}
|
|
256
307
|
});
|
|
257
308
|
});
|
|
258
309
|
}
|
|
@@ -369,7 +420,13 @@ async function main() {
|
|
|
369
420
|
process.exit(2);
|
|
370
421
|
}
|
|
371
422
|
|
|
372
|
-
|
|
423
|
+
let chrome;
|
|
424
|
+
try {
|
|
425
|
+
chrome = findChrome();
|
|
426
|
+
} catch (err) {
|
|
427
|
+
console.error(`md2pdf: ${err.message}`);
|
|
428
|
+
process.exit(1);
|
|
429
|
+
}
|
|
373
430
|
if (!katex) console.error(`md2pdf: KaTeX isn't installed, so formulas print as their source; run ${join(ROOT, 'install.sh')} again`);
|
|
374
431
|
let failed = 0;
|
|
375
432
|
const written = new Map();
|
package/lib/fit.js
CHANGED
|
@@ -47,13 +47,17 @@ export function fitFormulas(root = document) {
|
|
|
47
47
|
// Runs in the browser after fitFormulas, which resets every displayed formula's size, once the page is
|
|
48
48
|
// rendered and its fonts have loaded. A table's width depends on the column it ends up in, so it lays the
|
|
49
49
|
// page out at the printed column's width, read from the page's @page rules, while it measures. Then, for a
|
|
50
|
-
// table that runs past its box
|
|
51
|
-
//
|
|
52
|
-
//
|
|
53
|
-
//
|
|
54
|
-
//
|
|
55
|
-
//
|
|
56
|
-
//
|
|
50
|
+
// table that runs past its box, working on the columns whose longest word is longer than 8 characters,
|
|
51
|
+
// widest column first, measuring after each, until it fits:
|
|
52
|
+
// 1. The code and links in their body cells, then in their headers, may break after a slash; if that
|
|
53
|
+
// isn't enough, before a dot or an underscore too. A break that doesn't narrow its column is taken back.
|
|
54
|
+
// 2. If that isn't enough, a formula in one of its cells shrinks, down to half size.
|
|
55
|
+
// 3. If that isn't enough, those columns' body cells break their words anywhere, still at a slash, a dot
|
|
56
|
+
// or an underscore where they can. A break that doesn't narrow its column is taken back. If the table
|
|
57
|
+
// still doesn't fit, those columns' headers break too, all at once, so the broken columns share the
|
|
58
|
+
// width; then every cell.
|
|
59
|
+
// 4. Its formulas then grow back as large as fits, or shrink further if they must. Code or a link no
|
|
60
|
+
// wider than its column's longest unbroken piece is kept whole, unless its cell breaks anywhere.
|
|
57
61
|
// A table that fits isn't written to, so it prints as it did. If the printed width can't be read, nothing
|
|
58
62
|
// changes. Running it again is harmless.
|
|
59
63
|
//
|
|
@@ -71,6 +75,11 @@ export function fitTables(root = document) {
|
|
|
71
75
|
restore(el, el.getAttribute('style') || null);
|
|
72
76
|
el.removeAttribute(FIT);
|
|
73
77
|
};
|
|
78
|
+
for (const wbr of root.querySelectorAll(`wbr[${FIT}]`)) {
|
|
79
|
+
const parent = wbr.parentNode;
|
|
80
|
+
wbr.remove();
|
|
81
|
+
parent.normalize();
|
|
82
|
+
}
|
|
74
83
|
for (const el of root.querySelectorAll(`[${FIT}]`)) unset(el, 'overflow-wrap', 'font-size');
|
|
75
84
|
const tables = [...root.querySelectorAll('table')];
|
|
76
85
|
if (!tables.length) return;
|
|
@@ -158,7 +167,7 @@ export function fitTables(root = document) {
|
|
|
158
167
|
if (!table.parentElement || !(past() > 1)) return;
|
|
159
168
|
const fits = () => past() <= 0;
|
|
160
169
|
|
|
161
|
-
// The table's own cells, by column. A cell that spans columns is broken only with every cell (step
|
|
170
|
+
// The table's own cells, by column. A cell that spans columns is broken only with every cell (step 3).
|
|
162
171
|
const columns = [];
|
|
163
172
|
const taken = [];
|
|
164
173
|
[...table.rows].forEach((row, r) => {
|
|
@@ -193,28 +202,137 @@ export function fitTables(root = document) {
|
|
|
193
202
|
span.remove();
|
|
194
203
|
return width;
|
|
195
204
|
};
|
|
205
|
+
// The code and links in a cell, each with its text: the outermost of each, and none in a formula or in
|
|
206
|
+
// a table inside the cell.
|
|
207
|
+
const spans = (cell) =>
|
|
208
|
+
[...cell.querySelectorAll('code, a')].filter(
|
|
209
|
+
(el) => el.closest('td, th') === cell && !el.parentElement.closest('code, a, .katex') && !el.closest('.katex'),
|
|
210
|
+
);
|
|
211
|
+
// Lets `el`'s text break after a slash, and with `dots`, before a dot or an underscore, with a <wbr>,
|
|
212
|
+
// which prints nothing. Never inside the characters its text starts or ends with (`@scope`, `.hidden`,
|
|
213
|
+
// `~/`, `../`, `__init__`, `etc.`), within a run (`//`, `...`), or at a dot between digits (`2.5.0`).
|
|
214
|
+
// Returns the <wbr>s it adds.
|
|
215
|
+
const LEAD = /^[@.~/_]*/;
|
|
216
|
+
const soften = (el, dots) => {
|
|
217
|
+
const texts = [];
|
|
218
|
+
const have = new Set();
|
|
219
|
+
let text = '';
|
|
220
|
+
const walk = (node) => {
|
|
221
|
+
for (const child of node.childNodes) {
|
|
222
|
+
if (child.nodeType === Node.TEXT_NODE) {
|
|
223
|
+
texts.push([child, text.length]);
|
|
224
|
+
text += child.data;
|
|
225
|
+
} else if (child.localName === 'wbr') {
|
|
226
|
+
have.add(text.length);
|
|
227
|
+
} else if (child.nodeType === Node.ELEMENT_NODE && !child.classList.contains('katex')) {
|
|
228
|
+
walk(child);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
walk(el);
|
|
233
|
+
const start = LEAD.exec(text)[0].length;
|
|
234
|
+
const end = text.search(/[._]*$/);
|
|
235
|
+
const at = [];
|
|
236
|
+
for (let i = start + 1; i < end; i++) {
|
|
237
|
+
const [before, here] = [text[i - 1], text[i]];
|
|
238
|
+
if (before === '/' && here !== '/' && !/\s/.test(here)) at.push(i);
|
|
239
|
+
else if (dots && /[._]/.test(here) && !/[._/\s]/.test(before)) {
|
|
240
|
+
const next = text.slice(i).match(/^[._]+(.)/)?.[1];
|
|
241
|
+
if (next && !/\s/.test(next) && !(here === '.' && /\d/.test(before) && /\d/.test(next))) at.push(i);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
const added = [];
|
|
245
|
+
for (const i of at.reverse()) {
|
|
246
|
+
if (have.has(i)) continue;
|
|
247
|
+
const [node, offset] = texts.findLast(([, offset]) => offset < i) ?? [];
|
|
248
|
+
if (!node || i > offset + node.data.length) continue;
|
|
249
|
+
const wbr = document.createElement('wbr');
|
|
250
|
+
wbr.setAttribute(FIT, '');
|
|
251
|
+
if (i < offset + node.data.length) node.splitText(i - offset);
|
|
252
|
+
node.after(wbr);
|
|
253
|
+
added.push(wbr);
|
|
254
|
+
}
|
|
255
|
+
return added;
|
|
256
|
+
};
|
|
257
|
+
const softenAll = (cells, dots) => cells.flatMap((cell) => spans(cell).flatMap((el) => soften(el, dots)));
|
|
258
|
+
// Takes back <wbr>s, keeping where each went, so they can be put back.
|
|
259
|
+
const removed = [];
|
|
260
|
+
const takeBack = (wbrs) => {
|
|
261
|
+
for (const wbr of wbrs) {
|
|
262
|
+
removed.push(wbr.parentNode);
|
|
263
|
+
wbr.remove();
|
|
264
|
+
}
|
|
265
|
+
};
|
|
196
266
|
const mark = (cell) => {
|
|
197
267
|
cell.style.overflowWrap = 'anywhere';
|
|
198
268
|
cell.setAttribute(FIT, '');
|
|
269
|
+
return softenAll([cell], true);
|
|
199
270
|
};
|
|
200
271
|
const long = (widths, c) => columns[c]?.length && widths[c] > eight(columns[c][0]);
|
|
201
272
|
const body = (c) => columns[c].filter((cell) => cell.localName === 'td');
|
|
202
|
-
|
|
203
|
-
|
|
273
|
+
const head = (c) => columns[c].filter((cell) => cell.localName === 'th');
|
|
274
|
+
// Applies `step` to some of the cells of the long columns, widest first, until the table fits. `step`
|
|
275
|
+
// returns a function that takes it back, which runs if it doesn't narrow its column. Returns whether
|
|
276
|
+
// the table fits.
|
|
277
|
+
const widestFirst = (cellsOf, step) => {
|
|
204
278
|
const tried = new Set();
|
|
205
279
|
while (!fits()) {
|
|
206
280
|
const widths = narrowest();
|
|
207
281
|
let best = -1;
|
|
208
282
|
widths.forEach((w, c) => {
|
|
209
|
-
if (!tried.has(c) && long(widths, c) &&
|
|
283
|
+
if (!tried.has(c) && long(widths, c) && cellsOf(c).length && (best < 0 || w > widths[best])) best = c;
|
|
210
284
|
});
|
|
211
285
|
if (best < 0) return false;
|
|
212
286
|
tried.add(best);
|
|
213
|
-
|
|
214
|
-
if (narrowest()[best] >= widths[best] - 0.5)
|
|
287
|
+
const undo = step(cellsOf(best));
|
|
288
|
+
if (undo && narrowest()[best] >= widths[best] - 0.5) undo();
|
|
215
289
|
}
|
|
216
290
|
return true;
|
|
217
291
|
};
|
|
292
|
+
// Breaks the code and links of the long columns at slashes, then at dots and underscores too: body
|
|
293
|
+
// cells, then headers. Returns whether the table fits.
|
|
294
|
+
const breakNaturally = () =>
|
|
295
|
+
columns.some((cells) => cells?.some((cell) => spans(cell).length)) &&
|
|
296
|
+
[false, true].some((dots) =>
|
|
297
|
+
[body, head].some((cellsOf) =>
|
|
298
|
+
widestFirst(cellsOf, (cells) => {
|
|
299
|
+
const wbrs = softenAll(cells, dots);
|
|
300
|
+
return wbrs.length && (() => takeBack(wbrs));
|
|
301
|
+
}),
|
|
302
|
+
),
|
|
303
|
+
);
|
|
304
|
+
// Breaks the body cells of the long columns anywhere. Returns whether the table fits.
|
|
305
|
+
const breakBodies = () =>
|
|
306
|
+
widestFirst(body, (cells) => {
|
|
307
|
+
const wbrs = cells.flatMap(mark);
|
|
308
|
+
return () => {
|
|
309
|
+
takeBack(wbrs);
|
|
310
|
+
for (const cell of cells) unset(cell, 'overflow-wrap');
|
|
311
|
+
};
|
|
312
|
+
});
|
|
313
|
+
// Keeps whole, one at a time, the code and links whose break points don't narrow their column at its
|
|
314
|
+
// narrowest: those no wider than its longest unbroken piece. A <wbr> doesn't change a column's widest
|
|
315
|
+
// either, so no column's width changes. A cell that breaks anywhere keeps its break points, which it
|
|
316
|
+
// breaks at first.
|
|
317
|
+
const keepWhole = () => {
|
|
318
|
+
const widths = narrowest();
|
|
319
|
+
const softened = new Map();
|
|
320
|
+
for (const wbr of table.querySelectorAll(`wbr[${FIT}]`)) {
|
|
321
|
+
const cell = wbr.closest('td, th');
|
|
322
|
+
if (cell.closest('table') !== table || cell.hasAttribute(FIT)) continue;
|
|
323
|
+
const c = columns.findIndex((cells) => cells?.includes(cell));
|
|
324
|
+
if (c >= 0) softened.set(spans(cell).find((el) => el.contains(wbr)), c);
|
|
325
|
+
}
|
|
326
|
+
for (const [el, c] of softened) {
|
|
327
|
+
const wbrs = [...el.querySelectorAll(`wbr[${FIT}]`)];
|
|
328
|
+
const places = wbrs.map((wbr) => wbr.previousSibling);
|
|
329
|
+
takeBack(wbrs);
|
|
330
|
+
if (narrowest()[c] > widths[c] + 0.5) {
|
|
331
|
+
wbrs.forEach((wbr, i) => places[i].after(wbr));
|
|
332
|
+
removed.splice(removed.length - wbrs.length);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
};
|
|
218
336
|
|
|
219
337
|
// Its formulas: displayed ones, and inline ones with a part longer than 8 characters that can't wrap.
|
|
220
338
|
const formulas = [...table.querySelectorAll(':is(td, th) .katex')]
|
|
@@ -248,19 +366,28 @@ export function fitTables(root = document) {
|
|
|
248
366
|
scale(small);
|
|
249
367
|
};
|
|
250
368
|
|
|
251
|
-
|
|
252
|
-
|
|
369
|
+
const sizeFormulas = () => {
|
|
370
|
+
if (!formulas.length) return;
|
|
253
371
|
if (fits()) return largest(0.5, 1);
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
372
|
+
scale(0.05);
|
|
373
|
+
if (!fits()) scale(0.5);
|
|
374
|
+
else largest(0.05, 0.5);
|
|
375
|
+
};
|
|
376
|
+
const place = () => {
|
|
377
|
+
if (breakNaturally()) return;
|
|
378
|
+
if (formulas.length) {
|
|
379
|
+
scale(0.5);
|
|
380
|
+
if (fits()) return largest(0.5, 1);
|
|
381
|
+
}
|
|
382
|
+
if (!breakBodies()) {
|
|
383
|
+
const widths = narrowest();
|
|
384
|
+
columns.forEach((cells, c) => long(widths, c) && cells.forEach(mark));
|
|
385
|
+
if (!fits()) for (const row of table.rows) for (const cell of row.cells) mark(cell);
|
|
386
|
+
}
|
|
387
|
+
sizeFormulas();
|
|
388
|
+
};
|
|
389
|
+
place();
|
|
390
|
+
keepWhole();
|
|
391
|
+
for (const parent of new Set(removed)) parent.normalize();
|
|
265
392
|
}
|
|
266
393
|
}
|
package/package.json
CHANGED
package/styles/classic.css
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
/* Classic: book-like serif typography
|
|
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);
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright 2017 The Literata Project Authors (https://github.com/googlefonts/literata) Literata-Italic[opsz,wght].ttf: Copyright 2017 The Literata Project Authors (https://github.com/googlefonts/literata)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright 2016 The Nunito Sans Project Authors (https://github.com/Fonthausen/NunitoSans) NunitoSans-Italic[YTLC,opsz,wdth,wght].ttf: Copyright 2016 The Nunito Sans Project Authors (https://github.com/Fonthausen/NunitoSans)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/styles/modern.css
CHANGED
|
@@ -22,11 +22,72 @@
|
|
|
22
22
|
--md2pdf-surface: #f5f7fb;
|
|
23
23
|
/* Fonts: --md2pdf-font body text, --md2pdf-heading-font headings (the body font unless set),
|
|
24
24
|
--md2pdf-code-font code. */
|
|
25
|
-
--md2pdf-font: "Avenir Next", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
25
|
+
--md2pdf-font: "Avenir Next", "md2pdf Nunito Sans", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
26
26
|
--md2pdf-heading-font: var(--md2pdf-font);
|
|
27
27
|
--md2pdf-code-font: "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
/* Nunito Sans (The Nunito Sans Project Authors), under the SIL Open Font License; the licence is in
|
|
31
|
+
fonts/nunito-sans/OFL.txt. It stands in for Avenir Next on computers without it. Its latin and
|
|
32
|
+
latin-ext subsets cover most languages written in Latin letters. Its bold serves 600 too, which
|
|
33
|
+
matches Avenir Next Demi Bold better than its own semibold does. */
|
|
34
|
+
@font-face {
|
|
35
|
+
font-family: "md2pdf Nunito Sans";
|
|
36
|
+
font-weight: 400;
|
|
37
|
+
font-style: normal;
|
|
38
|
+
src: url("fonts/nunito-sans/nunito-sans-latin-ext-400-normal.woff2") format("woff2");
|
|
39
|
+
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;
|
|
40
|
+
}
|
|
41
|
+
@font-face {
|
|
42
|
+
font-family: "md2pdf Nunito Sans";
|
|
43
|
+
font-weight: 400;
|
|
44
|
+
font-style: normal;
|
|
45
|
+
src: url("fonts/nunito-sans/nunito-sans-latin-400-normal.woff2") format("woff2");
|
|
46
|
+
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;
|
|
47
|
+
}
|
|
48
|
+
@font-face {
|
|
49
|
+
font-family: "md2pdf Nunito Sans";
|
|
50
|
+
font-weight: 400;
|
|
51
|
+
font-style: italic;
|
|
52
|
+
src: url("fonts/nunito-sans/nunito-sans-latin-ext-400-italic.woff2") format("woff2");
|
|
53
|
+
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;
|
|
54
|
+
}
|
|
55
|
+
@font-face {
|
|
56
|
+
font-family: "md2pdf Nunito Sans";
|
|
57
|
+
font-weight: 400;
|
|
58
|
+
font-style: italic;
|
|
59
|
+
src: url("fonts/nunito-sans/nunito-sans-latin-400-italic.woff2") format("woff2");
|
|
60
|
+
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;
|
|
61
|
+
}
|
|
62
|
+
@font-face {
|
|
63
|
+
font-family: "md2pdf Nunito Sans";
|
|
64
|
+
font-weight: 700;
|
|
65
|
+
font-style: normal;
|
|
66
|
+
src: url("fonts/nunito-sans/nunito-sans-latin-ext-700-normal.woff2") format("woff2");
|
|
67
|
+
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;
|
|
68
|
+
}
|
|
69
|
+
@font-face {
|
|
70
|
+
font-family: "md2pdf Nunito Sans";
|
|
71
|
+
font-weight: 700;
|
|
72
|
+
font-style: normal;
|
|
73
|
+
src: url("fonts/nunito-sans/nunito-sans-latin-700-normal.woff2") format("woff2");
|
|
74
|
+
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;
|
|
75
|
+
}
|
|
76
|
+
@font-face {
|
|
77
|
+
font-family: "md2pdf Nunito Sans";
|
|
78
|
+
font-weight: 700;
|
|
79
|
+
font-style: italic;
|
|
80
|
+
src: url("fonts/nunito-sans/nunito-sans-latin-ext-700-italic.woff2") format("woff2");
|
|
81
|
+
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;
|
|
82
|
+
}
|
|
83
|
+
@font-face {
|
|
84
|
+
font-family: "md2pdf Nunito Sans";
|
|
85
|
+
font-weight: 700;
|
|
86
|
+
font-style: italic;
|
|
87
|
+
src: url("fonts/nunito-sans/nunito-sans-latin-700-italic.woff2") format("woff2");
|
|
88
|
+
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;
|
|
89
|
+
}
|
|
90
|
+
|
|
30
91
|
.markdown-body {
|
|
31
92
|
font-family: var(--md2pdf-font);
|
|
32
93
|
background: var(--md2pdf-background);
|
package/styles/print/classic.css
CHANGED
package/styles/print/modern.css
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
}
|
|
13
13
|
@bottom-right {
|
|
14
14
|
content: counter(page);
|
|
15
|
-
font-family: "Avenir Next", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
15
|
+
font-family: "Avenir Next", "md2pdf Nunito Sans", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
16
16
|
font-size: 8.5pt;
|
|
17
17
|
color: #5c6577;
|
|
18
18
|
}
|