gutterpress 0.11.23-beta.2 → 0.11.23-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +12 -2
  2. package/dist/api/index.d.ts +5 -5
  3. package/dist/api/index.js +19 -7
  4. package/dist/{build-3e18wnqj.js → build-fq3mexhy.js} +9 -9
  5. package/dist/checks/asset/approved-fonts.d.ts +8 -0
  6. package/dist/checks/asset/extensions.d.ts +1 -1
  7. package/dist/checks/asset/index.d.ts +1 -0
  8. package/dist/{cli-88arpdke.js → cli-5zbdb6mt.js} +296 -65
  9. package/dist/{cli-tgnyvra3.js → cli-7mt0dftw.js} +35 -16
  10. package/dist/{cli-pnrararp.js → cli-ah93yyzb.js} +162 -55
  11. package/dist/{cli-v0evdpdf.js → cli-eymdsefg.js} +1 -1
  12. package/dist/{cli-9n9kg58f.js → cli-fh685nqs.js} +1 -1
  13. package/dist/{cli-pd2cje5b.js → cli-fsjre61x.js} +1 -1
  14. package/dist/{cli-x7gcdg6w.js → cli-q7t04gjt.js} +1 -1
  15. package/dist/{cli-0ep11b0q.js → cli-rybz2dfs.js} +1 -1
  16. package/dist/cli.js +12 -12
  17. package/dist/{doctor-2f4s9dyn.js → doctor-tg9ht1n3.js} +3 -3
  18. package/dist/{engine-c4pxz79g.js → engine-17v87vq5.js} +1 -1
  19. package/dist/{engine-cs5g2ez0.js → engine-y9fnarfa.js} +2 -2
  20. package/dist/{ext-70gv86v5.js → ext-esz03jz4.js} +27 -10
  21. package/dist/{extension-restore-chj5nx3t.js → extension-restore-91gy1e28.js} +3 -3
  22. package/dist/{extension-restore-pd87p8r2.js → extension-restore-q70wqah5.js} +5 -5
  23. package/dist/{index-80vg3ed6.js → index-67g8f7r4.js} +35 -16
  24. package/dist/{index-swfdgn2n.js → index-d9w3r89w.js} +1 -1
  25. package/dist/{index-ytjkvwy5.js → index-fntpr44x.js} +321 -66
  26. package/dist/{index-5x42amh8.js → index-g3te5ey1.js} +2 -1
  27. package/dist/{index-7j3hkwya.js → index-kw4tbthz.js} +1 -1
  28. package/dist/{index-2t1gdma7.js → index-santcs4q.js} +1 -1
  29. package/dist/{index-0k43evt0.js → index-z6vzj3s5.js} +186 -60
  30. package/dist/index.js +35 -8
  31. package/dist/lib/check-options.d.ts +70 -0
  32. package/dist/lib/extension-manager.d.ts +16 -1
  33. package/dist/lib/extension-scaffold.d.ts +15 -2
  34. package/dist/lib/extension-specifier.d.ts +8 -1
  35. package/dist/lib/manifest-config.d.ts +3 -1
  36. package/dist/lib/manifest-old-spellings.d.ts +32 -9
  37. package/dist/lib/markdown/math.d.ts +1 -1
  38. package/dist/lib/markdown/typography.d.ts +1 -0
  39. package/dist/lib/page-size.d.ts +12 -4
  40. package/dist/lib/plugin-vendor.d.ts +6 -0
  41. package/dist/lib/presets.d.ts +2 -2
  42. package/dist/lib/root-tokens.d.ts +2 -1
  43. package/dist/lib/style-resolver.d.ts +2 -1
  44. package/dist/lib/version-changes.d.ts +9 -3
  45. package/dist/{manifest.schema-0jgj0jt1.json → manifest.schema-5cm13vr3.json} +215 -5
  46. package/dist/{new-d61n5cn0.js → new-rmfyb7va.js} +22 -15
  47. package/dist/{plugins-0hhw6s17.js → plugins-gs21xz5s.js} +2 -2
  48. package/dist/{plugins-e0n46s6m.js → plugins-tqv1s16f.js} +4 -4
  49. package/dist/{preflight-fjayhjr5.js → preflight-bjyeeq0d.js} +9 -9
  50. package/dist/{preview-h815jrfb.js → preview-ke03fk5d.js} +9 -9
  51. package/dist/{publish-ft39zgma.js → publish-wpnz0qng.js} +9 -9
  52. package/dist/render.js +43 -11
  53. package/dist/schema/manifest.types.d.ts +45 -7
  54. package/dist/{source-provider-j1w7byeq.js → source-provider-3g3yrn1f.js} +2 -2
  55. package/dist/{source-provider-tjaf303m.js → source-provider-azg9ywhb.js} +2 -2
  56. package/dist/{validate-b201dbrb.js → validate-zcwykb43.js} +9 -9
  57. package/package.json +1 -1
  58. /package/dist/{cli-y28j019d.js → cli-1dha1nxk.js} +0 -0
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  build
3
- } from "./index-2t1gdma7.js";
4
- import"./index-swfdgn2n.js";
3
+ } from "./index-santcs4q.js";
4
+ import"./index-d9w3r89w.js";
5
5
  import {
6
6
  BuildError
7
7
  } from "./index-tayzfr9c.js";
