@threepenny/md2pdf 2.0.0 → 2.1.1
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 +19 -5
- package/bin/md2pdf.js +29 -4
- package/lib/css.js +27 -0
- package/lib/styles.js +1 -0
- package/package.json +1 -1
- package/styles/fonts/andika/OFL.txt +93 -0
- package/styles/fonts/andika/andika-latin-400-italic.woff2 +0 -0
- package/styles/fonts/andika/andika-latin-400-normal.woff2 +0 -0
- package/styles/fonts/andika/andika-latin-700-italic.woff2 +0 -0
- package/styles/fonts/andika/andika-latin-700-normal.woff2 +0 -0
- package/styles/fonts/fredoka/OFL.txt +93 -0
- package/styles/fonts/fredoka/fredoka-latin-600-normal.woff2 +0 -0
- package/styles/print/worksheet.css +30 -0
- package/styles/worksheet.css +481 -0
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Convert Markdown to beautifully styled PDFs. This is the rendering engine and ma
|
|
|
6
6
|
- **On a Mac and comfortable with a terminal?** Install the command-line tool below. It adds a Finder right-click action and a keyboard shortcut.
|
|
7
7
|
- **Building something?** Use the renderer and styles as a dependency, to make PDFs ([Using the renderer](#using-the-renderer)) or to show Markdown in your own pages ([Embedding in a web page](#embedding-in-a-web-page)).
|
|
8
8
|
|
|
9
|
-
Supports GitHub-flavored Markdown: tables, task lists, footnotes, emoji shortcodes, syntax-highlighted code, raw HTML, GitHub alerts and Obsidian callouts (`> [!NOTE]`, `> [!tip] Custom title`), Obsidian wikilinks and embeds (`[[Note|alias]]` prints as plain text, `![[image.png]]` as an image, and an embedded note as a placeholder naming it), YAML front matter (left out of the PDF; its `title:` names the document when there is no `#` heading), and page breaks (`<div class="page-break"></div>`).
|
|
9
|
+
Supports GitHub-flavored Markdown: tables, task lists, footnotes, emoji shortcodes, syntax-highlighted code, raw HTML, GitHub alerts and Obsidian callouts (`> [!NOTE]`, `> [!tip] Custom title`), Obsidian wikilinks and embeds (`[[Note|alias]]` prints as plain text, `![[image.png]]` as an image, and an embedded note as a placeholder naming it), YAML front matter (left out of the PDF; its `title:` names the document when there is no `#` heading), and page breaks (`<div class="page-break"></div>`). Seven print styles are included: `github`, `classic`, `academic`, `modern`, `report`, `resume` and `worksheet`.
|
|
10
10
|
|
|
11
11
|
# Command-line tool (macOS)
|
|
12
12
|
|
|
@@ -46,7 +46,7 @@ md2pdf notes.md -o ~/out.pdf # choose the output path
|
|
|
46
46
|
md2pdf notes.md -p A4 # page size (default: Letter)
|
|
47
47
|
md2pdf notes.md --open # open the PDF when done
|
|
48
48
|
md2pdf notes.md -s classic # use a specific style
|
|
49
|
-
md2pdf notes.md --css my.css # layer extra CSS on top of the style
|
|
49
|
+
md2pdf notes.md --css my.css # layer extra CSS on top of the style (its url()s resolve against my.css)
|
|
50
50
|
md2pdf notes.md --html # also write the intermediate HTML (for tweaking CSS)
|
|
51
51
|
```
|
|
52
52
|
|
|
@@ -62,6 +62,7 @@ From Finder, a single file opens in Preview when done; multiple files show a not
|
|
|
62
62
|
| `modern` | Clean sans-serif (Avenir Next / Segoe UI), generous whitespace, one blue accent |
|
|
63
63
|
| `report` | Business or technical report: title block from the first heading, running header with the title, "Page N of M" footers, gridded tables |
|
|
64
64
|
| `resume` | Compact and one-page friendly: the first heading is your name, the paragraph after it your contact line, `##` headings are ruled section dividers |
|
|
65
|
+
| `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 |
|
|
65
66
|
|
|
66
67
|
Switch the default style — used by the Finder Quick Action, the keyboard shortcut and the `md2pdf` command:
|
|
67
68
|
|
|
@@ -81,6 +82,15 @@ Styles are registered in the `STYLES` map in `bin/md2pdf.js`; each is a list of
|
|
|
81
82
|
|
|
82
83
|
Register it in `STYLES` and add its page margin to `pageMargins` in `lib/styles.js`, and it's available to `-s` and `set-style.sh`. Use `md2pdf --html` to get the intermediate HTML for tweaking in a browser. For one-off tweaks, `--css` is enough.
|
|
83
84
|
|
|
85
|
+
A style can bundle fonts, so it looks the same on every computer:
|
|
86
|
+
|
|
87
|
+
- 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.
|
|
88
|
+
- 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.
|
|
89
|
+
- 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.
|
|
90
|
+
- Set the bundled family through the font variables, e.g. `--md2pdf-font: "md2pdf Andika", sans-serif`, so they can still be overridden.
|
|
91
|
+
|
|
92
|
+
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`.
|
|
93
|
+
|
|
84
94
|
The text of the document's first `#` heading (empty if there is none) is available to page margin boxes as `var(--document-title)`, e.g. `@top-left { content: var(--document-title); }`, as the `report` style does.
|
|
85
95
|
|
|
86
96
|
A style declares the [shared variables](#variables) in its first rule, `:where(.markdown-body) { … }`, with a comment saying what each one does there, and uses them for every size, gap, color and font they name. Spacing follows two patterns: `line-height: calc(1 + 0.55 * var(--md2pdf-leading))` and `margin: calc(1.8em * var(--md2pdf-space)) 0 …`. `npm test` checks that each variable is declared and changes the document. Page margins aren't included: they stay in the style's `@page` rule, in `styles/print/<name>.css`.
|
|
@@ -108,6 +118,8 @@ const html = buildDocument({
|
|
|
108
118
|
});
|
|
109
119
|
```
|
|
110
120
|
|
|
121
|
+
A style that [bundles fonts](#adding-a-style) loads them relative to its stylesheet, so a page that inlines the CSS must rewrite those `url()`s, as the CLI does, or let a bundler do it (in Vite, `?inline`, not `?raw`). Before printing, start every font loading and wait: a font used only in a page header may otherwise not be requested until printing starts, and the PDF falls back, as it does in headless Chrome. `await Promise.allSettled([...document.fonts].map((f) => f.load()))`.
|
|
122
|
+
|
|
111
123
|
| Export | What it is |
|
|
112
124
|
| ------ | ---------- |
|
|
113
125
|
| `@threepenny/md2pdf/render` | `createRenderer({ hljs, math?, html? })`, `buildDocument(...)`, `titleOf(markdown, fallback)` (the first `#` heading, else the front matter's `title:`, else the fallback), `escapeHtml(s)`, `cssString(s)`, `headingText(html)` |
|
|
@@ -123,7 +135,7 @@ Every style takes the same variables, set on the `.markdown-body` element. A `--
|
|
|
123
135
|
|
|
124
136
|
| Variable | What it sets |
|
|
125
137
|
| -------- | ------------ |
|
|
126
|
-
| `--md2pdf-font-size` | The body text size; headings and smaller text scale with it. An absolute length (`pt`, `px` or `rem`), since `em` and `%` would compound. 11pt, or 10.5pt in `modern` and `report` and
|
|
138
|
+
| `--md2pdf-font-size` | The body text size; headings and smaller text scale with it. An absolute length (`pt`, `px` or `rem`), since `em` and `%` would compound. 11pt, or 10.5pt in `modern` and `report`, 10pt in `resume` and 13.5pt in `worksheet` |
|
|
127
139
|
| `--md2pdf-leading` | Line spacing: scales each line height's excess over 1. 1 as designed |
|
|
128
140
|
| `--md2pdf-space` | The vertical gaps between blocks. 1 as designed |
|
|
129
141
|
| `--md2pdf-background` | The document's background, white |
|
|
@@ -131,9 +143,9 @@ Every style takes the same variables, set on the `.markdown-body` element. A `--
|
|
|
131
143
|
| `--md2pdf-muted` | Secondary text, such as footnotes and captions |
|
|
132
144
|
| `--md2pdf-accent` | The accent color: links, headings, list markers or callouts, depending on the style |
|
|
133
145
|
| `--md2pdf-rule` | Rules, borders and table lines (every style but `github`) |
|
|
134
|
-
| `--md2pdf-surface` | A tinted background: inline code and code blocks in `classic` and `
|
|
146
|
+
| `--md2pdf-surface` | A tinted background: inline code and code blocks in `classic`, `modern` and `worksheet`, and callouts too in `classic`; inline code, quotes and table headings in `report`. The other styles don't use it |
|
|
135
147
|
| `--md2pdf-font` | The body font |
|
|
136
|
-
| `--md2pdf-heading-font` | The heading font: the body font, except in `report`, where it's Helvetica and also sets callout titles and tables |
|
|
148
|
+
| `--md2pdf-heading-font` | The heading font: the body font, except in `report`, where it's Helvetica and also sets callout titles and tables, and in `worksheet`, where it's Fredoka and also sets callout titles, table headings and list markers |
|
|
137
149
|
| `--md2pdf-code-font` | The code font |
|
|
138
150
|
|
|
139
151
|
The styles are designed for light pages; a dark page isn't supported. Page headers and footers in a PDF keep the style's own fonts and colors.
|
|
@@ -182,6 +194,8 @@ With a bundler such as Vite:
|
|
|
182
194
|
</html>
|
|
183
195
|
```
|
|
184
196
|
|
|
197
|
+
A style that bundles fonts loads them from `fonts/` beside its stylesheet, so serve that folder with it. Link the stylesheet, or import it in a way that lets your bundler process its `url()`s (in Vite, a plain import or `?inline`, not `?raw`).
|
|
198
|
+
|
|
185
199
|
Set the [variables](#variables) on the `.markdown-body` element itself, with any selector or inline (`<article class="markdown-body" style="--md2pdf-font-size: 10pt">`). The style declares its defaults with no specificity, so your rule wins wherever it appears. A value set on `:root` or another element around the document doesn't reach it. One page can hold several documents in the same style, each with its own overrides, but not two different styles.
|
|
186
200
|
|
|
187
201
|
The document paints its own background, so on a page that isn't white, give it some padding. Your page's own CSS still applies inside the document, for whatever the style doesn't set: a global `strong { color: #c00 }` reddens bold text in the document too. A highlight.js theme on your page is the exception: the styles keep it out of the document's code blocks. Headings get ids from their text (`# Notes` becomes `id="notes"`) so `[[#Notes]]` links work, so give your own elements ids that a heading won't produce.
|
package/bin/md2pdf.js
CHANGED
|
@@ -11,6 +11,7 @@ import { createRequire } from 'node:module';
|
|
|
11
11
|
|
|
12
12
|
import hljs from 'highlight.js';
|
|
13
13
|
import { buildDocument, createRenderer, titleOf } from '../lib/render.js';
|
|
14
|
+
import { rewriteUrls } from '../lib/css.js';
|
|
14
15
|
|
|
15
16
|
const require = createRequire(import.meta.url);
|
|
16
17
|
const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
|
@@ -26,6 +27,7 @@ const STYLES = {
|
|
|
26
27
|
modern: styleFiles('modern'),
|
|
27
28
|
report: styleFiles('report'),
|
|
28
29
|
resume: styleFiles('resume'),
|
|
30
|
+
worksheet: styleFiles('worksheet'),
|
|
29
31
|
};
|
|
30
32
|
const FALLBACK_STYLE = 'github';
|
|
31
33
|
|
|
@@ -90,17 +92,40 @@ function findChrome() {
|
|
|
90
92
|
return found;
|
|
91
93
|
}
|
|
92
94
|
|
|
95
|
+
// A stylesheet's text, with its relative url()s (a style's bundled fonts, say) made absolute: inlined
|
|
96
|
+
// into the page, they would otherwise resolve against the Markdown file's folder. Warns once about each
|
|
97
|
+
// file they name that doesn't exist.
|
|
98
|
+
const warned = new Set();
|
|
99
|
+
function readCss(file) {
|
|
100
|
+
return rewriteUrls(readFileSync(file, 'utf8'), (ref) => {
|
|
101
|
+
const url = new URL(ref, pathToFileURL(file));
|
|
102
|
+
let missing = false;
|
|
103
|
+
try {
|
|
104
|
+
missing = !existsSync(fileURLToPath(url));
|
|
105
|
+
} catch {
|
|
106
|
+
// Not a path this system can name, such as one with an encoded slash; let Chrome try it.
|
|
107
|
+
}
|
|
108
|
+
const warning = `md2pdf: ${file}: no such file: ${ref}`;
|
|
109
|
+
if (missing && !warned.has(warning)) {
|
|
110
|
+
warned.add(warning);
|
|
111
|
+
console.error(warning);
|
|
112
|
+
}
|
|
113
|
+
return url.href;
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
93
117
|
function buildHtml({ markdown, title, baseDir, style, extraCss, pageSize }) {
|
|
94
|
-
const css = [...STYLES[style], ...(extraCss ? [extraCss] : [])]
|
|
95
|
-
.map((f) => readFileSync(f, 'utf8'))
|
|
96
|
-
.join('\n');
|
|
118
|
+
const css = [...STYLES[style], ...(extraCss ? [extraCss] : [])].map(readCss).join('\n');
|
|
97
119
|
return buildDocument({
|
|
98
120
|
bodyHtml: createRenderer({ hljs }).render(markdown),
|
|
99
121
|
title,
|
|
100
122
|
css,
|
|
101
123
|
pageSize,
|
|
102
124
|
// <base> makes relative image/link paths resolve against the Markdown file's folder.
|
|
103
|
-
|
|
125
|
+
// Chrome loads a font used only in a page header or footer too late for the PDF, so start every
|
|
126
|
+
// declared font loading now; the PDF waits for those loads with the rest of the page.
|
|
127
|
+
head: `<base href="${pathToFileURL(baseDir + '/').href}">
|
|
128
|
+
<script>document.addEventListener('DOMContentLoaded', () => document.fonts.forEach((f) => f.load().catch(() => {})));</script>`,
|
|
104
129
|
});
|
|
105
130
|
}
|
|
106
131
|
|
package/lib/css.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Stylesheet text handling for the CLI and the tests.
|
|
2
|
+
|
|
3
|
+
import { cssString } from './render.js';
|
|
4
|
+
|
|
5
|
+
// A comment, a string, or a url() whose groups hold its double-quoted, single-quoted or bare reference.
|
|
6
|
+
const STRING = (q) => `${q}(?:\\\\[^]|[^${q}\\\\\\n])*${q}`;
|
|
7
|
+
const TOKENS = new RegExp(
|
|
8
|
+
String.raw`\/\*[^]*?\*\/|${STRING('"')}|${STRING("'")}|url\(\s*(?:"((?:\\[^]|[^"\\\n])*)"|'((?:\\[^]|[^'\\\n])*)'|([^)\s'"\\]*))\s*\)`,
|
|
9
|
+
'gi',
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
// Replaces each relative url() in a stylesheet with url(<resolve(ref)>), leaving comments, strings,
|
|
13
|
+
// and references that are absolute, root-relative, fragments or contain CSS escapes as they are.
|
|
14
|
+
export function rewriteUrls(css, resolve) {
|
|
15
|
+
return css.replace(TOKENS, (whole, dq, sq, bare) => {
|
|
16
|
+
const ref = dq ?? sq ?? bare;
|
|
17
|
+
if (!ref || ref.includes('\\') || /^(?:[a-z][a-z\d+.-]*:|\/|#)/i.test(ref)) return whole;
|
|
18
|
+
return `url(${cssString(resolve(ref))})`;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// The relative references a stylesheet's url()s make, as rewriteUrls sees them.
|
|
23
|
+
export function relativeUrls(css) {
|
|
24
|
+
const refs = [];
|
|
25
|
+
rewriteUrls(css, (ref) => (refs.push(ref), ref));
|
|
26
|
+
return refs;
|
|
27
|
+
}
|
package/lib/styles.js
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright (c) 2004-2022 SIL International Andika-Italic.ttf: Copyright (c) 2004-2022 SIL International Andika-Bold.ttf: Copyright (c) 2004-2022 SIL International Andika-BoldItalic.ttf: Copyright (c) 2004-2022 SIL International
|
|
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
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright 2016 The Fredoka Project Authors (https://github.com/hafontia/Fredoka-One)
|
|
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
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/* Worksheet: the print-only rules (page margins, running headers and page numbers). Load after
|
|
2
|
+
../worksheet.css when printing; a page that only shows the document on screen leaves this out. */
|
|
3
|
+
|
|
4
|
+
@page {
|
|
5
|
+
margin: 0.8in 0.9in;
|
|
6
|
+
/* Empty boxes stop browsers from adding their own date/title header and URL/page footer. */
|
|
7
|
+
@top-center {
|
|
8
|
+
content: "";
|
|
9
|
+
}
|
|
10
|
+
/* Margin boxes don't see the document's variables, so these repeat worksheet.css's heading font
|
|
11
|
+
and accent. */
|
|
12
|
+
@bottom-center {
|
|
13
|
+
content: counter(page);
|
|
14
|
+
font-family: "md2pdf Fredoka", "Arial Rounded MT Bold", sans-serif;
|
|
15
|
+
font-weight: 600;
|
|
16
|
+
font-size: 11pt;
|
|
17
|
+
color: #1f6fd1;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
@page :first {
|
|
21
|
+
@bottom-center {
|
|
22
|
+
content: "";
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
html,
|
|
27
|
+
body {
|
|
28
|
+
margin: 0;
|
|
29
|
+
background: #fff;
|
|
30
|
+
}
|
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
/* Worksheet: for worksheets, stories and class handouts. A rounded, easy-to-read typeface with a
|
|
2
|
+
single-story a, larger type and looser lines, and bright color on headings, borders and rounded
|
|
3
|
+
boxes rather than filled areas, so it doesn't eat printer ink. */
|
|
4
|
+
|
|
5
|
+
/* Variables a page can override, on .markdown-body itself: for all its documents, or for one with
|
|
6
|
+
<article class="markdown-body" style="--md2pdf-font-size: 14pt">. A value set on :root or another
|
|
7
|
+
ancestor doesn't reach the document. :where() gives these defaults no specificity, so the page's
|
|
8
|
+
rule wins wherever it comes. Every style uses the same names. */
|
|
9
|
+
:where(.markdown-body) {
|
|
10
|
+
/* Size and spacing. --md2pdf-font-size is the body text size, an absolute length such as 13.5pt or 18px; headings and smaller text scale with
|
|
11
|
+
it. --md2pdf-leading scales each line height's excess over 1, and --md2pdf-space the vertical
|
|
12
|
+
gaps between blocks; both are 1 as designed. */
|
|
13
|
+
--md2pdf-font-size: 13.5pt;
|
|
14
|
+
--md2pdf-leading: 1;
|
|
15
|
+
--md2pdf-space: 1;
|
|
16
|
+
/* Colors: --md2pdf-background the document's background; --md2pdf-text body text; --md2pdf-muted
|
|
17
|
+
secondary text; --md2pdf-accent the title, the first section, h4, links, list markers, tick
|
|
18
|
+
boxes, note callouts, tables and the dotted --- rule; --md2pdf-rule the lines inside tables,
|
|
19
|
+
quote and code borders and the footnote rule; --md2pdf-surface code backgrounds. */
|
|
20
|
+
--md2pdf-background: #fff;
|
|
21
|
+
--md2pdf-text: #2b2a3a;
|
|
22
|
+
--md2pdf-muted: #6a6480;
|
|
23
|
+
--md2pdf-accent: #1f6fd1;
|
|
24
|
+
--md2pdf-rule: #b3aad6;
|
|
25
|
+
--md2pdf-surface: #f8f6fe;
|
|
26
|
+
/* Fonts: --md2pdf-font body text, --md2pdf-heading-font headings, table headings, callout
|
|
27
|
+
titles and list markers, --md2pdf-code-font code. */
|
|
28
|
+
--md2pdf-font: "md2pdf Andika", "Avenir Next", "Segoe UI", Roboto, sans-serif;
|
|
29
|
+
--md2pdf-heading-font: "md2pdf Fredoka", "Arial Rounded MT Bold", var(--md2pdf-font);
|
|
30
|
+
--md2pdf-code-font: "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* Andika (SIL International) and Fredoka, both under the SIL Open Font License; the licences are in
|
|
34
|
+
fonts/andika/OFL.txt and fonts/fredoka/OFL.txt. Their latin subsets cover English and Western
|
|
35
|
+
European languages (Basic Latin and Latin-1, plus œ and €); other letters, such as Polish, Czech or
|
|
36
|
+
Turkish ones, come from the fallbacks. */
|
|
37
|
+
@font-face {
|
|
38
|
+
font-family: "md2pdf Andika";
|
|
39
|
+
font-weight: 400;
|
|
40
|
+
font-style: normal;
|
|
41
|
+
src: url("fonts/andika/andika-latin-400-normal.woff2") format("woff2");
|
|
42
|
+
}
|
|
43
|
+
@font-face {
|
|
44
|
+
font-family: "md2pdf Andika";
|
|
45
|
+
font-weight: 400;
|
|
46
|
+
font-style: italic;
|
|
47
|
+
src: url("fonts/andika/andika-latin-400-italic.woff2") format("woff2");
|
|
48
|
+
}
|
|
49
|
+
@font-face {
|
|
50
|
+
font-family: "md2pdf Andika";
|
|
51
|
+
font-weight: 700;
|
|
52
|
+
font-style: normal;
|
|
53
|
+
src: url("fonts/andika/andika-latin-700-normal.woff2") format("woff2");
|
|
54
|
+
}
|
|
55
|
+
@font-face {
|
|
56
|
+
font-family: "md2pdf Andika";
|
|
57
|
+
font-weight: 700;
|
|
58
|
+
font-style: italic;
|
|
59
|
+
src: url("fonts/andika/andika-latin-700-italic.woff2") format("woff2");
|
|
60
|
+
}
|
|
61
|
+
@font-face {
|
|
62
|
+
font-family: "md2pdf Fredoka";
|
|
63
|
+
font-weight: 600;
|
|
64
|
+
font-style: normal;
|
|
65
|
+
src: url("fonts/fredoka/fredoka-latin-600-normal.woff2") format("woff2");
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.markdown-body {
|
|
69
|
+
font-family: var(--md2pdf-font);
|
|
70
|
+
background: var(--md2pdf-background);
|
|
71
|
+
font-size: var(--md2pdf-font-size);
|
|
72
|
+
line-height: calc(1 + 0.6 * var(--md2pdf-leading));
|
|
73
|
+
color: var(--md2pdf-text);
|
|
74
|
+
-webkit-print-color-adjust: exact;
|
|
75
|
+
print-color-adjust: exact;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.markdown-body p {
|
|
79
|
+
margin: 0 0 calc(0.9em * var(--md2pdf-space));
|
|
80
|
+
orphans: 3;
|
|
81
|
+
widows: 3;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* Headings: rounded and bright. Sections take turns in four colors, starting with the accent. */
|
|
85
|
+
|
|
86
|
+
.markdown-body h1,
|
|
87
|
+
.markdown-body h2,
|
|
88
|
+
.markdown-body h3,
|
|
89
|
+
.markdown-body h4,
|
|
90
|
+
.markdown-body h5,
|
|
91
|
+
.markdown-body h6 {
|
|
92
|
+
font-family: var(--md2pdf-heading-font);
|
|
93
|
+
font-weight: 600;
|
|
94
|
+
line-height: calc(1 + 0.2 * var(--md2pdf-leading));
|
|
95
|
+
break-after: avoid;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/* The title, with a short rainbow bar under it, brighter than the text colors: it's decoration. */
|
|
99
|
+
.markdown-body h1 {
|
|
100
|
+
font-size: calc(31.5 / 13.5 * var(--md2pdf-font-size));
|
|
101
|
+
color: var(--md2pdf-accent);
|
|
102
|
+
margin: 0 0 calc(0.6em * var(--md2pdf-space));
|
|
103
|
+
/* The bar is a block inside the heading; without this a page can break between them. */
|
|
104
|
+
break-inside: avoid;
|
|
105
|
+
}
|
|
106
|
+
.markdown-body h1:not(:first-child) {
|
|
107
|
+
margin-top: calc(1.4em * var(--md2pdf-space));
|
|
108
|
+
}
|
|
109
|
+
.markdown-body h1::after {
|
|
110
|
+
content: "";
|
|
111
|
+
display: block;
|
|
112
|
+
width: 3.2em;
|
|
113
|
+
height: 0.16em;
|
|
114
|
+
margin-top: calc(0.2em * var(--md2pdf-space));
|
|
115
|
+
border-radius: 0.08em;
|
|
116
|
+
background: linear-gradient(90deg, var(--md2pdf-accent) 0 20%, #ff4f8b 20% 40%, #f5b700 40% 60%,
|
|
117
|
+
#2fb36b 60% 80%, #ff8a00 80% 100%);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/* Section headings: a dotted underline in the section's color. */
|
|
121
|
+
.markdown-body h2 {
|
|
122
|
+
--md2pdf-section: var(--md2pdf-accent);
|
|
123
|
+
font-size: calc(21.5 / 13.5 * var(--md2pdf-font-size));
|
|
124
|
+
color: var(--md2pdf-section);
|
|
125
|
+
margin: calc(1.5em * var(--md2pdf-space)) 0 calc(0.6em * var(--md2pdf-space));
|
|
126
|
+
padding-bottom: 0.15em;
|
|
127
|
+
border-bottom: 0.14em dotted var(--md2pdf-section);
|
|
128
|
+
}
|
|
129
|
+
.markdown-body h2:nth-of-type(4n + 2) {
|
|
130
|
+
--md2pdf-section: #d1306b;
|
|
131
|
+
}
|
|
132
|
+
.markdown-body h2:nth-of-type(4n + 3) {
|
|
133
|
+
--md2pdf-section: #167f47;
|
|
134
|
+
}
|
|
135
|
+
.markdown-body h2:nth-of-type(4n + 4) {
|
|
136
|
+
--md2pdf-section: #b55300;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.markdown-body h3 {
|
|
140
|
+
font-size: calc(17 / 13.5 * var(--md2pdf-font-size));
|
|
141
|
+
color: #7a3fd1;
|
|
142
|
+
margin: calc(1.3em * var(--md2pdf-space)) 0 calc(0.4em * var(--md2pdf-space));
|
|
143
|
+
}
|
|
144
|
+
.markdown-body h4 {
|
|
145
|
+
font-size: calc(14.5 / 13.5 * var(--md2pdf-font-size));
|
|
146
|
+
color: var(--md2pdf-accent);
|
|
147
|
+
margin: calc(1.2em * var(--md2pdf-space)) 0 calc(0.35em * var(--md2pdf-space));
|
|
148
|
+
}
|
|
149
|
+
.markdown-body h5,
|
|
150
|
+
.markdown-body h6 {
|
|
151
|
+
font-size: var(--md2pdf-font-size);
|
|
152
|
+
margin: calc(1.1em * var(--md2pdf-space)) 0 calc(0.3em * var(--md2pdf-space));
|
|
153
|
+
}
|
|
154
|
+
.markdown-body h6 {
|
|
155
|
+
color: var(--md2pdf-muted);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/* Links */
|
|
159
|
+
|
|
160
|
+
.markdown-body a {
|
|
161
|
+
color: var(--md2pdf-accent);
|
|
162
|
+
text-decoration: underline;
|
|
163
|
+
text-decoration-thickness: 0.08em;
|
|
164
|
+
text-underline-offset: 0.15em;
|
|
165
|
+
}
|
|
166
|
+
.markdown-body a.header-anchor {
|
|
167
|
+
display: none;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/* Lists: big colored bullets and roomy items. */
|
|
171
|
+
|
|
172
|
+
.markdown-body ul,
|
|
173
|
+
.markdown-body ol {
|
|
174
|
+
margin: 0 0 calc(0.9em * var(--md2pdf-space));
|
|
175
|
+
padding-left: 1.6em;
|
|
176
|
+
}
|
|
177
|
+
.markdown-body li {
|
|
178
|
+
margin: calc(0.3em * var(--md2pdf-space)) 0;
|
|
179
|
+
padding-left: 0.2em;
|
|
180
|
+
}
|
|
181
|
+
.markdown-body li > ul,
|
|
182
|
+
.markdown-body li > ol {
|
|
183
|
+
margin: calc(0.3em * var(--md2pdf-space)) 0 0;
|
|
184
|
+
}
|
|
185
|
+
.markdown-body li::marker {
|
|
186
|
+
color: var(--md2pdf-accent);
|
|
187
|
+
font-family: var(--md2pdf-heading-font);
|
|
188
|
+
font-weight: 600;
|
|
189
|
+
}
|
|
190
|
+
.markdown-body ul > li::marker {
|
|
191
|
+
font-size: 1.2em;
|
|
192
|
+
}
|
|
193
|
+
.markdown-body li li::marker {
|
|
194
|
+
color: #d1306b;
|
|
195
|
+
}
|
|
196
|
+
.markdown-body li li li::marker {
|
|
197
|
+
color: #167f47;
|
|
198
|
+
}
|
|
199
|
+
.markdown-body .task-list-item {
|
|
200
|
+
list-style-type: none;
|
|
201
|
+
}
|
|
202
|
+
/* Big rounded boxes to tick by hand, drawn here: the browser's own are greyed out, as they're
|
|
203
|
+
disabled. Sized from the text, not the browser's smaller control font. */
|
|
204
|
+
.markdown-body .task-list-item input {
|
|
205
|
+
appearance: none;
|
|
206
|
+
font-size: inherit;
|
|
207
|
+
width: 1.3em;
|
|
208
|
+
height: 1.3em;
|
|
209
|
+
margin: 0 0.5em 0.15em -1.8em;
|
|
210
|
+
vertical-align: middle;
|
|
211
|
+
border: 2px solid var(--md2pdf-accent);
|
|
212
|
+
border-radius: 0.25em;
|
|
213
|
+
background: var(--md2pdf-background);
|
|
214
|
+
}
|
|
215
|
+
.markdown-body .task-list-item input:checked {
|
|
216
|
+
background: var(--md2pdf-accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='%23fff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% no-repeat;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/* Emphasis */
|
|
220
|
+
|
|
221
|
+
.markdown-body strong {
|
|
222
|
+
font-weight: 700;
|
|
223
|
+
}
|
|
224
|
+
.markdown-body mark {
|
|
225
|
+
padding: 0 0.15em;
|
|
226
|
+
border-radius: 0.3em;
|
|
227
|
+
background: #fff0a8;
|
|
228
|
+
color: inherit;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/* Quotes: a rounded, dashed speech box. */
|
|
232
|
+
|
|
233
|
+
.markdown-body blockquote {
|
|
234
|
+
margin: calc(1.2em * var(--md2pdf-space)) 0;
|
|
235
|
+
padding: 0.7em 1em;
|
|
236
|
+
border: 2px dashed var(--md2pdf-rule);
|
|
237
|
+
border-radius: 14px;
|
|
238
|
+
color: var(--md2pdf-muted);
|
|
239
|
+
break-inside: avoid;
|
|
240
|
+
}
|
|
241
|
+
.markdown-body blockquote > :last-child {
|
|
242
|
+
margin-bottom: 0;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/* Callouts (GitHub alerts and Obsidian callouts): a rounded box outlined in the callout's color. */
|
|
246
|
+
|
|
247
|
+
.markdown-body .markdown-alert {
|
|
248
|
+
--md2pdf-callout: var(--md2pdf-accent);
|
|
249
|
+
margin: calc(1.2em * var(--md2pdf-space)) 0;
|
|
250
|
+
padding: 0.7em 1em;
|
|
251
|
+
border: 2px solid var(--md2pdf-callout);
|
|
252
|
+
border-radius: 14px;
|
|
253
|
+
break-inside: avoid;
|
|
254
|
+
}
|
|
255
|
+
.markdown-body .markdown-alert-tip {
|
|
256
|
+
--md2pdf-callout: #167f47;
|
|
257
|
+
}
|
|
258
|
+
.markdown-body .markdown-alert-important {
|
|
259
|
+
--md2pdf-callout: #7a3fd1;
|
|
260
|
+
}
|
|
261
|
+
.markdown-body .markdown-alert-warning {
|
|
262
|
+
--md2pdf-callout: #b55300;
|
|
263
|
+
}
|
|
264
|
+
.markdown-body .markdown-alert-caution {
|
|
265
|
+
--md2pdf-callout: #d1306b;
|
|
266
|
+
}
|
|
267
|
+
.markdown-body .markdown-alert-quote {
|
|
268
|
+
--md2pdf-callout: var(--md2pdf-muted);
|
|
269
|
+
}
|
|
270
|
+
.markdown-body .markdown-alert-title {
|
|
271
|
+
margin-bottom: calc(0.3em * var(--md2pdf-space));
|
|
272
|
+
color: var(--md2pdf-callout);
|
|
273
|
+
font-family: var(--md2pdf-heading-font);
|
|
274
|
+
font-weight: 600;
|
|
275
|
+
}
|
|
276
|
+
.markdown-body .markdown-alert-title .octicon {
|
|
277
|
+
margin-right: 0.45em;
|
|
278
|
+
vertical-align: -0.12em;
|
|
279
|
+
width: 1.05em;
|
|
280
|
+
height: 1.05em;
|
|
281
|
+
fill: currentColor;
|
|
282
|
+
}
|
|
283
|
+
.markdown-body .markdown-alert > :last-child {
|
|
284
|
+
margin-bottom: 0;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/* Code */
|
|
288
|
+
|
|
289
|
+
.markdown-body code,
|
|
290
|
+
.markdown-body kbd {
|
|
291
|
+
font-family: var(--md2pdf-code-font);
|
|
292
|
+
font-size: 0.85em;
|
|
293
|
+
}
|
|
294
|
+
.markdown-body :not(pre) > code {
|
|
295
|
+
padding: 0.1em 0.35em;
|
|
296
|
+
border: 1px solid var(--md2pdf-rule);
|
|
297
|
+
border-radius: 6px;
|
|
298
|
+
background: var(--md2pdf-surface);
|
|
299
|
+
}
|
|
300
|
+
.markdown-body kbd {
|
|
301
|
+
padding: 0.05em 0.4em;
|
|
302
|
+
border: 1.5px solid var(--md2pdf-rule);
|
|
303
|
+
border-bottom-width: 3px;
|
|
304
|
+
border-radius: 6px;
|
|
305
|
+
}
|
|
306
|
+
.markdown-body pre {
|
|
307
|
+
margin: 0 0 calc(1.1em * var(--md2pdf-space));
|
|
308
|
+
padding: 0.9em 1.1em;
|
|
309
|
+
border: 2px solid var(--md2pdf-rule);
|
|
310
|
+
border-radius: 14px;
|
|
311
|
+
background: var(--md2pdf-surface);
|
|
312
|
+
line-height: calc(1 + 0.5 * var(--md2pdf-leading));
|
|
313
|
+
white-space: pre-wrap;
|
|
314
|
+
word-break: break-word;
|
|
315
|
+
break-inside: avoid;
|
|
316
|
+
}
|
|
317
|
+
.markdown-body pre code {
|
|
318
|
+
font-size: calc(10.5 / 13.5 * var(--md2pdf-font-size));
|
|
319
|
+
}
|
|
320
|
+
/* A highlight.js theme on the host page styles .hljs too; keep code blocks this style's own. */
|
|
321
|
+
.markdown-body pre code.hljs {
|
|
322
|
+
display: inline;
|
|
323
|
+
overflow: visible;
|
|
324
|
+
padding: 0;
|
|
325
|
+
color: inherit;
|
|
326
|
+
background: none;
|
|
327
|
+
}
|
|
328
|
+
/* And its tokens: this outranks a theme's token rules, and this style's colors come after it. */
|
|
329
|
+
.markdown-body [class*="hljs-"] {
|
|
330
|
+
color: inherit;
|
|
331
|
+
background: none;
|
|
332
|
+
font-style: inherit;
|
|
333
|
+
font-weight: inherit;
|
|
334
|
+
text-decoration: none;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
.markdown-body .hljs-comment,
|
|
338
|
+
.markdown-body .hljs-quote {
|
|
339
|
+
color: #716b88;
|
|
340
|
+
font-style: italic;
|
|
341
|
+
}
|
|
342
|
+
.markdown-body .hljs-keyword,
|
|
343
|
+
.markdown-body .hljs-selector-tag,
|
|
344
|
+
.markdown-body .hljs-literal,
|
|
345
|
+
.markdown-body .hljs-doctag {
|
|
346
|
+
color: #7a3fd1;
|
|
347
|
+
font-weight: 600;
|
|
348
|
+
}
|
|
349
|
+
.markdown-body .hljs-string,
|
|
350
|
+
.markdown-body .hljs-regexp,
|
|
351
|
+
.markdown-body .hljs-addition {
|
|
352
|
+
color: #167f47;
|
|
353
|
+
}
|
|
354
|
+
.markdown-body .hljs-number,
|
|
355
|
+
.markdown-body .hljs-symbol,
|
|
356
|
+
.markdown-body .hljs-bullet {
|
|
357
|
+
color: #b55300;
|
|
358
|
+
}
|
|
359
|
+
.markdown-body .hljs-title,
|
|
360
|
+
.markdown-body .hljs-section,
|
|
361
|
+
.markdown-body .hljs-name {
|
|
362
|
+
color: #1f6fd1;
|
|
363
|
+
font-weight: 600;
|
|
364
|
+
}
|
|
365
|
+
.markdown-body .hljs-built_in,
|
|
366
|
+
.markdown-body .hljs-type,
|
|
367
|
+
.markdown-body .hljs-attr,
|
|
368
|
+
.markdown-body .hljs-attribute,
|
|
369
|
+
.markdown-body .hljs-variable,
|
|
370
|
+
.markdown-body .hljs-template-variable {
|
|
371
|
+
color: #d1306b;
|
|
372
|
+
}
|
|
373
|
+
.markdown-body .hljs-meta,
|
|
374
|
+
.markdown-body .hljs-deletion {
|
|
375
|
+
color: #b42318;
|
|
376
|
+
}
|
|
377
|
+
.markdown-body .hljs-emphasis {
|
|
378
|
+
font-style: italic;
|
|
379
|
+
}
|
|
380
|
+
.markdown-body .hljs-strong {
|
|
381
|
+
font-weight: bold;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/* Math */
|
|
385
|
+
|
|
386
|
+
.markdown-body .katex {
|
|
387
|
+
font-size: 1.1em;
|
|
388
|
+
}
|
|
389
|
+
.markdown-body .katex-display {
|
|
390
|
+
margin: calc(0.9em * var(--md2pdf-space)) 0;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
/* Tables: a rounded box in the accent color, rounded headings, dotted lines between rows. */
|
|
394
|
+
|
|
395
|
+
.markdown-body table {
|
|
396
|
+
width: 100%;
|
|
397
|
+
border-collapse: separate;
|
|
398
|
+
border-spacing: 0;
|
|
399
|
+
margin: calc(1.2em * var(--md2pdf-space)) 0;
|
|
400
|
+
border: 2px solid var(--md2pdf-accent);
|
|
401
|
+
border-radius: 14px;
|
|
402
|
+
font-variant-numeric: tabular-nums;
|
|
403
|
+
}
|
|
404
|
+
.markdown-body th,
|
|
405
|
+
.markdown-body td {
|
|
406
|
+
padding: 0.45em 0.8em;
|
|
407
|
+
text-align: left;
|
|
408
|
+
vertical-align: top;
|
|
409
|
+
}
|
|
410
|
+
.markdown-body th {
|
|
411
|
+
font-family: var(--md2pdf-heading-font);
|
|
412
|
+
font-weight: 600;
|
|
413
|
+
color: var(--md2pdf-accent);
|
|
414
|
+
border-bottom: 2px solid var(--md2pdf-accent);
|
|
415
|
+
}
|
|
416
|
+
.markdown-body tr:not(:last-child) > td {
|
|
417
|
+
border-bottom: 2px dotted var(--md2pdf-rule);
|
|
418
|
+
}
|
|
419
|
+
.markdown-body th + th,
|
|
420
|
+
.markdown-body td + td {
|
|
421
|
+
border-left: 2px dotted var(--md2pdf-rule);
|
|
422
|
+
}
|
|
423
|
+
.markdown-body tr {
|
|
424
|
+
break-inside: avoid;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
/* Rules, images and diagrams */
|
|
428
|
+
|
|
429
|
+
/* A row of colored dots. */
|
|
430
|
+
.markdown-body hr {
|
|
431
|
+
margin: calc(1.8em * var(--md2pdf-space)) auto;
|
|
432
|
+
width: 40%;
|
|
433
|
+
height: 0;
|
|
434
|
+
border: 0;
|
|
435
|
+
border-top: 5px dotted var(--md2pdf-accent);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
.markdown-body img {
|
|
439
|
+
display: block;
|
|
440
|
+
max-width: 100%;
|
|
441
|
+
margin: calc(1.2em * var(--md2pdf-space)) auto;
|
|
442
|
+
border-radius: 12px;
|
|
443
|
+
break-inside: avoid;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
.markdown-body .mermaid-diagram {
|
|
447
|
+
margin: calc(1.4em * var(--md2pdf-space)) 0;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/* Footnotes */
|
|
451
|
+
|
|
452
|
+
.markdown-body hr.footnotes-sep {
|
|
453
|
+
display: none;
|
|
454
|
+
}
|
|
455
|
+
.markdown-body .footnotes {
|
|
456
|
+
margin-top: calc(2.4em * var(--md2pdf-space));
|
|
457
|
+
padding-top: 0.8em;
|
|
458
|
+
border-top: 2px dotted var(--md2pdf-rule);
|
|
459
|
+
font-size: calc(11 / 13.5 * var(--md2pdf-font-size));
|
|
460
|
+
color: var(--md2pdf-muted);
|
|
461
|
+
}
|
|
462
|
+
.markdown-body .footnotes ol {
|
|
463
|
+
padding-left: 1.4em;
|
|
464
|
+
}
|
|
465
|
+
.markdown-body .footnotes li {
|
|
466
|
+
margin: calc(0.2em * var(--md2pdf-space)) 0;
|
|
467
|
+
}
|
|
468
|
+
.markdown-body .footnotes p {
|
|
469
|
+
margin: 0;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
/* An Obsidian embed (![[Other note]]) that can't be shown: a muted placeholder. */
|
|
473
|
+
.markdown-body .markdown-embed {
|
|
474
|
+
color: var(--md2pdf-muted);
|
|
475
|
+
font-style: italic;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/* <div class="page-break"></div> starts a new page. */
|
|
479
|
+
.markdown-body .page-break {
|
|
480
|
+
break-after: page;
|
|
481
|
+
}
|