ssqch 0.12.0 → 0.13.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.
Files changed (130) hide show
  1. package/bundled/completions/bash +66 -8
  2. package/bundled/completions/elvish +23 -4
  3. package/bundled/completions/fish +36 -25
  4. package/bundled/completions/powershell +25 -4
  5. package/bundled/completions/zsh +44 -10
  6. package/bundled/docs/agents.md +2 -2
  7. package/bundled/docs/build-summary.md +1 -1
  8. package/bundled/docs/comparing-builds.md +2 -2
  9. package/bundled/docs/configuring.md +3 -6
  10. package/bundled/docs/deploying.md +1 -1
  11. package/bundled/docs/field-guide.md +4 -4
  12. package/bundled/docs/github-pages.md +1 -0
  13. package/bundled/docs/index.md +1 -1
  14. package/bundled/docs/install.md +1 -1
  15. package/bundled/docs/known-gaps.md +1 -1
  16. package/bundled/docs/markdown.md +8 -12
  17. package/bundled/docs/nav.yml +5 -1
  18. package/bundled/docs/netlify.md +4 -2
  19. package/bundled/docs/patrol.md +48 -0
  20. package/bundled/docs/plugins.md +6 -6
  21. package/bundled/docs/robots.md +85 -0
  22. package/bundled/docs/seo.md +2 -38
  23. package/bundled/docs/serving-markdown.md +142 -0
  24. package/bundled/docs/template-languages.md +1 -1
  25. package/bundled/docs/templates.md +1 -1
  26. package/bundled/docs/trailheads/from-hugo.md +5 -3
  27. package/bundled/docs/trailheads/from-jekyll.md +54 -13
  28. package/bundled/docs/trailheads/from-mkdocs.md +15 -12
  29. package/bundled/docs/trailheads/from-vitepress.md +13 -11
  30. package/bundled/docs/trailheads.md +3 -3
  31. package/bundled/docs/where-values-come-from.md +5 -5
  32. package/bundled/docs/writing-plugins.md +69 -0
  33. package/bundled/ssqch.d.ts +118 -44
  34. package/bundled/starter/engines/index.edge +1 -0
  35. package/bundled/starter/engines/index.ejs +1 -0
  36. package/bundled/starter/engines/index.hbs +1 -0
  37. package/bundled/starter/engines/index.liquid +1 -0
  38. package/bundled/starter/engines/layout.edge +7 -0
  39. package/bundled/starter/engines/layout.ejs +4 -0
  40. package/bundled/starter/engines/layout.hbs +4 -0
  41. package/bundled/starter/engines/layout.liquid +4 -0
  42. package/bundled/starter/src/_data/site.json +1 -0
  43. package/bundled/starter/src/_includes/layout.jinja +4 -0
  44. package/bundled/starter/src/index.jinja +1 -0
  45. package/bundled/starter/ssqch.config.js +14 -1
  46. package/bundled/starter-docs/engines/edge/base.edge +7 -0
  47. package/bundled/starter-docs/engines/edge/doc.edge +4 -0
  48. package/bundled/starter-docs/engines/ejs/base.ejs +4 -0
  49. package/bundled/starter-docs/engines/ejs/doc.ejs +4 -0
  50. package/bundled/starter-docs/engines/hbs/base.hbs +4 -0
  51. package/bundled/starter-docs/engines/hbs/doc.hbs +3 -0
  52. package/bundled/starter-docs/engines/liquid/base.liquid +4 -0
  53. package/bundled/starter-docs/engines/liquid/doc.liquid +4 -0
  54. package/bundled/starter-docs/src/_data/site.json +1 -0
  55. package/bundled/starter-docs/src/_includes/base.jinja +4 -0
  56. package/bundled/starter-docs/src/_includes/doc.jinja +4 -0
  57. package/bundled/starter-docs/src/assets/docs.css +4 -0
  58. package/bundled/starter-docs/src/assets/docs.js +17 -0
  59. package/bundled/starter-docs/ssqch.config.js +14 -1
  60. package/lib/assets.js +9 -9
  61. package/lib/chunk-25WERNDD.js +112 -0
  62. package/lib/{chunk-4ZMNLWE4.js → chunk-2BJFGKOE.js} +2 -2
  63. package/lib/{chunk-M2BBE2C3.js → chunk-3ZTRIO6O.js} +18 -17
  64. package/lib/{chunk-57HLSKZS.js → chunk-4AZFCSGJ.js} +2 -2
  65. package/lib/{chunk-ULQHJ4TS.js → chunk-55WXDGO4.js} +3 -3
  66. package/lib/{chunk-JX43SJHU.js → chunk-6FY77I4M.js} +24 -22
  67. package/lib/{chunk-RY3KLUQ3.js → chunk-6OUCRDYI.js} +267 -202
  68. package/lib/{chunk-EVFNYUTR.js → chunk-6U5VIQVY.js} +5 -5
  69. package/lib/{chunk-N3IZ44XY.js → chunk-7U5GWTEH.js} +88 -54
  70. package/lib/{chunk-VTYQ3JKL.js → chunk-AIJNG6MJ.js} +2 -2
  71. package/lib/{chunk-IIBZPHAW.js → chunk-C2Q7JKFI.js} +8 -8
  72. package/lib/{chunk-6CSH757V.js → chunk-DFJFHULZ.js} +33 -8
  73. package/lib/{chunk-XVV7JJK7.js → chunk-ENWDM2RW.js} +40 -39
  74. package/lib/{chunk-JUALMFW3.js → chunk-ER72RPD6.js} +1 -1
  75. package/lib/{chunk-RFREB3SI.js → chunk-F3JPNFCZ.js} +7 -7
  76. package/lib/{chunk-LLOA3QXV.js → chunk-FENJHLNM.js} +3 -2
  77. package/lib/{chunk-UU43WIZG.js → chunk-FJML7INB.js} +4 -2
  78. package/lib/{chunk-IZCF4UH3.js → chunk-FQZDUDFK.js} +1 -1
  79. package/lib/chunk-GM5SHCTU.js +272 -0
  80. package/lib/{chunk-GVHQ37JE.js → chunk-GSNRAGKQ.js} +10 -5
  81. package/lib/{chunk-L2IY4P6O.js → chunk-GU7BBYWB.js} +3 -3
  82. package/lib/{chunk-RGYJQYW3.js → chunk-HDKU6LRI.js} +32 -5
  83. package/lib/{chunk-IQUGLVZY.js → chunk-K5WZ2VYK.js} +4 -4
  84. package/lib/{chunk-JVT5ZRRH.js → chunk-OOKBXQAY.js} +5 -5
  85. package/lib/{chunk-MOLTDO5A.js → chunk-SNQOHNXE.js} +1 -1
  86. package/lib/{chunk-Z3XH4KWX.js → chunk-SPIFZBIW.js} +1 -1
  87. package/lib/{chunk-FNNXRVSU.js → chunk-T5IUI7W7.js} +10 -10
  88. package/lib/{chunk-5HEZ3WUQ.js → chunk-TGSVSG2G.js} +2 -2
  89. package/lib/{chunk-3GROJ3TY.js → chunk-U2KEMVXO.js} +24 -17
  90. package/lib/{chunk-4B3N44SN.js → chunk-UHRBPZ4A.js} +3 -3
  91. package/lib/{chunk-GWWA5Y3X.js → chunk-ULCT3PAV.js} +1 -1
  92. package/lib/{chunk-7RGEWDLF.js → chunk-UZNUS7RP.js} +10 -8
  93. package/lib/{chunk-DZ5F5XSI.js → chunk-V3G2QGL3.js} +10 -105
  94. package/lib/{chunk-DOHOKUGB.js → chunk-VILOEVK7.js} +50 -26
  95. package/lib/{chunk-DXMDXHV7.js → chunk-WGAIE3DD.js} +15 -14
  96. package/lib/{chunk-G3RFQDKO.js → chunk-WUCRAV36.js} +8 -6
  97. package/lib/{chunk-52ROOMBZ.js → chunk-XYAWJTHM.js} +9 -9
  98. package/lib/{chunk-L3K7MMFC.js → chunk-YA23NDMW.js} +2 -2
  99. package/lib/{chunk-R7PBREXL.js → chunk-YNJNMQWU.js} +8 -5
  100. package/lib/{chunk-AK7ZKSZP.js → chunk-ZMG25MXF.js} +17 -16
  101. package/lib/cli.js +56 -34
  102. package/lib/elements.js +9 -9
  103. package/lib/from-hugo.js +36 -0
  104. package/lib/from-jekyll.js +41 -0
  105. package/lib/from-mkdocs.js +49 -0
  106. package/lib/from-vitepress.js +49 -0
  107. package/lib/image.js +10 -10
  108. package/lib/links.js +9 -9
  109. package/lib/llms.js +619 -54
  110. package/lib/minify.js +10 -10
  111. package/lib/redirects.js +9 -9
  112. package/lib/robots.js +87 -0
  113. package/lib/rss.js +22 -12
  114. package/lib/sass.js +10 -10
  115. package/lib/sitemap.js +22 -33
  116. package/lib/ssqch.js +5 -5
  117. package/lib/vue.js +14 -13
  118. package/package.json +21 -1
  119. package/types/from-hugo.d.ts +5 -0
  120. package/types/from-jekyll.d.ts +11 -0
  121. package/types/from-mkdocs.d.ts +11 -0
  122. package/types/from-vitepress.d.ts +5 -0
  123. package/types/index.d.ts +45 -29
  124. package/types/llms.d.ts +18 -8
  125. package/types/robots.d.ts +13 -0
  126. package/types/sass.d.ts +1 -1
  127. package/types/sitemap.d.ts +3 -5
  128. package/wasm/markdown.wasm +0 -0
  129. /package/lib/{chunk-JX43SJHU.js.LEGAL.txt → chunk-6FY77I4M.js.LEGAL.txt} +0 -0
  130. /package/lib/{chunk-R7PBREXL.js.LEGAL.txt → chunk-YNJNMQWU.js.LEGAL.txt} +0 -0