@@ -2,28 +2,30 @@ import {
2
2
  importExtensionFromFile,
3
3
  importExtensionFromUrl,
4
4
  searchNpmExtensions
5
- } from "./cli-pnrararp.js";
6
- import"./cli-0ep11b0q.js";
5
+ } from "./cli-ah93yyzb.js";
6
+ import"./cli-rybz2dfs.js";
7
7
  import"./cli-ht1bcqdd.js";
8
- import"./cli-pd2cje5b.js";
8
+ import"./cli-fsjre61x.js";
9
9
  import"./cli-5crpmz42.js";
10
10
  import"./cli-eyyggect.js";
11
11
  import"./cli-asap4t1z.js";
12
- import"./cli-v0evdpdf.js";
12
+ import"./cli-eymdsefg.js";
13
13
  import"./cli-v5mp7a6q.js";
14
14
  import {
15
+ BUILT_IN_LOOKS,
16
+ addBuiltInStyleSet,
15
17
  addExtension,
16
18
  checkExtensionUpdates,
17
19
  listProjectExtensions,
18
20
  removeExtension,
19
21
  setExtensionEnabled,
20
22
  updateExtensions
21
- } from "./cli-88arpdke.js";
23
+ } from "./cli-5zbdb6mt.js";
22
24
  import {
23
25
  isPathSpecifier,
24
26
  parseExtensionSpecifier
25
- } from "./cli-tgnyvra3.js";
26
- import"./cli-9n9kg58f.js";
27
+ } from "./cli-7mt0dftw.js";
28
+ import"./cli-fh685nqs.js";
27
29
  import {
28
30
  UsageError,
29
31
  exitForUsage,
@@ -31,12 +33,12 @@ import {
31
33
  rejectUnknownFlags,
32
34
  resolveProjectDir
33
35
  } from "./cli-d8xjns66.js";
34
- import"./cli-x7gcdg6w.js";
36
+ import"./cli-q7t04gjt.js";
35
37
  import"./cli-65gy8ask.js";
36
38
  import {
37
39
  EXIT_CODES
38
40
  } from "./cli-46ycxe6r.js";
39
- import"./cli-y28j019d.js";
41
+ import"./cli-1dha1nxk.js";
40
42
  import"./cli-37x76zdn.js";
41
43
 
42
44
  // src/commands/ext.ts
@@ -65,6 +67,11 @@ var extAddArgs = {
65
67
  type: "string",
66
68
  description: "Named module export to use as the plugin function (npm and path extensions only)",
67
69
  required: false
70
+ },
71
+ look: {
72
+ type: "boolean",
73
+ description: "Treat SOURCE as a built-in look (clean-book, zine, technical-doc, academic): copy it into extensions/ as your own files and list the copy",
74
+ required: false
68
75
  }
69
76
  };
