book-kit 0.0.0-stage → 0.6.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/LICENSE +21 -0
- package/NOTICE.md +72 -0
- package/README.md +251 -2
- package/bin/book-kit.js +115 -0
- package/commands/_emoji_io.py +32 -0
- package/commands/audit-chapter-lengths.js +244 -0
- package/commands/check-epub-size.js +68 -0
- package/commands/check-pdf-page-count.js +162 -0
- package/commands/composite-kindle-emoji.py +85 -0
- package/commands/composite-print-emoji.py +98 -0
- package/commands/conventions.js +76 -0
- package/commands/convert-pdfx.sh +194 -0
- package/commands/download-icc-profile.sh +105 -0
- package/commands/fonts.py +212 -0
- package/commands/generate-reference-docx.py +344 -0
- package/commands/kindle-fonts.js +173 -0
- package/commands/links-to-footnotes.js +366 -0
- package/commands/markdownlint.js +25 -0
- package/commands/minify-css.js +43 -0
- package/commands/optimize-images.js +73 -0
- package/commands/parity.sh +150 -0
- package/commands/postprocess-epub.js +541 -0
- package/commands/prep-print-src.js +77 -0
- package/commands/prose.js +38 -0
- package/commands/release-files.js +89 -0
- package/commands/reorder-print-frontmatter.js +79 -0
- package/commands/strip-page-rules.js +1168 -0
- package/commands/strip-property-rules.js +93 -0
- package/commands/update-key-takeaways.js +314 -0
- package/commands/validate.js +283 -0
- package/configs/markdownlint-cli2.jsonc +98 -0
- package/configs/textlintrc.json +22 -0
- package/css/theme/01-tokens.css +83 -0
- package/css/theme/02-fonts.css +79 -0
- package/css/theme/03-prose.css +53 -0
- package/css/theme/04-base.css +226 -0
- package/css/theme/05-components.css +546 -0
- package/css/theme/06-utilities.css +40 -0
- package/css/theme/07-ereader.css +245 -0
- package/css/theme/08-epub.css +865 -0
- package/css/theme/09-back-matter.css +47 -0
- package/css/theme/10-dark.css +302 -0
- package/css/theme/11-print.css +1229 -0
- package/css/theme.css +38 -0
- package/defaults/book.config.yml +318 -0
- package/defaults/pandoc-base.yml +19 -0
- package/defaults/pandoc-docx.yml +6 -0
- package/defaults/pandoc-epub-fonts.yml +6 -0
- package/defaults/pandoc-epub.yml +15 -0
- package/defaults/pandoc-kindle.yml +6 -0
- package/emoji/1f382.png +0 -0
- package/emoji/1f389.png +0 -0
- package/emoji/1f440.png +0 -0
- package/emoji/1f44d.png +0 -0
- package/emoji/1f44f.png +0 -0
- package/emoji/1f454.png +0 -0
- package/emoji/1f4a1.png +0 -0
- package/emoji/1f4bb.png +0 -0
- package/emoji/1f602.png +0 -0
- package/emoji/1f603.png +0 -0
- package/emoji/1f604.png +0 -0
- package/emoji/1f60a.png +0 -0
- package/emoji/1f60f.png +0 -0
- package/emoji/1f64c.png +0 -0
- package/emoji/1f64f.png +0 -0
- package/emoji/1f914.png +0 -0
- package/emoji/1f923.png +0 -0
- package/emoji/2714.png +0 -0
- package/emoji/274c.png +0 -0
- package/filters/add-div-titles.lua +196 -0
- package/filters/arc-notice.lua +36 -0
- package/filters/body-emoji-images.lua +48 -0
- package/filters/callout-classes.lua +40 -0
- package/filters/lib/book_kit.lua +110 -0
- package/filters/revision.lua +17 -0
- package/filters/strip-comments.lua +40 -0
- package/filters/strip-emoji-kindle.lua +134 -0
- package/fonts/LICENSE-source-code-pro.md +93 -0
- package/fonts/LICENSE-source-sans.md +93 -0
- package/fonts/LICENSE-source-serif.md +93 -0
- package/fonts/recipe.json +41 -0
- package/just/book-kit.just +229 -0
- package/lib/acronyms.js +47 -0
- package/lib/callouts.js +17 -0
- package/lib/config.js +211 -0
- package/lib/is-main.js +21 -0
- package/lib/lint.js +148 -0
- package/lib/pandoc.js +148 -0
- package/lib/paragraphs.js +173 -0
- package/lib/revision.js +35 -0
- package/lib/structure.js +39 -0
- package/lib/textlint-github-formatter.js +58 -0
- package/lib/validate.js +202 -0
- package/package.json +98 -4
- package/presets/business-nonfiction/CONVENTIONS.md +35 -0
- package/presets/business-nonfiction/preset.yml +128 -0
- package/profiles/pdfx-def.ps +42 -0
- package/requirements.txt +14 -0
- package/rules/no-ai-like-patterns.js +209 -0
- package/rules/no-assumptive.js +76 -0
- package/rules/no-bare-acronyms.js +129 -0
- package/rules/no-cliches.js +544 -0
- package/rules/no-cultural-idioms.js +422 -0
- package/rules/no-vague-intensifiers.js +94 -0
- package/templates/template-epub.html +79 -0
- package/templates/template.html +73 -0
- package/toolchain.json +42 -0
- package/validators/acronym-expansion.js +94 -0
- package/validators/bold-keywords.js +56 -0
- package/validators/callout-balance.js +74 -0
- package/validators/callout-divs.js +66 -0
- package/validators/callout-labels.js +102 -0
- package/validators/chapter-lengths.js +14 -0
- package/validators/chapter.js +57 -0
- package/validators/cross-references.js +45 -0
- package/validators/doubled-words.js +76 -0
- package/validators/duplicate-headings.js +52 -0
- package/validators/em-dashes.js +73 -0
- package/validators/escaped-smallcaps.js +46 -0
- package/validators/footnotes.js +78 -0
- package/validators/heading-hierarchy.js +58 -0
- package/validators/hypothetical-hooks.js +103 -0
- package/validators/index-integrity.js +28 -0
- package/validators/index.js +73 -0
- package/validators/list-punctuation.js +123 -0
- package/validators/min-opener-length.js +87 -0
- package/validators/no-bare-url-link-text.js +38 -0
- package/validators/no-todo-markers.js +49 -0
- package/validators/no-transition-todos.js +34 -0
- package/validators/number-range-dashes.js +72 -0
- package/validators/paragraph-length.js +62 -0
- package/validators/quote-punctuation.js +85 -0
- package/validators/section-intro-final-lead.js +90 -0
- package/validators/section-intro-has-lead.js +41 -0
- package/validators/section-intro-no-tldr.js +37 -0
- package/validators/section-intros.js +33 -0
- package/validators/sentence-starters.js +132 -0
- package/validators/smallcaps.js +67 -0
- package/validators/tldr-length.js +58 -0
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
/* ============================================
|
|
2
|
+
EPUB/E-READER ENHANCEMENTS
|
|
3
|
+
Styles optimized for EPUB readers like Kindle,
|
|
4
|
+
Apple Books, and other e-readers. These don't
|
|
5
|
+
use media queries since EPUB support is limited.
|
|
6
|
+
============================================ */
|
|
7
|
+
|
|
8
|
+
/* EPUB base font-size — use 1em (industry default) instead of Tailwind
|
|
9
|
+
Typography's 1rem. Kindle Publishing Guidelines, the EPUB 3 spec,
|
|
10
|
+
and Apple Books all recommend 1em/100% so the reader controls sizing.
|
|
11
|
+
em has wider EPUB-reader support than rem (especially older Kindle). */
|
|
12
|
+
.prose {
|
|
13
|
+
font-size: 1em;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* Page breaks on section wrappers so EPUB anchor links land on the correct page.
|
|
17
|
+
Pandoc places the anchor ID on the <section> wrapper, not the <h1>/<h2>.
|
|
18
|
+
If page-break-before is on the heading, EPUB readers navigate to the
|
|
19
|
+
section (before the page break) and show the previous page's content. */
|
|
20
|
+
.level1,
|
|
21
|
+
.level2 {
|
|
22
|
+
page-break-before: always;
|
|
23
|
+
break-before: page;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* In print output, let headings control chapter breaks to avoid redundant
|
|
27
|
+
breaks on both the section and the heading (which can cause blank pages). */
|
|
28
|
+
@media print {
|
|
29
|
+
.level1,
|
|
30
|
+
.level2 {
|
|
31
|
+
page-break-before: auto !important;
|
|
32
|
+
break-before: auto !important;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* Enhanced chapter titles for EPUB navigation
|
|
37
|
+
Note: Pandoc outputs epub:type="bodymatter" on <body>, not
|
|
38
|
+
epub:type="chapter" on sections, so we target heading levels
|
|
39
|
+
and the .level1/.level2 classes pandoc generates instead. */
|
|
40
|
+
.level1 > h1,
|
|
41
|
+
.level2 > h2,
|
|
42
|
+
h1.chapter-title,
|
|
43
|
+
h2.chapter-title {
|
|
44
|
+
margin-top: 2rem;
|
|
45
|
+
margin-bottom: 1.25rem;
|
|
46
|
+
padding-bottom: 0.5rem;
|
|
47
|
+
page-break-after: avoid;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* Copyright page — EPUB-compatible layout.
|
|
51
|
+
Flexbox and viewport units (100vh) are unsupported in most
|
|
52
|
+
EPUB readers (Kindle, Kobo, older Apple Books). The EPUB-only
|
|
53
|
+
overrides are in the @media not screen block below (line ~1180). */
|
|
54
|
+
|
|
55
|
+
/* Fix copyright section visibility in EPUB.
|
|
56
|
+
Pandoc propagates .invisible from the H2 to the wrapping
|
|
57
|
+
<section>, hiding ALL content via inherited visibility:hidden.
|
|
58
|
+
Reset visibility on the section so paragraphs show, then
|
|
59
|
+
collapse only the heading to zero height. */
|
|
60
|
+
#copyright-page .invisible {
|
|
61
|
+
visibility: visible;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
#copyright-page .invisible > h2 {
|
|
65
|
+
/* Screen-reader only: keep in accessibility tree (heading-order validity)
|
|
66
|
+
but hide visually. Do not use visibility:hidden or display:none —
|
|
67
|
+
those remove the heading from the a11y tree and cause axe
|
|
68
|
+
heading-order violations for subsequent H3s. */
|
|
69
|
+
position: absolute;
|
|
70
|
+
width: 1px;
|
|
71
|
+
height: 1px;
|
|
72
|
+
padding: 0;
|
|
73
|
+
margin: -1px;
|
|
74
|
+
overflow: hidden;
|
|
75
|
+
clip: rect(0, 0, 0, 0);
|
|
76
|
+
white-space: nowrap;
|
|
77
|
+
border: 0;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* First paragraph after chapter heading — block style, no indent */
|
|
81
|
+
h1 + p,
|
|
82
|
+
h2 + p,
|
|
83
|
+
h3 + p {
|
|
84
|
+
text-indent: 0;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* Paragraph hyphenation for better text justification on e-readers */
|
|
88
|
+
p {
|
|
89
|
+
hyphens: auto;
|
|
90
|
+
-webkit-hyphens: auto;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* Widows and orphans — prevent single straggler lines at page boundaries.
|
|
94
|
+
E-reader screens are small, so use 2 (not 3) to avoid excessive
|
|
95
|
+
page shuffling. Apple Books respects these; Kindle partially supports. */
|
|
96
|
+
p,
|
|
97
|
+
li,
|
|
98
|
+
blockquote,
|
|
99
|
+
dd {
|
|
100
|
+
orphans: 2;
|
|
101
|
+
widows: 2;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* Headings: keep with following content and prevent stranding.
|
|
105
|
+
h1-h3 already have orphans/widows: 3 from the base layer;
|
|
106
|
+
h4-h6 only had page-break-after: avoid. */
|
|
107
|
+
h4,
|
|
108
|
+
h5,
|
|
109
|
+
h6 {
|
|
110
|
+
orphans: 2;
|
|
111
|
+
widows: 2;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* Callouts: prefer keeping whole, but if a long callout must break,
|
|
115
|
+
don't strand a single line on either side of the page boundary. */
|
|
116
|
+
.tldr,
|
|
117
|
+
.callout,
|
|
118
|
+
.note,
|
|
119
|
+
.tip,
|
|
120
|
+
.warning,
|
|
121
|
+
.pro-tip,
|
|
122
|
+
.for-managers,
|
|
123
|
+
.for-ics,
|
|
124
|
+
.common-objection,
|
|
125
|
+
.takeaways {
|
|
126
|
+
orphans: 3;
|
|
127
|
+
widows: 3;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/* Small caps for EPUB — no font-size compensation needed.
|
|
131
|
+
Source Serif 4 has true OpenType small-cap glyphs (smcp/c2sc), so
|
|
132
|
+
all-small-caps renders at the correct x-height without adjustment.
|
|
133
|
+
Previous 1.15em compensation was for Noto fonts whose smcp silently
|
|
134
|
+
failed, causing e-readers to synthesize undersized small caps. */
|
|
135
|
+
|
|
136
|
+
/* Remove Tailwind Typography backtick wrapping around inline code.
|
|
137
|
+
Tailwind adds visible ` characters via ::before/::after — a blog
|
|
138
|
+
convention that doesn't belong in a published book. Code is already
|
|
139
|
+
visually distinguished by font family (Source Code Pro), weight, and
|
|
140
|
+
size. Must match Tailwind specificity (.prose code:not(.not-prose)). */
|
|
141
|
+
.prose code:not(.not-prose)::before,
|
|
142
|
+
.prose code:not(.not-prose)::after {
|
|
143
|
+
content: none;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/* Override Tailwind Typography's bold inline code.
|
|
147
|
+
The plugin applies font-weight: 600 to code elements — designed
|
|
148
|
+
for system fonts where bold distinguishes code from body text.
|
|
149
|
+
Source Code Pro is already visually distinct; bold is redundant. */
|
|
150
|
+
.prose code:not(.not-prose) {
|
|
151
|
+
font-weight: normal;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/* Enhance chapter title visual hierarchy for EPUB.
|
|
155
|
+
PDF has a dramatic 1.75" title sink; EPUB can't replicate exact
|
|
156
|
+
measurements but benefits from more generous spacing to mark chapter
|
|
157
|
+
openings clearly on small screens. No border — matches PDF's clean look. */
|
|
158
|
+
.level2 > h2 {
|
|
159
|
+
margin-top: 3em;
|
|
160
|
+
margin-bottom: 1.5em;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/* Section intro headings (h1, used for part openers) get extra presence.
|
|
164
|
+
PDF uses a thin decorative rule via ::after; EPUB approximates with
|
|
165
|
+
border-bottom since ::after isn't reliable on e-readers. */
|
|
166
|
+
.level1 > h1 {
|
|
167
|
+
margin-top: 3em;
|
|
168
|
+
padding-bottom: 0.75em;
|
|
169
|
+
border-bottom: 1px solid #000;
|
|
170
|
+
margin-bottom: 1.5em;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/* Link styling differs by format:
|
|
174
|
+
• Screen: brand blue, no underline (color provides distinction)
|
|
175
|
+
• EPUB/e-ink: underline required (blue renders as gray on e-ink)
|
|
176
|
+
• Print: black, no underline (context and footnotes provide distinction) */
|
|
177
|
+
|
|
178
|
+
/* Links: ensure distinction on e-ink screens.
|
|
179
|
+
E-ink renders blue as gray, making underline-only links hard to spot.
|
|
180
|
+
Use underline + slightly heavier weight for reliable visibility.
|
|
181
|
+
Scoped to .prose to avoid styling TOC/nav links. */
|
|
182
|
+
.prose a:not(.not-prose) {
|
|
183
|
+
text-decoration: underline;
|
|
184
|
+
text-decoration-thickness: 1px;
|
|
185
|
+
text-underline-offset: 0.15em;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/* Blockquotes: more refined styling for book-quality appearance.
|
|
189
|
+
Increase left border width and add left padding for visual weight. */
|
|
190
|
+
.prose blockquote:not(.not-prose) {
|
|
191
|
+
border-left-width: 3px;
|
|
192
|
+
border-left-color: #999;
|
|
193
|
+
padding-left: 1.25em;
|
|
194
|
+
color: #444;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/* Accessible contrast for muted text in EPUB.
|
|
198
|
+
--color-muted (#6c757d) is only ~4.6:1 on white — borderline WCAG AA
|
|
199
|
+
and unreliable on e-ink/sepia backgrounds. #555 provides ~7.5:1 (AAA).
|
|
200
|
+
Also bump lead font-weight from 300 (light) to 400 (normal) since
|
|
201
|
+
thin strokes further reduce perceived contrast on e-readers.
|
|
202
|
+
Must match Tailwind Typography specificity (.prose X:not(.not-prose)). */
|
|
203
|
+
.lead,
|
|
204
|
+
.prose .lead:not(.not-prose),
|
|
205
|
+
section.section-opener > p,
|
|
206
|
+
section.section-opener > ul,
|
|
207
|
+
section.section-opener > ol {
|
|
208
|
+
color: #555;
|
|
209
|
+
font-weight: 400;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/* The lead treatment is for a section's opening pages only. Where a
|
|
213
|
+
section's chapters sit directly in its <section> (a closing section, say),
|
|
214
|
+
their body paragraphs follow an h2 and would otherwise all render as large, gray
|
|
215
|
+
lead text. Unlayered and one type selector more specific than every
|
|
216
|
+
section-opener lead rule (base, Kindle, and dark mode), so it wins in each. */
|
|
217
|
+
section.section-opener > h2 ~ p,
|
|
218
|
+
section.section-opener > h2 ~ ul,
|
|
219
|
+
section.section-opener > h2 ~ ol {
|
|
220
|
+
font-size: inherit;
|
|
221
|
+
font-weight: inherit;
|
|
222
|
+
line-height: inherit;
|
|
223
|
+
color: inherit;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/* Weight 300 (light) renders poorly on e-ink — thin strokes disappear.
|
|
227
|
+
Override subtitle to 400, matching the .lead fix above. */
|
|
228
|
+
p.subtitle {
|
|
229
|
+
font-weight: 400;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/* Ensure semibold (600) for bold text in EPUB.
|
|
233
|
+
The @layer base rule (strong, b { font-weight: 600 }) doesn't survive
|
|
234
|
+
the EPUB strip process due to selector deduplication with Tailwind's
|
|
235
|
+
preflight (b, strong { font-weight: bolder }). This unlayered rule
|
|
236
|
+
takes precedence and ensures consistent bold weight. */
|
|
237
|
+
strong,
|
|
238
|
+
b {
|
|
239
|
+
font-weight: 600;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
figcaption,
|
|
243
|
+
.prose figcaption:not(.not-prose) {
|
|
244
|
+
color: #555;
|
|
245
|
+
}
|