@@ -5,21 +5,21 @@ import {
5
5
  } from "./chunk-3NYSSA2C.js";
6
6
  import {
7
7
  Options
8
- } from "./chunk-MOLTDO5A.js";
8
+ } from "./chunk-SNQOHNXE.js";
9
9
  import {
10
10
  BUILTINS,
11
11
  cssWithBase,
12
12
  debugString,
13
13
  wasi
14
- } from "./chunk-DOHOKUGB.js";
14
+ } from "./chunk-VILOEVK7.js";
15
15
  import {
16
16
  WebAssembly
17
- } from "./chunk-RY3KLUQ3.js";
17
+ } from "./chunk-6OUCRDYI.js";
18
18
  import {
19
19
  BuildError,
20
20
  bail,
21
21
  messageOf
22
- } from "./chunk-R7PBREXL.js";
22
+ } from "./chunk-YNJNMQWU.js";
23
23
  import {
24
24
  comparePaths,
25
25
  displayPath,
@@ -8,14 +8,14 @@ import {
8
8
  measure,
9
9
  overBudget,
10
10
  urlOf
11
- } from "./chunk-4B3N44SN.js";
12
- import "./chunk-GWWA5Y3X.js";
13
- import "./chunk-EVFNYUTR.js";
11
+ } from "./chunk-UHRBPZ4A.js";
12
+ import "./chunk-ULCT3PAV.js";
13
+ import "./chunk-6U5VIQVY.js";
14
14
  import "./chunk-DDV6JEC2.js";
