gutterpress 0.11.23-alpha.1 → 0.11.23-alpha.2
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 +21 -22
- package/dist/api/index.d.ts +4 -4
- package/dist/api/index.js +16 -22
- package/dist/{build-09cd1n7s.js → build-encgnv0c.js} +9 -10
- package/dist/{cli-habkc5ng.js → cli-a35w7wzg.js} +5 -4
- package/dist/{cli-b0vyjvmt.js → cli-aqh6brew.js} +1 -1
- package/dist/{cli-ccp7sxz3.js → cli-evg8sbht.js} +1 -1
- package/dist/{cli-nr6j6300.js → cli-kh8v4vvw.js} +1 -1
- package/dist/{cli-h17e3mtz.js → cli-pwwfxdgb.js} +385 -10
- package/dist/{cli-dtckwda1.js → cli-pz4bn98t.js} +185 -9
- package/dist/{cli-dd115fa8.js → cli-sdmv4bba.js} +47 -123
- package/dist/{cli-5hkmp2wy.js → cli-xq6djqbj.js} +55 -88
- package/dist/{index-r7jcsk6h.js → cli-y28j019d.js} +19 -10
- package/dist/cli.js +12 -12
- package/dist/{doctor-nddspx4n.js → doctor-5gtpgpd1.js} +3 -3
- package/dist/{engine-892swzzc.js → engine-mc5br8g8.js} +1 -2
- package/dist/{engine-yjzknt0g.js → engine-tn13gk0b.js} +3 -3
- package/dist/{ext-zjpen4yx.js → ext-wn2a5afq.js} +18 -33
- package/dist/{extension-restore-w8xt4kbq.js → extension-restore-g8jnmmzq.js} +5 -6
- package/dist/{extension-restore-jvs60x9b.js → extension-restore-s3x1618g.js} +4 -4
- package/dist/{index-apc8w9w8.js → index-0skhjx3e.js} +180 -1
- package/dist/{index-2jpk25en.js → index-2bjcghze.js} +385 -10
- package/dist/index-46ycxe6r.js +18 -0
- package/dist/{index-0w2azsk1.js → index-4x6y8krm.js} +2 -4
- package/dist/{cli-h3phdstf.js → index-5x42amh8.js} +19 -10
- package/dist/{index-93pqkvty.js → index-h6yk5tjx.js} +5 -4
- package/dist/{index-zrhyb967.js → index-j5z86r4a.js} +335 -349
- package/dist/{index-m4hhzg3c.js → index-x3ema2w3.js} +59 -134
- package/dist/index.js +17 -23
- package/dist/lib/extension-manager.d.ts +16 -43
- package/dist/lib/extension-scaffold.d.ts +3 -3
- package/dist/lib/extension-specifier.d.ts +23 -6
- package/dist/lib/markdown/math.d.ts +1 -1
- package/dist/lib/npm-plugin-installer.d.ts +1 -1
- package/dist/lib/plugin-vendor.d.ts +11 -3
- package/dist/lib/project-gitignore.d.ts +2 -2
- package/dist/lib/project-scaffold.d.ts +5 -7
- package/dist/lib/project-templates.d.ts +0 -3
- package/dist/lib/snippets.d.ts +2 -1
- package/dist/lib/style-resolver.d.ts +1 -2
- package/dist/{manifest-8f10dr4f.yaml → manifest-eagfhba6.yaml} +2 -0
- package/dist/{manifest.schema-9aeaered.json → manifest.schema-t7nx2stg.json} +5 -5
- package/dist/{new-xhq8wczn.js → new-mhs46pw3.js} +22 -21
- package/dist/{plugins-9en8m9y0.js → plugins-1sxe0dkz.js} +4 -4
- package/dist/{plugins-gf0gkjmv.js → plugins-2cek4mz1.js} +2 -2
- package/dist/{preflight-negnxg7b.js → preflight-3k2b1x8e.js} +9 -10
- package/dist/{preview-cep2s9cg.js → preview-6p9v6rht.js} +9 -10
- package/dist/{publish-xery6qc6.js → publish-qgsngy8s.js} +9 -10
- package/dist/{source-provider-qbfknhyy.js → source-provider-98k5deda.js} +2 -2
- package/dist/{source-provider-2r74a7wp.js → source-provider-knmcam50.js} +2 -2
- package/dist/{validate-3d0sgf4g.js → validate-0v7xw6wa.js} +9 -10
- package/package.json +1 -1
- package/dist/cli-fe43evmf.js +0 -212
- package/dist/index-dsvk7q6s.js +0 -229
- package/dist/package-97gm31sg.json +0 -10
- package/dist/package-gag6ykwn.json +0 -10
- package/dist/package-nrhkwf2m.json +0 -10
- package/dist/package-zttkgydq.json +0 -10
- package/dist/theme-9c58td2d.css +0 -76
- package/dist/theme-h5recz6c.css +0 -61
- package/dist/theme-j2bagrfx.css +0 -59
- package/dist/theme-nn6d53zy.css +0 -71
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PACKAGE_VERSION,
|
|
3
3
|
debug
|
|
4
|
-
} from "./cli-
|
|
4
|
+
} from "./cli-aqh6brew.js";
|
|
5
5
|
import {
|
|
6
6
|
isExactNpmVersion,
|
|
7
7
|
isValidNpmPackageName,
|
|
8
8
|
packageResolutionTargets,
|
|
9
|
+
parseNpmPluginSpec,
|
|
9
10
|
resolvePackageEntry,
|
|
10
11
|
resolveVendoredPluginInstallRoot,
|
|
11
12
|
safePackageTarget,
|
|
12
13
|
vendoredNpmPluginPackageDir
|
|
13
|
-
} from "./cli-
|
|
14
|
+
} from "./cli-y28j019d.js";
|
|
14
15
|
|
|
15
16
|
// src/lib/markdown/plugins.ts
|
|
16
17
|
import { existsSync as existsSync2, readFileSync, statSync, unlinkSync } from "node:fs";
|
|
@@ -19,6 +20,374 @@ import { isBuiltin } from "node:module";
|
|
|
19
20
|
import { resolve as resolve2, join, dirname, basename, extname, isAbsolute, relative, sep } from "node:path";
|
|
20
21
|
import { pathToFileURL } from "node:url";
|
|
21
22
|
|
|
23
|
+
// src/assets/themes/clean-book/theme.css
|
|
24
|
+
var theme_default = `/* =============================================================================
|
|
25
|
+
Clean Book — gutterpress built-in theme (theme.css)
|
|
26
|
+
A calm, classic long-form book look. Change the :root tokens from the book's own stylesheet.
|
|
27
|
+
============================================================================= */
|
|
28
|
+
|
|
29
|
+
:root {
|
|
30
|
+
--color-ink: #1a1a1a; /* body text */
|
|
31
|
+
--color-ink-muted: #555555; /* captions, secondary text */
|
|
32
|
+
--color-accent: #2b4c7e; /* headings, links */
|
|
33
|
+
--color-paper: #ffffff; /* page background */
|
|
34
|
+
--color-rule: #d9d9d9; /* borders, rules */
|
|
35
|
+
|
|
36
|
+
--font-body: "Georgia", "Times New Roman", serif;
|
|
37
|
+
--font-display: "Georgia", "Times New Roman", serif;
|
|
38
|
+
--font-mono: "Menlo", "Consolas", monospace;
|
|
39
|
+
|
|
40
|
+
--fs-body: 11pt;
|
|
41
|
+
--fs-h1: 2.1rem;
|
|
42
|
+
--fs-h2: 1.5rem;
|
|
43
|
+
--fs-h3: 1.2rem;
|
|
44
|
+
--leading: 1.55;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@page {
|
|
48
|
+
size: 6in 9in;
|
|
49
|
+
margin: 0.85in 0.75in;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
body {
|
|
53
|
+
color: var(--color-ink);
|
|
54
|
+
background: var(--color-paper);
|
|
55
|
+
font-family: var(--font-body);
|
|
56
|
+
line-height: var(--leading);
|
|
57
|
+
font-size: var(--fs-body);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
h1, h2, h3 {
|
|
61
|
+
font-family: var(--font-display);
|
|
62
|
+
color: var(--color-accent);
|
|
63
|
+
line-height: 1.2;
|
|
64
|
+
font-weight: 600;
|
|
65
|
+
}
|
|
66
|
+
h1 { font-size: var(--fs-h1); margin: 0 0 0.6em; }
|
|
67
|
+
h2 { font-size: var(--fs-h2); margin: 1.4em 0 0.4em; }
|
|
68
|
+
h3 { font-size: var(--fs-h3); margin: 1.2em 0 0.3em; }
|
|
69
|
+
|
|
70
|
+
p { margin: 0 0 0.8em; text-align: justify; hyphens: auto; }
|
|
71
|
+
|
|
72
|
+
a { color: var(--color-accent); text-decoration: none; }
|
|
73
|
+
|
|
74
|
+
blockquote {
|
|
75
|
+
margin: 1em 0; padding: 0.2em 0 0.2em 1em;
|
|
76
|
+
border-left: 3px solid var(--color-rule);
|
|
77
|
+
color: var(--color-ink-muted); font-style: italic;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
code, pre { font-family: var(--font-mono); font-size: 0.9em; }
|
|
81
|
+
|
|
82
|
+
hr { border: 0; border-top: 1px solid var(--color-rule); margin: 1.5em 0; }
|
|
83
|
+
`;
|
|
84
|
+
|
|
85
|
+
// src/assets/themes/zine/theme.css
|
|
86
|
+
var theme_default2 = `/* =============================================================================
|
|
87
|
+
Zine — gutterpress built-in theme (theme.css)
|
|
88
|
+
High-contrast, punchy, photocopier-friendly. Change the :root tokens from the book's own stylesheet.
|
|
89
|
+
============================================================================= */
|
|
90
|
+
|
|
91
|
+
:root {
|
|
92
|
+
--color-ink: #000000; /* body text */
|
|
93
|
+
--color-ink-muted: #333333; /* secondary text */
|
|
94
|
+
--color-accent: #000000; /* headings (mono, high ink) */
|
|
95
|
+
--color-paper: #ffffff; /* page background */
|
|
96
|
+
--color-rule: #000000; /* heavy borders, rules */
|
|
97
|
+
|
|
98
|
+
--font-body: "Helvetica Neue", "Arial", sans-serif;
|
|
99
|
+
--font-display: "Impact", "Haettenschweiler", "Arial Black", sans-serif;
|
|
100
|
+
--font-mono: "Courier New", monospace;
|
|
101
|
+
|
|
102
|
+
--fs-body: 10pt;
|
|
103
|
+
--fs-h1: 2.8rem;
|
|
104
|
+
--fs-h2: 1.8rem;
|
|
105
|
+
--fs-h3: 1.3rem;
|
|
106
|
+
--leading: 1.4;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@page {
|
|
110
|
+
size: 5.5in 8.5in;
|
|
111
|
+
margin: 0.4in;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
body {
|
|
115
|
+
color: var(--color-ink);
|
|
116
|
+
background: var(--color-paper);
|
|
117
|
+
font-family: var(--font-body);
|
|
118
|
+
line-height: var(--leading);
|
|
119
|
+
font-size: var(--fs-body);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
h1, h2, h3 {
|
|
123
|
+
font-family: var(--font-display);
|
|
124
|
+
color: var(--color-accent);
|
|
125
|
+
text-transform: uppercase;
|
|
126
|
+
letter-spacing: -0.01em;
|
|
127
|
+
line-height: 0.95;
|
|
128
|
+
font-weight: 900;
|
|
129
|
+
}
|
|
130
|
+
h1 { font-size: var(--fs-h1); margin: 0 0 0.4em; }
|
|
131
|
+
h2 { font-size: var(--fs-h2); margin: 1.1em 0 0.3em; }
|
|
132
|
+
h3 { font-size: var(--fs-h3); margin: 1em 0 0.25em; }
|
|
133
|
+
|
|
134
|
+
p { margin: 0 0 0.6em; }
|
|
135
|
+
|
|
136
|
+
a { color: var(--color-accent); text-decoration: underline; font-weight: 700; }
|
|
137
|
+
|
|
138
|
+
blockquote {
|
|
139
|
+
margin: 1em 0; padding: 0.5em 0.8em;
|
|
140
|
+
border: 2px solid var(--color-rule);
|
|
141
|
+
font-weight: 700;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
hr { border: 0; border-top: 3px solid var(--color-rule); margin: 1em 0; }
|
|
145
|
+
|
|
146
|
+
code, pre { font-family: var(--font-mono); font-size: 0.95em; }
|
|
147
|
+
`;
|
|
148
|
+
|
|
149
|
+
// src/assets/themes/technical-doc/theme.css
|
|
150
|
+
var theme_default3 = `/* =============================================================================
|
|
151
|
+
Technical Document — gutterpress built-in theme (theme.css)
|
|
152
|
+
Clean sans-serif manual look with clear hierarchy. Change the :root tokens from the book's own stylesheet.
|
|
153
|
+
============================================================================= */
|
|
154
|
+
|
|
155
|
+
:root {
|
|
156
|
+
--color-ink: #1c1e21; /* body text */
|
|
157
|
+
--color-ink-muted: #5a5f66; /* captions, secondary text */
|
|
158
|
+
--color-accent: #0b5fff; /* headings, links */
|
|
159
|
+
--color-paper: #ffffff; /* page background */
|
|
160
|
+
--color-tint: #f3f5f9; /* code / note fill */
|
|
161
|
+
--color-rule: #d6dae0; /* borders, rules */
|
|
162
|
+
|
|
163
|
+
--font-body: "Helvetica Neue", "Segoe UI", Arial, sans-serif;
|
|
164
|
+
--font-display: "Helvetica Neue", "Segoe UI", Arial, sans-serif;
|
|
165
|
+
--font-mono: "SFMono-Regular", "Consolas", "Menlo", monospace;
|
|
166
|
+
|
|
167
|
+
--fs-body: 10.5pt;
|
|
168
|
+
--fs-h1: 2.0rem;
|
|
169
|
+
--fs-h2: 1.45rem;
|
|
170
|
+
--fs-h3: 1.15rem;
|
|
171
|
+
--leading: 1.5;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
@page {
|
|
175
|
+
size: 8.5in 11in;
|
|
176
|
+
margin: 0.9in 1in;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
body {
|
|
180
|
+
color: var(--color-ink);
|
|
181
|
+
background: var(--color-paper);
|
|
182
|
+
font-family: var(--font-body);
|
|
183
|
+
line-height: var(--leading);
|
|
184
|
+
font-size: var(--fs-body);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
h1, h2, h3 {
|
|
188
|
+
font-family: var(--font-display);
|
|
189
|
+
color: var(--color-ink);
|
|
190
|
+
font-weight: 600;
|
|
191
|
+
line-height: 1.25;
|
|
192
|
+
}
|
|
193
|
+
h1 { font-size: var(--fs-h1); margin: 0 0 0.5em; color: var(--color-accent); }
|
|
194
|
+
h2 { font-size: var(--fs-h2); margin: 1.4em 0 0.4em; border-bottom: 1px solid var(--color-rule); padding-bottom: 0.15em; }
|
|
195
|
+
h3 { font-size: var(--fs-h3); margin: 1.2em 0 0.3em; }
|
|
196
|
+
|
|
197
|
+
p { margin: 0 0 0.7em; }
|
|
198
|
+
|
|
199
|
+
a { color: var(--color-accent); text-decoration: none; }
|
|
200
|
+
|
|
201
|
+
code {
|
|
202
|
+
font-family: var(--font-mono); font-size: 0.88em;
|
|
203
|
+
background: var(--color-tint); padding: 0.1em 0.35em; border-radius: 3px;
|
|
204
|
+
}
|
|
205
|
+
pre {
|
|
206
|
+
font-family: var(--font-mono); font-size: 0.85em;
|
|
207
|
+
background: var(--color-tint); border: 1px solid var(--color-rule);
|
|
208
|
+
border-radius: 4px; padding: 0.7em 0.9em; overflow: auto;
|
|
209
|
+
}
|
|
210
|
+
pre code { background: none; padding: 0; }
|
|
211
|
+
|
|
212
|
+
table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: 0.95em; }
|
|
213
|
+
th, td { border: 1px solid var(--color-rule); padding: 0.4em 0.6em; text-align: left; }
|
|
214
|
+
th { background: var(--color-tint); font-weight: 600; }
|
|
215
|
+
|
|
216
|
+
blockquote {
|
|
217
|
+
margin: 1em 0; padding: 0.5em 0.9em;
|
|
218
|
+
background: var(--color-tint); border-left: 3px solid var(--color-accent);
|
|
219
|
+
color: var(--color-ink-muted);
|
|
220
|
+
}
|
|
221
|
+
`;
|
|
222
|
+
|
|
223
|
+
// src/assets/themes/academic/theme.css
|
|
224
|
+
var theme_default4 = `/* =============================================================================
|
|
225
|
+
Academic — gutterpress built-in theme (theme.css)
|
|
226
|
+
A journal-article look in the spirit of LaTeX's \`article\` class: a serif
|
|
227
|
+
text face, justified and hyphenated text, 1in margins, a centred page
|
|
228
|
+
number, and the parts of a paper styled by the @section they sit in.
|
|
229
|
+
Change the :root tokens from the book's own stylesheet. The page SIZE comes from the manifest
|
|
230
|
+
(\`page:\` — US Letter or A4), so it is deliberately not set here.
|
|
231
|
+
============================================================================= */
|
|
232
|
+
|
|
233
|
+
:root {
|
|
234
|
+
--color-ink: #111111; /* body text */
|
|
235
|
+
--color-ink-muted: #555555; /* captions, secondary text */
|
|
236
|
+
--color-accent: #111111; /* headings, links */
|
|
237
|
+
--color-paper: #ffffff; /* page background */
|
|
238
|
+
--color-rule: #111111; /* table rules */
|
|
239
|
+
|
|
240
|
+
--font-body: "Latin Modern Roman", "CMU Serif", "STIX Two Text", "Times New Roman", "Liberation Serif", serif;
|
|
241
|
+
--font-display: "Latin Modern Roman", "CMU Serif", "STIX Two Text", "Times New Roman", "Liberation Serif", serif;
|
|
242
|
+
--font-mono: "Latin Modern Mono", "Menlo", "Consolas", monospace;
|
|
243
|
+
|
|
244
|
+
--fs-body: 10.5pt;
|
|
245
|
+
--fs-h1: 1.65em;
|
|
246
|
+
--fs-h2: 1.2em;
|
|
247
|
+
--fs-h3: 1em;
|
|
248
|
+
--leading: 1.38;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
@page {
|
|
252
|
+
margin: 1in;
|
|
253
|
+
@bottom-center { content: counter(page); font-family: var(--font-body); font-size: 9pt; }
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
body {
|
|
257
|
+
color: var(--color-ink);
|
|
258
|
+
background: var(--color-paper);
|
|
259
|
+
font-family: var(--font-body);
|
|
260
|
+
line-height: var(--leading);
|
|
261
|
+
font-size: var(--fs-body);
|
|
262
|
+
text-align: justify;
|
|
263
|
+
hyphens: auto;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
h1, h2, h3 {
|
|
267
|
+
font-family: var(--font-display);
|
|
268
|
+
color: var(--color-accent);
|
|
269
|
+
line-height: 1.2;
|
|
270
|
+
font-weight: bold;
|
|
271
|
+
}
|
|
272
|
+
h1 { font-size: var(--fs-h1); margin: 0 0 0.7em; }
|
|
273
|
+
h2 { font-size: var(--fs-h2); margin: 1.4em 0 0.5em; }
|
|
274
|
+
h3 { font-size: var(--fs-h3); margin: 1.2em 0 0.4em; }
|
|
275
|
+
|
|
276
|
+
a { color: var(--color-accent); text-decoration: none; }
|
|
277
|
+
|
|
278
|
+
code, pre { font-family: var(--font-mono); }
|
|
279
|
+
pre { font-size: 0.8em; line-height: 1.3; }
|
|
280
|
+
|
|
281
|
+
/* @section .title — the title, authors, affiliations and date */
|
|
282
|
+
.title { text-align: center; hyphens: manual; margin-bottom: 2em; }
|
|
283
|
+
|
|
284
|
+
/* @section .abstract — the abstract, keywords and subject classes */
|
|
285
|
+
.abstract { font-size: 0.9em; margin: 0 2.5em 2em; }
|
|
286
|
+
|
|
287
|
+
/* @section .figure — a figure, table or listing kept on one page with its caption */
|
|
288
|
+
.figure { break-inside: avoid; margin: 1.4em 0; }
|
|
289
|
+
.caption { font-size: 0.9em; color: var(--color-ink-muted); }
|
|
290
|
+
|
|
291
|
+
/* Tables ruled above, below and under the header row, as journals set them */
|
|
292
|
+
table { border-collapse: collapse; margin: 0.6em auto; border-top: 1pt solid var(--color-rule); border-bottom: 1pt solid var(--color-rule); }
|
|
293
|
+
thead th { border-bottom: 0.5pt solid var(--color-rule); }
|
|
294
|
+
th, td { padding: 0.2em 0.8em; }
|
|
295
|
+
|
|
296
|
+
/* Notes (from [^1] footnotes) and @section .references, a size smaller than the text */
|
|
297
|
+
.footnotes, .references { font-size: 0.85em; }
|
|
298
|
+
.footnotes-sep { border: 0; border-top: 0.5pt solid var(--color-rule); width: 30%; margin: 1.5em 0 0.5em; }
|
|
299
|
+
.footnote-backref { display: none; }
|
|
300
|
+
`;
|
|
301
|
+
|
|
302
|
+
// src/lib/extension-specifier.ts
|
|
303
|
+
var BUNDLED_EXTENSIONS = [
|
|
304
|
+
{
|
|
305
|
+
name: "markdown-it-mark",
|
|
306
|
+
label: "Highlight",
|
|
307
|
+
description: "Highlight text by wrapping it in `==double equals==`."
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
name: "markdown-it-sub",
|
|
311
|
+
label: "Subscript",
|
|
312
|
+
description: "Lower text below the line, like the 2 in `H~2~O`."
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
name: "markdown-it-sup",
|
|
316
|
+
label: "Superscript",
|
|
317
|
+
description: "Raise text above the line, like the th in `29^th^`."
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
name: "markdown-it-abbr",
|
|
321
|
+
label: "Abbreviations",
|
|
322
|
+
description: "Explain an abbreviation when readers hover over it. Define it once, like `*[GPS]: Global Positioning System`."
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
name: "gutterpress-gfm-alerts",
|
|
326
|
+
label: "Callouts",
|
|
327
|
+
description: "Turn a quote into a boxed note: start it with `> [!NOTE]` (or `TIP`, `IMPORTANT`, `WARNING`, `CAUTION`)."
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
name: "gutterpress-math",
|
|
331
|
+
label: "Math",
|
|
332
|
+
description: "Write LaTeX math between dollar signs: `$E = mc^2$` in a line, or `$$` … `$$` on lines of their own."
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
name: "clean-book",
|
|
336
|
+
label: "Clean book",
|
|
337
|
+
description: "A calm, classic book look: serif body, generous margins, restrained accents.",
|
|
338
|
+
css: theme_default
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
name: "zine",
|
|
342
|
+
label: "Zine",
|
|
343
|
+
description: "High-contrast, punchy sans-serif look for short photocopier-friendly zines.",
|
|
344
|
+
css: theme_default2
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
name: "technical-doc",
|
|
348
|
+
label: "Technical doc",
|
|
349
|
+
description: "Clean sans-serif manual look with clear hierarchy, code styling, and tidy tables.",
|
|
350
|
+
css: theme_default3
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
name: "academic",
|
|
354
|
+
label: "Academic",
|
|
355
|
+
description: "A journal-article look: serif text, justified and hyphenated, ruled tables, notes and references set smaller.",
|
|
356
|
+
css: theme_default4
|
|
357
|
+
}
|
|
358
|
+
];
|
|
359
|
+
function bundledExtension(name) {
|
|
360
|
+
return BUNDLED_EXTENSIONS.find((e) => e.name === name);
|
|
361
|
+
}
|
|
362
|
+
function isBundledExtension(name) {
|
|
363
|
+
return bundledExtension(name) !== undefined;
|
|
364
|
+
}
|
|
365
|
+
function isPathSpecifier(use) {
|
|
366
|
+
return use.startsWith("./") || use.startsWith("../") || use.startsWith("/") || /^[a-zA-Z]:[\\/]/.test(use);
|
|
367
|
+
}
|
|
368
|
+
function parseExtensionSpecifier(use) {
|
|
369
|
+
const spec = use.trim();
|
|
370
|
+
if (!spec) {
|
|
371
|
+
throw new Error("An extension specifier is required — an npm package name, or a ./ path.");
|
|
372
|
+
}
|
|
373
|
+
if (isPathSpecifier(spec))
|
|
374
|
+
return { kind: "path", path: spec };
|
|
375
|
+
if (/\.(m?js|cjs)$/i.test(spec) || !spec.startsWith("@") && spec.includes("/")) {
|
|
376
|
+
throw new Error(`"${spec}" looks like a path; write it as "./${spec}". A specifier that does not ` + "start with ./, ../ or / is an npm package name.");
|
|
377
|
+
}
|
|
378
|
+
const parsed = parseNpmPluginSpec(spec);
|
|
379
|
+
if (isBundledExtension(parsed.name)) {
|
|
380
|
+
if (parsed.selector !== undefined) {
|
|
381
|
+
throw new Error(`"${parsed.name}" is bundled with Gutterpress and always resolves to the bundled copy — ` + `drop "@${parsed.selector}".`);
|
|
382
|
+
}
|
|
383
|
+
return { kind: "bundled", name: parsed.name };
|
|
384
|
+
}
|
|
385
|
+
return parsed.selector === undefined ? { kind: "npm", name: parsed.name } : { kind: "npm", name: parsed.name, version: parsed.selector };
|
|
386
|
+
}
|
|
387
|
+
function pinnedNpmSpecifier(name, version) {
|
|
388
|
+
return `${name}@${version}`;
|
|
389
|
+
}
|
|
390
|
+
|
|
22
391
|
// src/lib/style-declarations.ts
|
|
23
392
|
import { existsSync } from "node:fs";
|
|
24
393
|
import { resolve } from "node:path";
|
|
@@ -3182,7 +3551,7 @@ async function importVendoredEntry(installRoot, packageDir, spec) {
|
|
|
3182
3551
|
try {
|
|
3183
3552
|
entry = await resolvePackageEntry(packageDir);
|
|
3184
3553
|
} catch (cause) {
|
|
3185
|
-
throw new Error(`the downloaded copy of ${spec} under
|
|
3554
|
+
throw new Error(`the downloaded copy of ${spec} under extensions/npm/ is incomplete ` + `(${cause instanceof Error ? cause.message : String(cause)}). ` + `Reinstall it with \`gutterpress ext add ${spec}\`.`, { cause });
|
|
3186
3555
|
}
|
|
3187
3556
|
const entryPath = join(packageDir, ...entry.split("/"));
|
|
3188
3557
|
vendoredRootsOpened.add(installRoot);
|
|
@@ -3402,12 +3771,18 @@ async function loadPlugin(config, baseDir) {
|
|
|
3402
3771
|
if (!config.path && !config.name) {
|
|
3403
3772
|
throw new Error("Plugin manifest entry must specify either `path` or `name`. Got an empty plugin config.");
|
|
3404
3773
|
}
|
|
3405
|
-
if (!config.path && !config.version && config.name
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3774
|
+
if (!config.path && !config.version && config.name) {
|
|
3775
|
+
const bundled = bundledExtension(config.name);
|
|
3776
|
+
if (bundled?.css !== undefined) {
|
|
3777
|
+
return { name: config.name, plugin: noopPlugin, css: bundled.css, options: config.options };
|
|
3778
|
+
}
|
|
3779
|
+
if (BUILTIN_OPTIONAL_PLUGINS[config.name]) {
|
|
3780
|
+
return {
|
|
3781
|
+
name: config.name,
|
|
3782
|
+
plugin: BUILTIN_OPTIONAL_PLUGINS[config.name],
|
|
3783
|
+
options: config.options
|
|
3784
|
+
};
|
|
3785
|
+
}
|
|
3411
3786
|
}
|
|
3412
3787
|
if (config.path) {
|
|
3413
3788
|
const candidatePath = resolve2(baseDir, config.path);
|
|
@@ -3528,4 +3903,4 @@ async function loadPluginsWithCss(configs, baseDir, onError) {
|
|
|
3528
3903
|
};
|
|
3529
3904
|
}
|
|
3530
3905
|
|
|
3531
|
-
export { TWO_VERSIONS_OPEN, TWO_VERSIONS_CLOSE, MARKER_CSS, GUTTERPRESS_CSS, TWO_VERSIONS_CSS, TABLE_ALIGN_CSS, slugify, prettify, parseSrcsetUrlCandidates, collectHtmlImageRefs, createMarkdownRenderer, applyPlugins, collectPluginCss, collectPluginStylePaths, collectPluginStyleGroups, resolveDeclaredStyles, EXTENSION_MANIFEST_FILENAME, readExtensionMeta, extensionStyleList, extensionEntry, extensionCarries, assertExtensionContained, __resetPathPluginCacheForTests, loadPlugin, loadPublishFunction, loadPlugins, loadPluginsWithCss };
|
|
3906
|
+
export { bundledExtension, isPathSpecifier, parseExtensionSpecifier, pinnedNpmSpecifier, TWO_VERSIONS_OPEN, TWO_VERSIONS_CLOSE, MARKER_CSS, GUTTERPRESS_CSS, TWO_VERSIONS_CSS, TABLE_ALIGN_CSS, slugify, prettify, parseSrcsetUrlCandidates, collectHtmlImageRefs, createMarkdownRenderer, applyPlugins, collectPluginCss, collectPluginStylePaths, collectPluginStyleGroups, resolveDeclaredStyles, EXTENSION_MANIFEST_FILENAME, readExtensionMeta, extensionStyleList, extensionEntry, extensionCarries, assertExtensionContained, __resetPathPluginCacheForTests, loadPlugin, loadPublishFunction, loadPlugins, loadPluginsWithCss };
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
launchChromium
|
|
3
3
|
} from "./cli-eyyggect.js";
|
|
4
|
-
import {
|
|
5
|
-
getAssetPath
|
|
6
|
-
} from "./cli-fe43evmf.js";
|
|
7
4
|
|
|
8
5
|
// src/engine/compiler/build.ts
|
|
9
|
-
import { readFile } from "node:fs/promises";
|
|
10
|
-
import { resolve } from "node:path";
|
|
6
|
+
import { readFile as readFile2 } from "node:fs/promises";
|
|
7
|
+
import { resolve as resolve2 } from "node:path";
|
|
11
8
|
import { pathToFileURL } from "node:url";
|
|
12
9
|
|
|
13
10
|
// src/engine/shared/gcpm-extract.ts
|
|
@@ -1126,6 +1123,185 @@ async function inspectPdf(bytes) {
|
|
|
1126
1123
|
return { pageCount: pages.length, boxes, linkTargets, namedDests, outline };
|
|
1127
1124
|
}
|
|
1128
1125
|
|
|
1126
|
+
// src/lib/embedded-assets.ts
|
|
1127
|
+
import { existsSync } from "node:fs";
|
|
1128
|
+
import { mkdtemp, mkdir, writeFile, readFile } from "node:fs/promises";
|
|
1129
|
+
import { tmpdir } from "node:os";
|
|
1130
|
+
import { dirname, join, resolve } from "node:path";
|
|
1131
|
+
import { fileURLToPath } from "node:url";
|
|
1132
|
+
|
|
1133
|
+
// src/assets/favicon.ico
|
|
1134
|
+
var favicon_default = "./favicon-272ga6y0.ico";
|
|
1135
|
+
|
|
1136
|
+
// src/assets/manifest.schema.json
|
|
1137
|
+
var manifest_schema_default = "./manifest.schema-t7nx2stg.json";
|
|
1138
|
+
|
|
1139
|
+
// src/assets/preview/scripts/preview-interface.js
|
|
1140
|
+
var preview_interface_default = "./preview-interface-nnmrxyqm.js";
|
|
1141
|
+
|
|
1142
|
+
// src/assets/preview/scripts/preview-bridge.js
|
|
1143
|
+
var preview_bridge_default = "./preview-bridge-8wjcjec3.js";
|
|
1144
|
+
|
|
1145
|
+
// src/assets/preview/scripts/preview-shell.js
|
|
1146
|
+
var preview_shell_default = "./preview-shell-wk9k3gcd.js";
|
|
1147
|
+
|
|
1148
|
+
// profiles/CGATS21_CRPC1.icc
|
|
1149
|
+
var CGATS21_CRPC1_default = "./CGATS21_CRPC1-g0e3k7kr.icc";
|
|
1150
|
+
|
|
1151
|
+
// src/assets/engine/gutterpress-viewer.js
|
|
1152
|
+
var gutterpress_viewer_default = "./gutterpress-viewer-701vf4qp.js";
|
|
1153
|
+
|
|
1154
|
+
// src/assets/engine/gutterpress-agent.js
|
|
1155
|
+
var gutterpress_agent_default = "./gutterpress-agent-d29ry3ak.js";
|
|
1156
|
+
|
|
1157
|
+
// src/assets/templates/book/manifest.yaml
|
|
1158
|
+
var manifest_default = "./manifest-n1gh3qw5.yaml";
|
|
1159
|
+
|
|
1160
|
+
// src/assets/templates/book/chapter-01.md
|
|
1161
|
+
var chapter_01_default = "./chapter-01-gsbjt584.md";
|
|
1162
|
+
|
|
1163
|
+
// src/assets/templates/zine/manifest.yaml
|
|
1164
|
+
var manifest_default2 = "./manifest-n1gh3qw5.yaml";
|
|
1165
|
+
|
|
1166
|
+
// src/assets/templates/zine/chapter-01.md
|
|
1167
|
+
var chapter_01_default2 = "./chapter-01-wgjfz4w6.md";
|
|
1168
|
+
|
|
1169
|
+
// src/assets/templates/technical/manifest.yaml
|
|
1170
|
+
var manifest_default3 = "./manifest-n1gh3qw5.yaml";
|
|
1171
|
+
|
|
1172
|
+
// src/assets/templates/technical/chapter-01.md
|
|
1173
|
+
var chapter_01_default3 = "./chapter-01-6fn9pvd0.md";
|
|
1174
|
+
|
|
1175
|
+
// src/assets/templates/paper/manifest.yaml
|
|
1176
|
+
var manifest_default4 = "./manifest-eagfhba6.yaml";
|
|
1177
|
+
|
|
1178
|
+
// src/assets/templates/paper/chapter-01.md
|
|
1179
|
+
var chapter_01_default4 = "./chapter-01-s71xrf5q.md";
|
|
1180
|
+
|
|
1181
|
+
// src/assets/extension-templates/plugin/package.json
|
|
1182
|
+
var package_default = "./package-9rv69pxm.json";
|
|
1183
|
+
|
|
1184
|
+
// src/assets/extension-templates/plugin/README.md
|
|
1185
|
+
var README_default = "./README-vsnsc1b3.md";
|
|
1186
|
+
|
|
1187
|
+
// src/assets/extension-templates/plugin/plugin.js.tpl
|
|
1188
|
+
var plugin_js_default = "./plugin.js-cswq7wvd.tpl";
|
|
1189
|
+
|
|
1190
|
+
// src/assets/extension-templates/plugin/styles/plugin.css
|
|
1191
|
+
var plugin_default = "./plugin-spbcem4j.css";
|
|
1192
|
+
|
|
1193
|
+
// src/assets/extension-templates/plugin/snippets/term-box.md
|
|
1194
|
+
var term_box_default = "./term-box-4y0w7y32.md";
|
|
1195
|
+
|
|
1196
|
+
// src/assets/extension-templates/plugin/test/fixture.md
|
|
1197
|
+
var fixture_default = "./fixture-2qnyqgb5.md";
|
|
1198
|
+
|
|
1199
|
+
// src/assets/extension-templates/plugin/test/expected.html
|
|
1200
|
+
var expected_default = "./expected-ycmacem8.html";
|
|
1201
|
+
|
|
1202
|
+
// src/assets/extension-templates/plugin/test/plugin.test.js.tpl
|
|
1203
|
+
var plugin_test_js_default = "./plugin.test.js-xgxrd8hf.tpl";
|
|
1204
|
+
|
|
1205
|
+
// src/assets/extension-templates/look/package.json
|
|
1206
|
+
var package_default2 = "./package-aenwjew3.json";
|
|
1207
|
+
|
|
1208
|
+
// src/assets/extension-templates/look/README.md
|
|
1209
|
+
var README_default2 = "./README-8ef336pp.md";
|
|
1210
|
+
|
|
1211
|
+
// src/assets/extension-templates/look/components.yaml
|
|
1212
|
+
var components_default = "./components-zzqdpt3m.yaml";
|
|
1213
|
+
|
|
1214
|
+
// src/assets/extension-templates/look/snippets/callout.md
|
|
1215
|
+
var callout_default = "./callout-hv56m16h.md";
|
|
1216
|
+
|
|
1217
|
+
// src/assets/extension-templates/look/styles/tokens.css
|
|
1218
|
+
var tokens_default = "./tokens-7984461t.css";
|
|
1219
|
+
|
|
1220
|
+
// src/assets/extension-templates/look/styles/base.css
|
|
1221
|
+
var base_default = "./base-ypqh9n7f.css";
|
|
1222
|
+
|
|
1223
|
+
// src/assets/extension-templates/look/styles/components.css
|
|
1224
|
+
var components_default2 = "./components-aam0fe2z.css";
|
|
1225
|
+
|
|
1226
|
+
// src/assets/extension-templates/look/styles/page-templates.css
|
|
1227
|
+
var page_templates_default = "./page-templates-tx9ryt19.css";
|
|
1228
|
+
|
|
1229
|
+
// src/assets/extension-templates/look/styles/page-rules.css
|
|
1230
|
+
var page_rules_default = "./page-rules-nsj3aw42.css";
|
|
1231
|
+
|
|
1232
|
+
// src/assets/extension-templates/look/styles/book.css
|
|
1233
|
+
var book_default = "./book-ted3tzrp.css";
|
|
1234
|
+
|
|
1235
|
+
// src/lib/embedded-assets.ts
|
|
1236
|
+
var __libdir = dirname(fileURLToPath(import.meta.url));
|
|
1237
|
+
var abs = (p) => resolve(__libdir, p);
|
|
1238
|
+
var filePath = (v) => v;
|
|
1239
|
+
var EMBEDDED_ASSETS = {
|
|
1240
|
+
"favicon.ico": abs(favicon_default),
|
|
1241
|
+
"manifest.schema.json": abs(filePath(manifest_schema_default)),
|
|
1242
|
+
"preview/scripts/preview-interface.js": abs(filePath(preview_interface_default)),
|
|
1243
|
+
"preview/scripts/preview-bridge.js": abs(filePath(preview_bridge_default)),
|
|
1244
|
+
"preview/scripts/preview-shell.js": abs(filePath(preview_shell_default)),
|
|
1245
|
+
"profiles/CGATS21_CRPC1.icc": abs(filePath(CGATS21_CRPC1_default)),
|
|
1246
|
+
"engine/gutterpress-viewer.js": abs(filePath(gutterpress_viewer_default)),
|
|
1247
|
+
"engine/gutterpress-agent.js": abs(filePath(gutterpress_agent_default)),
|
|
1248
|
+
"templates/book/manifest.yaml": abs(filePath(manifest_default)),
|
|
1249
|
+
"templates/book/chapter-01.md": abs(filePath(chapter_01_default)),
|
|
1250
|
+
"templates/zine/manifest.yaml": abs(filePath(manifest_default2)),
|
|
1251
|
+
"templates/zine/chapter-01.md": abs(filePath(chapter_01_default2)),
|
|
1252
|
+
"templates/technical/manifest.yaml": abs(filePath(manifest_default3)),
|
|
1253
|
+
"templates/technical/chapter-01.md": abs(filePath(chapter_01_default3)),
|
|
1254
|
+
"templates/paper/manifest.yaml": abs(filePath(manifest_default4)),
|
|
1255
|
+
"templates/paper/chapter-01.md": abs(filePath(chapter_01_default4)),
|
|
1256
|
+
"extension-templates/plugin/package.json": abs(filePath(package_default)),
|
|
1257
|
+
"extension-templates/plugin/README.md": abs(filePath(README_default)),
|
|
1258
|
+
"extension-templates/plugin/plugin.js.tpl": abs(filePath(plugin_js_default)),
|
|
1259
|
+
"extension-templates/plugin/styles/plugin.css": abs(filePath(plugin_default)),
|
|
1260
|
+
"extension-templates/plugin/snippets/term-box.md": abs(filePath(term_box_default)),
|
|
1261
|
+
"extension-templates/plugin/test/fixture.md": abs(filePath(fixture_default)),
|
|
1262
|
+
"extension-templates/plugin/test/expected.html": abs(filePath(expected_default)),
|
|
1263
|
+
"extension-templates/plugin/test/plugin.test.js.tpl": abs(filePath(plugin_test_js_default)),
|
|
1264
|
+
"extension-templates/look/package.json": abs(filePath(package_default2)),
|
|
1265
|
+
"extension-templates/look/README.md": abs(filePath(README_default2)),
|
|
1266
|
+
"extension-templates/look/components.yaml": abs(filePath(components_default)),
|
|
1267
|
+
"extension-templates/look/snippets/callout.md": abs(filePath(callout_default)),
|
|
1268
|
+
"extension-templates/look/styles/tokens.css": abs(filePath(tokens_default)),
|
|
1269
|
+
"extension-templates/look/styles/base.css": abs(filePath(base_default)),
|
|
1270
|
+
"extension-templates/look/styles/components.css": abs(filePath(components_default2)),
|
|
1271
|
+
"extension-templates/look/styles/page-templates.css": abs(filePath(page_templates_default)),
|
|
1272
|
+
"extension-templates/look/styles/page-rules.css": abs(filePath(page_rules_default)),
|
|
1273
|
+
"extension-templates/look/styles/book.css": abs(filePath(book_default))
|
|
1274
|
+
};
|
|
1275
|
+
var extractPromise = null;
|
|
1276
|
+
async function extractAssets() {
|
|
1277
|
+
const root = await mkdtemp(join(tmpdir(), "gutterpress-assets-"));
|
|
1278
|
+
for (const [relPath, srcPath] of Object.entries(EMBEDDED_ASSETS)) {
|
|
1279
|
+
const dest = join(root, relPath);
|
|
1280
|
+
await mkdir(dirname(dest), { recursive: true });
|
|
1281
|
+
const bytes = await readFile(srcPath);
|
|
1282
|
+
await writeFile(dest, bytes);
|
|
1283
|
+
}
|
|
1284
|
+
return root;
|
|
1285
|
+
}
|
|
1286
|
+
var SENTINEL_ASSET = "engine/gutterpress-viewer.js";
|
|
1287
|
+
async function getAssetsDir() {
|
|
1288
|
+
if (extractPromise) {
|
|
1289
|
+
try {
|
|
1290
|
+
const root = await extractPromise;
|
|
1291
|
+
if (existsSync(join(root, SENTINEL_ASSET))) {
|
|
1292
|
+
return root;
|
|
1293
|
+
}
|
|
1294
|
+
} catch {}
|
|
1295
|
+
extractPromise = null;
|
|
1296
|
+
}
|
|
1297
|
+
extractPromise = extractAssets();
|
|
1298
|
+
return extractPromise;
|
|
1299
|
+
}
|
|
1300
|
+
async function getAssetPath(relPath) {
|
|
1301
|
+
const root = await getAssetsDir();
|
|
1302
|
+
return join(root, relPath);
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1129
1305
|
// src/engine/compiler/tier2.ts
|
|
1130
1306
|
var DEFAULT_SLUG_PT = 18;
|
|
1131
1307
|
function classify(model) {
|
|
@@ -1451,8 +1627,8 @@ function pagePseudoContexts(model) {
|
|
|
1451
1627
|
}
|
|
1452
1628
|
async function build(opts) {
|
|
1453
1629
|
const log = opts.onProgress ?? (() => {});
|
|
1454
|
-
const AGENT = await
|
|
1455
|
-
const VIEWER = await
|
|
1630
|
+
const AGENT = await readFile2(await getAssetPath("engine/gutterpress-agent.js"), "utf8");
|
|
1631
|
+
const VIEWER = await readFile2(await getAssetPath("engine/gutterpress-viewer.js"), "utf8");
|
|
1456
1632
|
const browser = opts.browser ?? await launchChromium();
|
|
1457
1633
|
const ownsBrowser = !opts.browser;
|
|
1458
1634
|
const page = await browser.newPage();
|
|
@@ -1461,7 +1637,7 @@ async function build(opts) {
|
|
|
1461
1637
|
const diagnose = (code, message, severity = "warning") => diagnostics.push({ code, severity, message });
|
|
1462
1638
|
let prints = 0;
|
|
1463
1639
|
try {
|
|
1464
|
-
const url = /^(https?|file):\/\//.test(opts.input) ? opts.input : pathToFileURL(
|
|
1640
|
+
const url = /^(https?|file):\/\//.test(opts.input) ? opts.input : pathToFileURL(resolve2(opts.input)).href;
|
|
1465
1641
|
await page.navigate(url);
|
|
1466
1642
|
await page.evaluate(AGENT);
|
|
1467
1643
|
await page.waitForReady();
|
|
@@ -2503,4 +2679,4 @@ ${lines.length ? lines.join(`
|
|
|
2503
2679
|
`);
|
|
2504
2680
|
}
|
|
2505
2681
|
|
|
2506
|
-
export { lastPageMode, extract, resolvePage, MARGIN_BOX_IGNORED_PROPERTIES, build };
|
|
2682
|
+
export { lastPageMode, extract, resolvePage, getAssetPath, MARGIN_BOX_IGNORED_PROPERTIES, build };
|