70
77
  var extRemoveArgs = { specifier: specifierArg, dir: dirArg };
@@ -202,7 +209,13 @@ var add = defineCommand({
202
209
  if (typeof args.export === "string" && !exportName) {
203
210
  throw new UsageError("gutterpress ext add: --export requires a non-empty name");
204
211
  }
205
- if (!isUrl && !existing) {
212
+ if (args.look && !BUILT_IN_LOOKS.includes(source)) {
213
+ throw new UsageError(`gutterpress ext add --look: unknown built-in look "${source}" (one of: ${BUILT_IN_LOOKS.join(", ")})`);
214
+ }
215
+ if (args.look && exportName) {
216
+ throw new UsageError("gutterpress ext add --look: a look takes no --export");
217
+ }
218
+ if (!args.look && !isUrl && !existing) {
206
219
  try {
207
220
  if (path.isAbsolute(source) || isPathSpecifier(source)) {
208
221
  throw new Error(`source not found: ${candidate}`);
@@ -216,6 +229,10 @@ var add = defineCommand({
216
229
  exitForUsage(error);
217
230
  }
218
231
  try {
232
+ if (args.look) {
233
+ printAdded(await addBuiltInStyleSet(projectDir, source), projectDir);
234
+ return;
235
+ }
219
236
  if (isUrl) {
220
237
  const { entry: entry2, warnings } = await importExtensionFromUrl(projectDir, source);
221
238
  printAdded(entry2, projectDir, warnings.map((w) => w.message));
@@ -3,10 +3,10 @@ import {
3
3
  restoreForCommand,
4
4
  restoreOfflineMessage,
5
5
  restorePinnedExtensions
6
- } from "./index-ytjkvwy5.js";
7
- import"./index-80vg3ed6.js";
6
+ } from "./index-fntpr44x.js";
7
+ import"./index-67g8f7r4.js";
8
8
  import"./index-tayzfr9c.js";
9
- import"./index-5x42amh8.js";
9
+ import"./index-g3te5ey1.js";
10
10
  import"./index-37x76zdn.js";
11
11
  export {
12
12
  restorePinnedExtensions,
@@ -3,14 +3,14 @@ import {
3
3
  restoreForCommand,
4
4
  restoreOfflineMessage,
5
5
  restorePinnedExtensions
6
- } from "./cli-88arpdke.js";
7
- import"./cli-tgnyvra3.js";
8
- import"./cli-9n9kg58f.js";
6
+ } from "./cli-5zbdb6mt.js";
7
+ import"./cli-7mt0dftw.js";
8
+ import"./cli-fh685nqs.js";
9
9
  import"./cli-d8xjns66.js";
10
- import"./cli-x7gcdg6w.js";
10
+ import"./cli-q7t04gjt.js";
11
11
  import"./cli-65gy8ask.js";
12
12
  import"./cli-46ycxe6r.js";
13
- import"./cli-y28j019d.js";
13
+ import"./cli-1dha1nxk.js";
14
14
  import"./cli-37x76zdn.js";
15
15
  export {
16
16
  restorePinnedExtensions,
@@ -7,7 +7,7 @@ import {
7
7
  resolveVendoredPluginInstallRoot,
8
8
  safePackageTarget,
9
9
  vendoredNpmPluginPackageDir
10
- } from "./index-5x42amh8.js";
10
+ } from "./index-g3te5ey1.js";
11
11
 
12
12
  // src/lib/markdown/plugins.ts
13
13
  import { existsSync as existsSync2, readFileSync, statSync, unlinkSync } from "node:fs";
@@ -288,7 +288,7 @@ th, td { padding: 0.2em 0.8em; }
288
288
  `;
289
289
 
290
290
  // src/lib/extension-specifier.ts
291
- var BUNDLED_EXTENSIONS = [
291
+ var BUNDLED_EXTENSION_DETAILS = [
292
292
  {
293
293
  name: "markdown-it-mark",
294
294
  label: "Highlight",
@@ -344,8 +344,9 @@ var BUNDLED_EXTENSIONS = [
344
344
  css: theme_default4
345
345
  }
346
346
  ];
347
+ var BUNDLED_EXTENSIONS = BUNDLED_EXTENSION_DETAILS.map((e) => e.name);
347
348
  function bundledExtension(name) {
348
- return BUNDLED_EXTENSIONS.find((e) => e.name === name);
349
+ return BUNDLED_EXTENSION_DETAILS.find((e) => e.name === name);
349
350
  }
350
351
  function isBundledExtension(name) {
351
352
  return bundledExtension(name) !== undefined;
@@ -398,7 +399,7 @@ import { satisfies, validRange } from "semver";
398
399
  // package.json
399
400
  var package_default = {
400
401
  name: "gutterpress",
401
- version: "0.11.23-beta.2",
402
+ version: "0.11.23-beta.3",
402
403
  description: "Markdown-to-PDF converter for professional print layout using a native Chromium print engine and Ghostscript.",
403
404
  author: "itlackey",
404
405
  license: "MPL-2.0",
@@ -2720,22 +2721,39 @@ th[data-align="right"], td[data-align="right"] { text-align: right; }
2720
2721
  `;
2721
2722
 
2722
2723
  // src/lib/markdown/typography.ts
2724
+ var SCOPED = /\((c|tm|r)\)/gi;
2725
+ var SYMBOLS = { c: "©", r: "®", tm: "™" };
2726
+ var LABEL_BEFORE = { c: "(b)", C: "(B)", r: "(q)", R: "(Q)" };
2727
+ var LABELS = /\((b|q)\)/gi;
2728
+ var RARE = /\+-|\.\.|\?\?\?\?|!!!!|,,|--/;
2723
2729
  var EM_DASH = /(^|[^-])---(?=[^-]|$)/gm;
2724
2730
  var EN_DASH_SPACED = /(^|\s)--(?=\s|$)/gm;
2725
2731
  var EN_DASH = /(^|[^-\s])--(?=[^-\s]|$)/gm;
2726
- var ELLIPSIS = /\.\.\./g;
2727
- var CANDIDATE = /--|\.\.\./;
2728
- function replaceInText(children) {
2732
+ var CANDIDATE = /\((?:c|tm|r|b|q)\)|\+-|\.\.|\?\?\?\?|!!!!|,,|--/i;
2733
+ function replaceRare(text) {
2734
+ return text.replace(/\+-/g, "±").replace(/\.{2,}/g, "…").replace(/([?!])…/g, "$1..").replace(/([?!]){4,}/g, "$1$1$1").replace(/,{2,}/g, ",").replace(EM_DASH, "$1—").replace(EN_DASH_SPACED, "$1–").replace(EN_DASH, "$1–");
2735
+ }
2736
+ function replaceInText(children, seen) {
2729
2737
  let insideAutolink = 0;
2730
- for (let i = children.length - 1;i >= 0; i--) {
2731
- const token = children[i];
2732
- if (token.type === "text" && !insideAutolink && CANDIDATE.test(token.content)) {
2733
- token.content = token.content.replace(ELLIPSIS, "…").replace(EM_DASH, "$1—").replace(EN_DASH_SPACED, "$1–").replace(EN_DASH, "$1–");
2734
- }
2735
- if (token.type === "link_close" && token.info === "auto")
2736
- insideAutolink++;
2738
+ for (const token of children) {
2737
2739
  if (token.type === "link_open" && token.info === "auto")
2740
+ insideAutolink++;
2741
+ if (token.type === "link_close" && token.info === "auto")
2738
2742
  insideAutolink--;
2743
+ if (token.type !== "text")
2744
+ continue;
2745
+ const typed = token.content;
2746
+ if (!insideAutolink) {
2747
+ let text = typed.replace(SCOPED, (match, name, offset) => {
2748
+ const label = LABEL_BEFORE[name];
2749
+ return label && (seen.has(label) || typed.slice(0, offset).includes(label)) ? match : SYMBOLS[name.toLowerCase()];
2750
+ });
2751
+ if (RARE.test(text))
2752
+ text = replaceRare(text);
2753
+ token.content = text;
2754
+ }
2755
+ for (const [label] of typed.matchAll(LABELS))
2756
+ seen.add(label);
2739
2757
  }
2740
2758
  }
2741
2759
  var QUOTES = {
@@ -2762,10 +2780,11 @@ function quotesFor(language) {
2762
2780
  function gpTypography(md) {
2763
2781
  md.disable("replacements");
2764
2782
  md.core.ruler.after("linkify", "gp_typography", (state) => {
2783
+ const seen = new Set;
2765
2784
  for (const token of state.tokens) {
2766
2785
  if (token.type !== "inline" || !token.children || !CANDIDATE.test(token.content))
2767
2786
  continue;
2768
- replaceInText(token.children);
2787
+ replaceInText(token.children, seen);
2769
2788
  }
2770
2789
  });
2771
2790
  }
@@ -4079,4 +4098,4 @@ async function loadPluginsWithCss(configs, baseDir, onError) {
4079
4098
  };
4080
4099
  }
4081
4100
 
4082
- export { BUNDLED_EXTENSIONS, bundledExtension, isBundledExtension, isPathSpecifier, parseExtensionSpecifier, pinnedNpmSpecifier, YOUR_VERSION_LABEL, ONLINE_VERSION_LABEL, TWO_VERSIONS_OPEN, TWO_VERSIONS_CLOSE, buildDeclaredMarkerRegistry, MARKER_CSS, GUTTERPRESS_CSS, TWO_VERSIONS_CSS, TABLE_ALIGN_CSS, slugify, prettify, setLogLevel, debug, info, warn, error, log, parseSrcsetUrlCandidates, collectHtmlImageRefs, createMarkdownRenderer, applyPlugins, collectPluginCss, collectPluginStylePaths, collectPluginStyleGroups, resolveDeclaredStyles, package_default, PACKAGE_META, PACKAGE_VERSION, EXTENSION_MANIFEST_FILENAME, readExtensionMeta, extensionStyleList, extensionEntry, extensionCarries, pathEscapesFolder, assertExtensionContained, resolveExtension, __resetPathPluginCacheForTests, loadPlugin, loadPublishFunction, loadPlugins, loadPluginsWithCss };
4101
+ export { BUNDLED_EXTENSION_DETAILS, BUNDLED_EXTENSIONS, bundledExtension, isBundledExtension, isPathSpecifier, parseExtensionSpecifier, pinnedNpmSpecifier, YOUR_VERSION_LABEL, ONLINE_VERSION_LABEL, TWO_VERSIONS_OPEN, TWO_VERSIONS_CLOSE, buildDeclaredMarkerRegistry, MARKER_CSS, GUTTERPRESS_CSS, TWO_VERSIONS_CSS, TABLE_ALIGN_CSS, slugify, prettify, setLogLevel, debug, info, warn, error, log, parseSrcsetUrlCandidates, collectHtmlImageRefs, createMarkdownRenderer, applyPlugins, collectPluginCss, collectPluginStylePaths, collectPluginStyleGroups, resolveDeclaredStyles, package_default, PACKAGE_META, PACKAGE_VERSION, EXTENSION_MANIFEST_FILENAME, readExtensionMeta, extensionStyleList, extensionEntry, extensionCarries, pathEscapesFolder, assertExtensionContained, resolveExtension, __resetPathPluginCacheForTests, loadPlugin, loadPublishFunction, loadPlugins, loadPluginsWithCss };
@@ -697,7 +697,7 @@ import { fileURLToPath } from "node:url";
697
697
  var favicon_default = "./favicon-272ga6y0.ico";
698
698
 
699
699
  // src/assets/manifest.schema.json
700
- var manifest_schema_default = "./manifest.schema-0jgj0jt1.json";
700
+ var manifest_schema_default = "./manifest.schema-5cm13vr3.json";
701
701
 
702
702
  // src/assets/preview/scripts/preview-interface.js
703
703
  var preview_interface_default = "./preview-interface-0xdh0r5b.js";