15
15
  import "./chunk-FVZ5JBRI.js";
16
- import "./chunk-UU43WIZG.js";
16
+ import "./chunk-FJML7INB.js";
17
17
  import "./chunk-CMUWRPSQ.js";
18
- import "./chunk-R7PBREXL.js";
18
+ import "./chunk-YNJNMQWU.js";
19
19
  import "./chunk-VJWQSYEG.js";
20
20
  import "./chunk-I3PS26CI.js";
21
21
  export {
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-FVZ5JBRI.js";
6
6
  import {
7
7
  bail
8
- } from "./chunk-R7PBREXL.js";
8
+ } from "./chunk-YNJNMQWU.js";
9
9
 
10
10
  // src/modules/options.ts
11
11
  var Options = class {
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-CMUWRPSQ.js";
6
6
  import {
7
7
  bail
8
- } from "./chunk-R7PBREXL.js";
8
+ } from "./chunk-YNJNMQWU.js";
9
9
 
10
10
  // src/glob.ts
11
11
  var stripDot = (p) => p.replace(/^(\.\/)+/, "");
@@ -5,21 +5,21 @@ import {
5
5
  capabilities,
6
6
  modules,
7
7
  runCapabilities
8
- } from "./chunk-GVHQ37JE.js";
9
- import "./chunk-LLOA3QXV.js";
10
- import "./chunk-DOHOKUGB.js";
11
- import "./chunk-GWWA5Y3X.js";
12
- import "./chunk-EVFNYUTR.js";
8
+ } from "./chunk-GSNRAGKQ.js";
9
+ import "./chunk-FENJHLNM.js";
10
+ import "./chunk-VILOEVK7.js";
11
+ import "./chunk-ULCT3PAV.js";
12
+ import "./chunk-6U5VIQVY.js";
13
13
  import "./chunk-AD3HAW3W.js";
14
14
  import "./chunk-YCOTX2VM.js";
15
15
  import "./chunk-DDV6JEC2.js";
16
- import "./chunk-RY3KLUQ3.js";
16
+ import "./chunk-6OUCRDYI.js";
17
+ import "./chunk-SPIFZBIW.js";
17
18
  import "./chunk-FVZ5JBRI.js";
18
- import "./chunk-Z3XH4KWX.js";
19
- import "./chunk-UU43WIZG.js";
20
- import "./chunk-57HLSKZS.js";
19
+ import "./chunk-FJML7INB.js";
20
+ import "./chunk-4AZFCSGJ.js";
21
21
  import "./chunk-CMUWRPSQ.js";
22
- import "./chunk-R7PBREXL.js";
22
+ import "./chunk-YNJNMQWU.js";
23
23
  import "./chunk-VJWQSYEG.js";
24
24
  import "./chunk-I3PS26CI.js";
25
25
  export {
@@ -6,9 +6,9 @@ import {
6
6
  globSet,
7
7
  globToRegExp,
8
8
  isGlob
9
- } from "./chunk-Z3XH4KWX.js";
9
+ } from "./chunk-SPIFZBIW.js";
10
10
  import "./chunk-CMUWRPSQ.js";
11
- import "./chunk-R7PBREXL.js";
11
+ import "./chunk-YNJNMQWU.js";
12
12
  import "./chunk-VJWQSYEG.js";
13
13
  import "./chunk-I3PS26CI.js";
14
14
  export {
@@ -1,22 +1,23 @@
1
1
  import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
- import {
4
- BUILTIN_FILTERS
5
- } from "./chunk-DZ5F5XSI.js";
6
3
  import {
7
4
  modules
8
- } from "./chunk-GVHQ37JE.js";
5
+ } from "./chunk-GSNRAGKQ.js";
6
+ import {
7
+ BUILTIN_FILTERS
8
+ } from "./chunk-V3G2QGL3.js";
9
+ import "./chunk-25WERNDD.js";
9
10
  import {
10
11
  longHelp
11
12
  } from "./chunk-RIAOXEXC.js";
12
13
  import {
13
14
  agentsMd
14
- } from "./chunk-LLOA3QXV.js";
15
+ } from "./chunk-FENJHLNM.js";
15
16
  import {
16
17
  configOptions
17
- } from "./chunk-DOHOKUGB.js";
18
- import "./chunk-GWWA5Y3X.js";
19
- import "./chunk-EVFNYUTR.js";
18
+ } from "./chunk-VILOEVK7.js";
19
+ import "./chunk-ULCT3PAV.js";
20
+ import "./chunk-6U5VIQVY.js";
20
21
  import {
21
22
  VERSION
22
23
  } from "./chunk-AD3HAW3W.js";
@@ -26,13 +27,13 @@ import {
26
27
  types
27
28
  } from "./chunk-YCOTX2VM.js";
28
29
  import "./chunk-DDV6JEC2.js";
29
- import "./chunk-RY3KLUQ3.js";
30
+ import "./chunk-6OUCRDYI.js";
31
+ import "./chunk-SPIFZBIW.js";
30
32
  import {
31
33
  closest
32
34
  } from "./chunk-FVZ5JBRI.js";
33
- import "./chunk-Z3XH4KWX.js";
34
- import "./chunk-UU43WIZG.js";
35
- import "./chunk-57HLSKZS.js";
35
+ import "./chunk-FJML7INB.js";
36
+ import "./chunk-4AZFCSGJ.js";
36
37
  import "./chunk-CMUWRPSQ.js";
37
38
  import {
38
39
  OTHER_CONFIGS,
@@ -40,7 +41,7 @@ import {
40
41
  jsYaml,
41
42
  red,
42
43
  toJson
43
- } from "./chunk-R7PBREXL.js";
44
+ } from "./chunk-YNJNMQWU.js";
44
45
  import "./chunk-VJWQSYEG.js";
45
46
  import "./chunk-I3PS26CI.js";
46
47
 
@@ -294,11 +295,15 @@ function also(all, name, not) {
294
295
  found.sort((a, b) => b[1] - a[1] || a[0] - b[0]);
295
296
  return found.map(([i]) => i).slice(0, 4);
296
297
  }
298
+ function plainTitle(title) {
299
+ const at = /[:?] /.exec(title);
300
+ return at ? title.slice(at.index + 2) : title;
301
+ }
297
302
  function heading(all, query) {
298
303
  const q = words(query);
299
304
  if (q.length === 0) return void 0;
300
305
  const anchor = query.replace(/^#+/, "");
301
- const exact = all.findIndex((s) => words(s.title).join(" ") === q.join(" ") || slug(s.title) === anchor);
306
+ const exact = all.findIndex((s) => words(s.title).join(" ") === q.join(" ") || words(plainTitle(s.title)).join(" ") === q.join(" ") || slug(s.title) === anchor);
302
307
  if (exact !== -1) return exact;
303
308
  let best;
304
309
  all.forEach((s, i) => {
@@ -411,7 +416,7 @@ function answerText(all, a) {
411
416
  `;
412
417
  if (described.length) out += "\n";
413
418
  if (a.section !== void 0 && a.passages.length) {
414
- out += `From "${all[a.section].title}" (ssqch docs "${all[a.section].title}"):
419
+ out += `From "${all[a.section].title}" (ssqch docs "${plainTitle(all[a.section].title)}"):
415
420
 
416
421
  ${a.passages.join("\n\n")}
417
422
  `;
@@ -636,9 +641,10 @@ ${body.trim()}
636
641
  return out(json ? JSON.stringify({ query, found: true, page: { file: `site/src/docs/${page.file}`, url: guideUrl(page.file.replace(/^trailheads\//, "")), text } }, null, 2) + "\n" : text);
637
642
  }
638
643
  }
639
- const a = page?.title !== void 0 ? { query, names: [], passages: [], also: [], section: all.findIndex((s) => s.level <= 2 && s.title === page.title) } : answer(grammar, all, known, query);
644
+ const trail = page === void 0 ? trailheadSection(query) : void 0;
645
+ const exact = trail !== void 0 && !known.some((n) => n.name === query) && !all.some((s) => s.title.toLowerCase() === query.trim().toLowerCase() || plainTitle(s.title).toLowerCase() === query.trim().toLowerCase());
646
+ const a = page?.title !== void 0 ? { query, names: [], passages: [], also: [], section: all.findIndex((s) => s.level <= 2 && s.title === page.title) } : exact ? void 0 : answer(grammar, all, known, query);
640
647
  if (a && a.section !== -1) return out(json ? JSON.stringify(answerJson(all, a), null, 2) + "\n" : answerText(all, a));
641
- const trail = trailheadSection(query);
642
648
  if (trail) return out(json ? JSON.stringify({ query, found: true, trailhead: trail }, null, 2) + "\n" : `From "${trail.page}" (ssqch docs --from ${trail.generator}):
643
649
 
644
650
  ${trail.text}`);
@@ -658,6 +664,7 @@ export {
658
664
  docsPage,
659
665
  docsText,
660
666
  names,
667
+ plainTitle,
661
668
  runDocs,
662
669
  sections,
663
670
  slug,
@@ -2,12 +2,12 @@ import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  BUDGETS
5
- } from "./chunk-GWWA5Y3X.js";
5
+ } from "./chunk-ULCT3PAV.js";
6
6
  import {
7
7
  bytes,
8
8
  count,
9
9
  fixed
10
- } from "./chunk-EVFNYUTR.js";
10
+ } from "./chunk-6U5VIQVY.js";
11
11
  import {
12
12
  padEnd,
13
13
  padStart
@@ -16,7 +16,7 @@ import {
16
16
  BuildError,
17
17
  bail,
18
18
  warning
19
- } from "./chunk-R7PBREXL.js";
19
+ } from "./chunk-YNJNMQWU.js";
20
20
  import {
21
21
  compareText,
22
22
  realPath
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-CMUWRPSQ.js";
9
9
  import {
10
10
  bail
11
- } from "./chunk-R7PBREXL.js";
11
+ } from "./chunk-YNJNMQWU.js";
12
12
 
13
13
  // src/budgets.ts
14
14
  var BUDGETS = [
@@ -4,14 +4,15 @@ import {
4
4
  BUILTINS,
5
5
  DEFAULTS,
6
6
  EngineCache,
7
+ addMkdocsTheme,
7
8
  configOptions,
8
9
  findConfig,
9
10
  loadConfig,
10
11
  meant,
11
12
  tomlKeyLine
12
- } from "./chunk-DOHOKUGB.js";
13
- import "./chunk-GWWA5Y3X.js";
14
- import "./chunk-EVFNYUTR.js";
13
+ } from "./chunk-VILOEVK7.js";
14
+ import "./chunk-ULCT3PAV.js";
15
+ import "./chunk-6U5VIQVY.js";
15
16
  import "./chunk-AD3HAW3W.js";
16
17
  import "./chunk-YCOTX2VM.js";
17
18
  import {
@@ -21,13 +22,13 @@ import {
21
22
  shownDir,
22
23
  shownOutput
23
24
  } from "./chunk-DDV6JEC2.js";
24
- import "./chunk-RY3KLUQ3.js";
25
+ import "./chunk-6OUCRDYI.js";
26
+ import "./chunk-SPIFZBIW.js";
25
27
  import "./chunk-FVZ5JBRI.js";
26
- import "./chunk-Z3XH4KWX.js";
27
- import "./chunk-UU43WIZG.js";
28
- import "./chunk-57HLSKZS.js";
28
+ import "./chunk-FJML7INB.js";
29
+ import "./chunk-4AZFCSGJ.js";
29
30
  import "./chunk-CMUWRPSQ.js";
30
- import "./chunk-R7PBREXL.js";
31
+ import "./chunk-YNJNMQWU.js";
31
32
  import "./chunk-VJWQSYEG.js";
32
33
  import "./chunk-I3PS26CI.js";
33
34
  export {
@@ -35,6 +36,7 @@ export {
35
36
  CONFIG_FILES,
36
37
  DEFAULTS,
37
38
  EngineCache,
39
+ addMkdocsTheme,
38
40
  configOptions,
39
41
  dirsOf,
40
42
  findConfig,
@@ -1,121 +1,28 @@
1
1
  import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
+ import {
4
+ escapeText,
5
+ headings,
6
+ htmlText,
7
+ splitWhitespace,
8
+ toc
9
+ } from "./chunk-25WERNDD.js";
3
10
  import {
4
11
  withBase
5
- } from "./chunk-DOHOKUGB.js";
12
+ } from "./chunk-VILOEVK7.js";
6
13
  import {
7
14
  slugOptions,
8
15
  slugText,
9
16
  slugWith
10
- } from "./chunk-RY3KLUQ3.js";
17
+ } from "./chunk-6OUCRDYI.js";
11
18
  import {
12
19
  BuildError,
13
20
  isPlainObject
14
- } from "./chunk-R7PBREXL.js";
21
+ } from "./chunk-YNJNMQWU.js";
15
22
  import {
16
23
  compareText
17
24
  } from "./chunk-VJWQSYEG.js";
18
25
 
19
- // src/content.ts
20
- var HEADING = /<h([1-6])(\s[^>]*)?>(.*?)<\/h[1-6]\s*>/gis;
21
- var ID_ATTR = /(?:^|\s)id\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+))/i;
22
- var TAG = /<(\/?)([A-Za-z][A-Za-z0-9-]*)([^>]*)>|<!--.*?-->/gs;
23
- var HIDDEN = /\saria-hidden\s*=\s*["']?true|\sclass\s*=\s*["'][^"']*\bheader-anchor\b/i;
24
- var CODE = /<!--.*?-->|<(pre|script|style|template|textarea)\b.*?<\/(?:pre|script|style|template|textarea)\s*>/gis;
25
- var CODE_WITH_HEADING = /<code\b(?:(?!<\/code\s*>).)*?<h[1-6][\s>](?:(?!<\/code\s*>).)*<\/code\s*>/gis;
26
- var VOID = /* @__PURE__ */ new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]);
27
- function headings(html) {
28
- if (!html.includes("<h") && !html.includes("<H")) return [];
29
- const out = [];
30
- for (const found of html.replace(CODE, "").replace(CODE_WITH_HEADING, "").matchAll(HEADING)) {
31
- const id = ID_ATTR.exec(found[2] ?? "");
32
- const value = id ? id[1] ?? id[2] ?? id[3] : void 0;
33
- out.push({ level: Number(found[1]), id: value === void 0 ? void 0 : decodeEntities(value), text: htmlText(found[3]) });
34
- }
35
- return out;
36
- }
37
- function htmlText(html) {
38
- let text = "";
39
- let hidden = 0;
40
- let last = 0;
41
- for (const found of html.matchAll(TAG)) {
42
- if (hidden === 0) text += html.slice(last, found.index);
43
- last = found.index + found[0].length;
44
- if (found[2] === void 0) continue;
45
- const name = found[2].toLowerCase();
46
- const attrs = found[3] ?? "";
47
- if (VOID.has(name) || attrs.endsWith("/")) {
48
- if (name === "br" && hidden === 0) text += " ";
49
- continue;
50
- }
51
- if (found[1] === "/") hidden = Math.max(0, hidden - 1);
52
- else if (hidden > 0 || HIDDEN.test(attrs)) hidden++;
53
- }
54
- if (hidden === 0) text += html.slice(last);
55
- return splitWhitespace(decodeEntities(text)).join(" ");
56
- }
57
- function splitWhitespace(text) {
58
- return text.split(/[\t-\r \u0085\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000]+/).filter((word) => word !== "");
59
- }
60
- var ENTITY = /&(#[0-9]{1,7}|#[xX][0-9A-Fa-f]{1,6}|[A-Za-z]+);/g;
61
- var NAMED = { amp: "&", lt: "<", gt: ">", quot: '"', apos: "'", nbsp: "\xA0" };
62
- function decodeEntities(s) {
63
- if (!s.includes("&")) return s;
64
- return s.replace(ENTITY, (whole, name) => {
65
- if (Object.hasOwn(NAMED, name)) return NAMED[name];
66
- if (name[0] !== "#") return whole;
67
- const code = name[1] === "x" || name[1] === "X" ? Number.parseInt(name.slice(2), 16) : Number.parseInt(name.slice(1), 10);
68
- return code <= 1114111 && !(code >= 55296 && code <= 57343) ? String.fromCodePoint(code) : whole;
69
- });
70
- }
71
- function escapeText(s) {
72
- return s.replace(/[&<>"]/g, (c) => c === "&" ? "&amp;" : c === "<" ? "&lt;" : c === ">" ? "&gt;" : "&quot;");
73
- }
74
- function escapeHtml(s) {
75
- return s.replace(/[&<>"']/g, (c) => c === "&" ? "&amp;" : c === "<" ? "&lt;" : c === ">" ? "&gt;" : c === '"' ? "&quot;" : "&#39;");
76
- }
77
- function excerpt(html) {
78
- const more = /<!--\s*more\s*-->/.exec(html);
79
- if (more) return html.slice(0, more.index).trim();
80
- return /<p(?:\s[^>]*)?>.*?<\/p>/is.exec(html)?.[0];
81
- }
82
- function toc(list, from, to, ordered, markup = {}) {
83
- const tag = ordered ? "ol" : "ul";
84
- const attr = (name, value) => value ? ` ${name}="${escapeHtml(value)}"` : "";
85
- const open = (outer) => `<${tag}${outer ? attr("id", markup.id) + attr("class", markup.class) : attr("class", markup.sublistClass)}>`;
86
- const link = attr("class", markup.linkClass);
87
- const items = [];
88
- for (const v of list) {
89
- const h = v;
90
- if (typeof h?.level !== "number") continue;
91
- const level = Math.trunc(h.level);
92
- const id = typeof h.id === "string" && h.id !== "" ? h.id : void 0;
93
- if (id !== void 0 && level >= from && level <= to) items.push({ level, id, text: String(h.text) });
94
- }
95
- let out = "";
96
- const stack = [];
97
- for (const h of items) {
98
- if (!stack.length) {
99
- out += open(true);
100
- stack.push(h.level);
101
- } else {
102
- while (stack.length > 1 && h.level < stack[stack.length - 1]) {
103
- out += `</li></${tag}>`;
104
- stack.pop();
105
- }
106
- if (h.level > stack[stack.length - 1]) {
107
- out += open(false);
108
- stack.push(h.level);
109
- } else {
110
- out += "</li>";
111
- }
112
- }
113
- out += `<li${attr("class", markup.itemClass?.replaceAll("{level}", String(h.level)))}><a href="#${escapeHtml(h.id ?? "")}"${link}>${escapeText(h.text)}</a>`;
114
- }
115
- for (const _ of stack) out += `</li></${tag}>`;
116
- return out;
117
- }
118
-
119
26
  // src/nav.ts
120
27
  var CHILD_KEYS = ["children", "items", "pages"];
121
28
  function children(entry) {
@@ -398,8 +305,6 @@ function builtinFilters(markdown, config) {
398
305
  }
399
306
 
400
307
  export {
401
- headings,
402
- excerpt,
403
308
  BUILTIN_FILTERS,
404
309
  builtinFilters
405
310
  };
@@ -2,11 +2,11 @@ import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  budget
5
- } from "./chunk-GWWA5Y3X.js";
5
+ } from "./chunk-ULCT3PAV.js";
6
6
  import {
7
7
  bytes,
8
8
  count
9
- } from "./chunk-EVFNYUTR.js";
9
+ } from "./chunk-6U5VIQVY.js";
10
10
  import {
11
11
  VERSION
12
12
  } from "./chunk-AD3HAW3W.js";
@@ -18,6 +18,7 @@ import {
18
18
  } from "./chunk-DDV6JEC2.js";
19
19
  import {
20
20
  WebAssembly,
21
+ addMarkdownSteps,
21
22
  applyMarkdownOptions,
22
23
  checkLanguages,
23
24
  defaultMarkdownOptions,
@@ -26,14 +27,14 @@ import {
26
27
  site,
27
28
  undecodable,
28
29
  withPage
29
- } from "./chunk-RY3KLUQ3.js";
30
- import {
31
- closest
32
- } from "./chunk-FVZ5JBRI.js";
30
+ } from "./chunk-6OUCRDYI.js";
33
31
  import {
34
32
  globProblem,
35
33
  globToRegExp
36
- } from "./chunk-Z3XH4KWX.js";
34
+ } from "./chunk-SPIFZBIW.js";
35
+ import {
36
+ closest
37
+ } from "./chunk-FVZ5JBRI.js";
37
38
  import {
38
39
  describeThrown,
39
40
  hookModules,
@@ -41,7 +42,7 @@ import {
41
42
  loadedFiles,
42
43
  settle,
43
44
  watchSettle
44
- } from "./chunk-57HLSKZS.js";
45
+ } from "./chunk-4AZFCSGJ.js";
45
46
  import {
46
47
  charCount,
47
48
  firstChars,
@@ -67,7 +68,7 @@ import {
67
68
  tomlReason,
68
69
  warn,
69
70
  warning
70
- } from "./chunk-R7PBREXL.js";
71
+ } from "./chunk-YNJNMQWU.js";
71
72
  import {
72
73
  compareText,
73
74
  displayPath,
@@ -3357,7 +3358,6 @@ function emptyConfig(options) {
3357
3358
  ignore: [],
3358
3359
  bundles: false,
3359
3360
  strict: false,
3360
- trimAfterFrontMatter: false,
3361
3361
  jekyllTemplates: false,
3362
3362
  mkdocsTemplates: null,
3363
3363
  jinjaAutoescape: null,
@@ -3380,6 +3380,8 @@ function emptyConfig(options) {
3380
3380
  collections: [],
3381
3381
  transforms: [],
3382
3382
  htmlTransforms: [],
3383
+ markdownGiven: /* @__PURE__ */ new Set(),
3384
+ vitepress: false,
3383
3385
  engines: /* @__PURE__ */ new Map(),
3384
3386
  engineCaches: [],
3385
3387
  beforeBuild: [],
@@ -3477,7 +3479,7 @@ var EngineCache = class {
3477
3479
  this.now.set(source, html);
3478
3480
  }
3479
3481
  };
3480
- var SETTINGS = ["dirs", "templateFormats", "markdownEngine", "htmlEngine", "markdown", "deepMerge", "leaveNoTrace", "clean", "ignore", "bundles", "strict", "trimAfterFrontMatter", "jekyllTemplates", "mkdocsTemplates", "jinja", "lastModified", "dateFallback", "timeZone", "urls", "layoutAliases", "base", "schemas", "theme", "serve", "budgets"];
3482
+ var SETTINGS = ["dirs", "templateFormats", "markdownEngine", "htmlEngine", "markdown", "deepMerge", "leaveNoTrace", "ignore", "bundles", "strict", "jinja", "lastModified", "dateFallback", "timeZone", "urls", "layoutAliases", "base", "schemas", "theme", "serve", "budgets"];
3481
3483
  var PARTS = ["data", "filters", "collections", "transforms", "engines", "passthrough", "watch", "beforeBuild", "afterBuild", "plugins"];
3482
3484
  var CORE_ENGINES = ["edge", "html", "txt"];
3483
3485
  var DIRS = ["input", "output", "includes", "layouts", "data"];
@@ -3506,6 +3508,11 @@ function meant(key, options) {
3506
3508
  return best ? ` (did you mean "${best.option}"?)` : "";
3507
3509
  }
3508
3510
  var configWord = (key) => find(key, "config");
3511
+ var RETIRED = {
3512
+ jekyllTemplates: "it's fromJekyll() from \"ssqch/from-jekyll\" now, which also turns on kramdown's Markdown (`fromJekyll({ kramdown: false })` leaves that out): add it to plugins (`ssqch docs fromJekyll`)",
3513
+ mkdocsTemplates: 'it\'s fromMkdocs({ templates: true }) from "ssqch/from-mkdocs" now (`config: "docs/mkdocs.yml"` names another mkdocs.yml), which also turns on MkDocs\' Markdown: add it to plugins (`ssqch docs fromMkdocs`)',
3514
+ trimAfterFrontMatter: "the blank lines after a template's front matter are whitespace between tags in HTML, which browsers and `ssqch diff` read as the same. Where one matters (a feed that has to start with `<?xml`, a text file), take it out of that template: `ssqch scout --patch` does it for a Jekyll site"
3515
+ };
3509
3516
  var fail = (message) => {
3510
3517
  throw new TypeError(message);
3511
3518
  };
@@ -3545,7 +3552,7 @@ function aliased(part, where) {
3545
3552
  return out;
3546
3553
  }
3547
3554
  var BUILTINS = /* @__PURE__ */ new Map();
3548
- var BUILTIN_NAMES = ["ssqch/rss", "ssqch/image", "ssqch/minify", "ssqch/assets", "ssqch/links", "ssqch/sitemap", "ssqch/redirects", "ssqch/sass", "ssqch/elements", "ssqch/llms", "ssqch/vue"];
3555
+ var BUILTIN_NAMES = ["ssqch/rss", "ssqch/image", "ssqch/minify", "ssqch/assets", "ssqch/links", "ssqch/sitemap", "ssqch/redirects", "ssqch/sass", "ssqch/elements", "ssqch/llms", "ssqch/vue", "ssqch/robots", "ssqch/from-mkdocs", "ssqch/from-jekyll", "ssqch/from-hugo", "ssqch/from-vitepress"];
3549
3556
  async function loadJs(config, file) {
3550
3557
  const name = path7.basename(file);
3551
3558
  const { root, env, serving } = config;
@@ -3625,6 +3632,7 @@ async function loadJs(config, file) {
3625
3632
  let guessed = false;
3626
3633
  for (const key of Object.keys(part)) {
3627
3634
  if ((key === "name" || key === "rust") && !top) continue;
3635
+ if (!top && (key === "markdown" || key === "defaults")) continue;
3628
3636
  if (SETTINGS.includes(key)) {
3629
3637
  if (!top) fail(`${where}: "${key}" can only be set in the config itself, not in a plugin`);
3630
3638
  } else if (!PARTS.includes(key)) {
@@ -3639,6 +3647,10 @@ async function loadJs(config, file) {
3639
3647
  More: ${equivalent.more}`);
3640
3648
  continue;
3641
3649
  }
3650
+ if (top && Object.hasOwn(RETIRED, key)) {
3651
+ unknown.push(`${where}: "${key}" is gone: ${RETIRED[key]}`);
3652
+ continue;
3653
+ }
3642
3654
  const hint = top && DIRS.includes(key) ? ` (it goes in dirs: { ${key}: "..." })` : meant(key, options);
3643
3655
  unknown.push(`${where}: "${key}" isn't a config option${hint}`);
3644
3656
  guessed = true;
@@ -3648,6 +3660,27 @@ async function loadJs(config, file) {
3648
3660
  const options = top ? [...SETTINGS, ...PARTS] : PARTS;
3649
3661
  fail(unknown.join("\n") + (guessed ? ` (options: ${options.join(", ")})` : ""));
3650
3662
  }
3663
+ if (!top && part.markdown !== void 0) {
3664
+ const steps = part.markdown;
3665
+ ops.push(() => {
3666
+ addMarkdownSteps(config.markdown.steps, where, steps);
3667
+ });
3668
+ }
3669
+ if (!top && part.defaults !== void 0) {
3670
+ const defaults = part.defaults;
3671
+ if (!isObject2(defaults)) fail(`${where}: defaults must be an object, like { markdown: { headingIds: "ascii" } }`);
3672
+ for (const key of Object.keys(defaults)) if (key !== "markdown") fail(`${where}: defaults.${key}: a plugin's defaults can be markdown options only`);
3673
+ if (defaults.markdown !== void 0 && !isObject2(defaults.markdown)) fail(`${where}: defaults.markdown must be an object of markdown options`);
3674
+ ops.push(() => {
3675
+ const own = Object.fromEntries(Object.entries(defaults.markdown ?? {}).filter(([key]) => !config.markdownGiven.has(key)));
3676
+ if (!Object.keys(own).length) return;
3677
+ try {
3678
+ applyMarkdownOptions(config.markdown, own);
3679
+ } catch (e) {
3680
+ throw context(e, `${where}: defaults`);
3681
+ }
3682
+ });
3683
+ }
3651
3684
  if (!top && part.rust !== void 0) {
3652
3685
  const rust = loadRustPart(part.rust, where, root);
3653
3686
  if (rust.transform) {
@@ -3819,30 +3852,21 @@ function applySettings(config, settings) {
3819
3852
  else bail(`${key} must be a string or false, not ${typeof value}`);
3820
3853
  }
3821
3854
  if (settings.markdown !== void 0) applyMarkdownOptions(config.markdown, settings.markdown);
3855
+ if (isObject2(settings.markdown)) config.markdownGiven = new Set(Object.keys(settings.markdown));
3822
3856
  checkLanguages(config.markdown, config.root);
3823
3857
  if (settings.deepMerge !== void 0) {
3824
3858
  if (typeof settings.deepMerge !== "boolean") bail(`deepMerge must be true or false, not ${typeof settings.deepMerge}`);
3825
3859
  config.deepMerge = settings.deepMerge;
3826
3860
  }
3827
- let trace;
3828
- for (const key of ["leaveNoTrace", "clean"]) {
3829
- const value = settings[key];
3830
- if (value === void 0) continue;
3831
- if (typeof value !== "boolean") bail(`${key} must be true or false, not ${typeof value}`);
3832
- if (trace !== void 0) bail("leaveNoTrace and clean are two names for one option; set one of them");
3833
- trace = value;
3834
- }
3861
+ const trace = settings.leaveNoTrace;
3862
+ if (trace !== void 0 && typeof trace !== "boolean") bail(`leaveNoTrace must be true or false, not ${typeof trace}`);
3835
3863
  if (trace !== void 0) config.leaveNoTrace = trace;
3836
- for (const key of ["bundles", "strict", "trimAfterFrontMatter", "jekyllTemplates"]) {
3864
+ for (const key of ["bundles", "strict"]) {
3837
3865
  const value = settings[key];
3838
3866
  if (value === void 0) continue;
3839
3867
  if (typeof value !== "boolean") bail(`${key} must be true or false, not ${typeof value}`);
3840
3868
  config[key] = value;
3841
3869
  }
3842
- const mkdocs = settings.mkdocsTemplates;
3843
- if (mkdocs === true) config.mkdocsTemplates = "mkdocs.yml";
3844
- else if (typeof mkdocs === "string" && mkdocs.trim() !== "") config.mkdocsTemplates = mkdocs;
3845
- else if (mkdocs !== void 0 && mkdocs !== false && mkdocs !== null) bail(`mkdocsTemplates must be true, false or the path of an mkdocs.yml, not ${typeof mkdocs === "string" ? "an empty string" : typeof mkdocs}`);
3846
3870
  const jinja = settings.jinja;
3847
3871
  if (isObject2(jinja)) {
3848
3872
  const unknown = Object.keys(jinja).find((k) => k !== "autoescape");
@@ -3876,7 +3900,6 @@ function applySettings(config, settings) {
3876
3900
  const theme = settings.theme;
3877
3901
  const themes = theme === void 0 || theme === null || theme === false ? [] : Array.isArray(theme) ? theme : [theme];
3878
3902
  for (const one of themes) addTheme(config, one);
3879
- if (config.mkdocsTemplates !== null) addMkdocsTheme(config);
3880
3903
  if (isObject2(settings.schemas)) {
3881
3904
  for (const [name, spec] of Object.entries(settings.schemas)) {
3882
3905
  const schema = parseSchema(name, spec);
@@ -4089,5 +4112,6 @@ export {
4089
4112
  configOptions,
4090
4113
  meant,
4091
4114
  BUILTINS,
4115
+ addMkdocsTheme,
4092
4116
  tomlKeyLine
4093
4117
  };