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,13 +5,13 @@ import {
5
5
  shownOutput
6
6
  } from "./chunk-DDV6JEC2.js";
7
7
  import {
8
- FIRST_SITING,
8
+ FIRST_SIGHTING,
9
9
  LEFT_NO_TRACE,
10
10
  RECOVERED
11
- } from "./chunk-UU43WIZG.js";
11
+ } from "./chunk-FJML7INB.js";
12
12
  import {
13
13
  warning
14
- } from "./chunk-R7PBREXL.js";
14
+ } from "./chunk-YNJNMQWU.js";
15
15
  import {
16
16
  relative
17
17
  } from "./chunk-VJWQSYEG.js";
@@ -101,7 +101,7 @@ function summary(config, report, recovered = false) {
101
101
  const asides = [
102
102
  [recovered, "recovered"],
103
103
  [nothing, "nothingSighted"],
104
- [report.firstBuild, "firstSiting"],
104
+ [report.firstBuild, "firstSighting"],
105
105
  [report.filesRemoved > 0, "leftNoTrace"],
106
106
  [report.drafts > 0, "unconfirmed"],
107
107
  [report.unused.length > 0, "uninhabited"]
@@ -130,7 +130,7 @@ function summary(config, report, recovered = false) {
130
130
  lines.push(["Output", `${output}: ${count(files)} file${plural(files)}, ${bytes(size)}`]);
131
131
  if (report.timings.length) lines.push(["Time", report.timings.map(([label, ms]) => `${label} ${duration(ms)}`).join(", ")]);
132
132
  const width = Math.max(0, ...lines.map(([label]) => label.length));
133
- const first = aside === "firstSiting" ? `${FIRST_SITING} ` : aside === "recovered" ? `${RECOVERED} ` : "";
133
+ const first = aside === "firstSighting" ? `${FIRST_SIGHTING} ` : aside === "recovered" ? `${RECOVERED} ` : "";
134
134
  let out = `${first}Built in ${duration(report.durationMs)} (${config.env})
135
135
  `;
136
136
  for (const [label, text] of lines) out += ` ${label.padEnd(width)} ${text}
@@ -1,28 +1,29 @@
1
1
  import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
+ import {
4
+ rustRegExp
5
+ } from "./chunk-3GYLOC6Y.js";
3
6
  import {
4
7
  jinjaFilters,
5
8
  readMkdocsYaml,
6
9
  require_liquid_node
7
- } from "./chunk-L3K7MMFC.js";
10
+ } from "./chunk-YA23NDMW.js";
8
11
  import {
9
12
  BUILTIN_FILTERS
10
- } from "./chunk-DZ5F5XSI.js";
13
+ } from "./chunk-V3G2QGL3.js";
11
14
  import {
12
15
  baselineTime
13
- } from "./chunk-4ZMNLWE4.js";
16
+ } from "./chunk-2BJFGKOE.js";
14
17
  import "./chunk-4Q6WMTER.js";
15
- import "./chunk-RGYJQYW3.js";
18
+ import "./chunk-HDKU6LRI.js";
16
19
  import "./chunk-P2WS4RM4.js";
17
- import "./chunk-4B3N44SN.js";
18
- import {
19
- rustRegExp
20
- } from "./chunk-3GYLOC6Y.js";
20
+ import "./chunk-UHRBPZ4A.js";
21
+ import "./chunk-25WERNDD.js";
21
22
  import {
22
23
  findConfig
23
- } from "./chunk-DOHOKUGB.js";
24
- import "./chunk-GWWA5Y3X.js";
25
- import "./chunk-EVFNYUTR.js";
24
+ } from "./chunk-VILOEVK7.js";
25
+ import "./chunk-ULCT3PAV.js";
26
+ import "./chunk-6U5VIQVY.js";
26
27
  import {
27
28
  VERSION
28
29
  } from "./chunk-AD3HAW3W.js";
@@ -32,13 +33,13 @@ import {
32
33
  } from "./chunk-DDV6JEC2.js";
33
34
  import {
34
35
  require_nunjucks
35
- } from "./chunk-RY3KLUQ3.js";
36
+ } from "./chunk-6OUCRDYI.js";
37
+ import "./chunk-SPIFZBIW.js";
36
38
  import "./chunk-FVZ5JBRI.js";
37
- import "./chunk-Z3XH4KWX.js";
38
- import "./chunk-UU43WIZG.js";
39
+ import "./chunk-FJML7INB.js";
39
40
  import {
40
41
  importFile
41
- } from "./chunk-57HLSKZS.js";
42
+ } from "./chunk-4AZFCSGJ.js";
42
43
  import "./chunk-CMUWRPSQ.js";
43
44
  import {
44
45
  TABLE,
@@ -48,7 +49,7 @@ import {
48
49
  readToml,
49
50
  red,
50
51
  tomlReason
51
- } from "./chunk-R7PBREXL.js";
52
+ } from "./chunk-YNJNMQWU.js";
52
53
  import {
53
54
  compareText,
54
55
  isDir,
@@ -2036,8 +2037,23 @@ var JEKYLL_PAGE = {
2036
2037
  previous: "`navPager(collections.posts, page.url).previous`"
2037
2038
  };
2038
2039
  var LIQUID_TAGS = /* @__PURE__ */ new Set(["assign", "capture", "endcapture", "case", "when", "endcase", "comment", "endcomment", "cycle", "decrement", "increment", "echo", "for", "endfor", "break", "continue", "if", "elsif", "else", "endif", "unless", "endunless", "include", "include_relative", "render", "layout", "liquid", "raw", "endraw", "tablerow", "endtablerow", "highlight", "endhighlight", "link", "post_url", "block", "endblock"]);
2040
+ function withoutBlankAfterFrontMatter(text) {
2041
+ const open = /^---[ \t]*\r?\n/.exec(text);
2042
+ if (!open) return void 0;
2043
+ const close = /^---[ \t]*(?:\r?\n|$)/m.exec(text.slice(open[0].length));
2044
+ if (!close) return void 0;
2045
+ const end = open[0].length + close.index + close[0].length;
2046
+ const blank = /^(?:[ \t]*\r?\n)+/.exec(text.slice(end));
2047
+ return blank ? text.slice(0, end) + text.slice(end + blank[0].length) : void 0;
2048
+ }
2049
+ function writesHtml(rel, text) {
2050
+ const front = /^---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/.exec(text)?.[1] ?? "";
2051
+ const permalink = /^permalink:\s*["']?([^"'\s#]+)/m.exec(front)?.[1];
2052
+ if (permalink && /\.[A-Za-z0-9]+$/.test(permalink)) return /\.html?$/i.test(permalink);
2053
+ return /\.(?:md|markdown|html?)$/i.test(rel);
2054
+ }
2039
2055
  var JEKYLL_PLUGINS = {
2040
- "jekyll-sitemap": { use: ['import { sitemapPlugin } from "ssqch/sitemap";', "sitemapPlugin({ url: site.url })"], say: "`sitemapPlugin({ url: site.url })`, in the draft (an empty `url` writes paths, as jekyll-sitemap did, and warns). jekyll-sitemap also wrote `/robots.txt` when the site had none: `robots.liquid`, in the plan. Its own sitemap's format (the order, `xsi:schemaLocation`) is a template of your own if the bytes matter" },
2056
+ "jekyll-sitemap": { use: ['import { sitemapPlugin } from "ssqch/sitemap";', "sitemapPlugin({ url: site.url })"], say: "`sitemapPlugin({ url: site.url })`, in the draft (it needs the site's address: with no `url` in the config, the draft leaves it commented out until there is one). jekyll-sitemap also wrote `/robots.txt` when the site had none: `robots.liquid`, in the plan. Its own sitemap's format (the order, `xsi:schemaLocation`) is a template of your own if the bytes matter" },
2041
2057
  "jekyll-redirect-from": { use: ['import { redirectsPlugin } from "ssqch/redirects";', "redirectsPlugin()"], say: "`redirectsPlugin()`, in the draft: `redirect_from` works as it is (templates read it as `aliases`); `_includes/hooks/redirect.*` is its page's markup. jekyll-redirect-from also wrote `/redirects.json`: `redirects.liquid`, in the plan" },
2042
2058
  "jekyll-feed": { use: ['import { rssPlugin } from "ssqch/rss";', "rssPlugin()"], say: "`rssPlugin()` is in the draft; the feed itself is a template of the site's (`feed.xml.liquid` with `permalink: /feed.xml`): `ssqch docs rssPlugin`" },
2043
2059
  "jekyll-seo-tag": { say: '`{% seo %}` becomes an include: `ssqch docs "From jekyll-seo-tag"` has one that writes its tags' },
@@ -2188,6 +2204,11 @@ function jekyll(dir) {
2188
2204
  next = next.replace(/\{%(-?)\s*seo\b[^%]*?(-?)%\}/g, "{%$1 include seo.liquid $2%}");
2189
2205
  changes = [...changes, "{% seo %} -> {% include seo.liquid %}"];
2190
2206
  }
2207
+ const trimmed = withoutBlankAfterFrontMatter(next);
2208
+ if (trimmed !== void 0 && !templateDir && !writesHtml(entry.rel, next)) {
2209
+ next = trimmed;
2210
+ changes = [...changes, "the blank line after the front matter out (Jekyll dropped it; here it would be the file's first line)"];
2211
+ }
2191
2212
  if (changes.length) plan.edits.push([entry.rel, changes, next]);
2192
2213
  for (const what of left2) plan.byHand.push([entry.rel, what]);
2193
2214
  for (const m of text.matchAll(/\{%-?\s*([a-z_][\w-]*)/g)) {
@@ -2356,8 +2377,8 @@ ${body}`;
2356
2377
  const gemfile = readUtf8(path.join(dir, "Gemfile")) ?? "";
2357
2378
  const named = /* @__PURE__ */ new Set([...list("plugins"), ...list("gems"), ...[...gemfile.matchAll(/^\s*gem\s+["']([^"']+)["']/gm)].map((m) => m[1])]);
2358
2379
  if (named.has("github-pages")) for (const p of GITHUB_PAGES_PLUGINS) named.add(p);
2359
- const imports = ['import { defineConfig, readData } from "ssqch";'];
2360
- const plugins = [];
2380
+ const imports = ['import { defineConfig, readData } from "ssqch";', 'import { fromJekyll } from "ssqch/from-jekyll";'];
2381
+ const plugins = ["fromJekyll()"];
2361
2382
  for (const name of [...named].sort(compareText)) {
2362
2383
  const known = JEKYLL_PLUGINS[name];
2363
2384
  if (!known) {
@@ -2421,9 +2442,9 @@ ${body}`;
2421
2442
  const loadPaths = isPlainObject(config.sass) && Array.isArray(config.sass.load_paths) ? config.sass.load_paths.map(String) : isDir(path.join(dir, "_sass")) ? ["_sass"] : [];
2422
2443
  plugins.push(`sassPlugin({ files: { ${files.join(", ")} }${loadPaths.length ? `, loadPaths: ${JSON.stringify(loadPaths)}` : ""}, charset: false })`);
2423
2444
  }
2424
- const markdown = ['htmlMarkdown: "kramdown"', 'headingIds: "kramdown"', "smartPunctuation: true", "autolinks: false", "encodeUrls: false"];
2445
+ const markdown = [];
2425
2446
  const kramdown = isPlainObject(config.kramdown) ? config.kramdown : {};
2426
- if (kramdown.auto_ids === false) markdown[1] = "headingIds: false";
2447
+ if (kramdown.auto_ids === false) markdown.push("headingIds: false");
2427
2448
  if (kramdown.smart_quotes !== void 0 || kramdown.input === "GFM" && kramdown.hard_wrap === true) plan.byHand.push([configFile, "kramdown's `smart_quotes` or `hard_wrap`: check the draft's `markdown` against them (`breaks: true` for `hard_wrap`)"]);
2428
2449
  if (typeof config.markdown === "string" && !/kramdown/i.test(config.markdown)) plan.byHand.push([configFile, `markdown: ${config.markdown}: the draft's options are kramdown's; ssqch's Markdown is CommonMark with extensions (\`ssqch docs markdown\`)`]);
2429
2450
  let out = `// A first draft, written by \`ssqch scout\` from ${configFile}.
@@ -2443,6 +2464,11 @@ const site = readData(${JSON.stringify(configFile)});
2443
2464
 
2444
2465
  export default defineConfig({
2445
2466
  `;
2467
+ const SITEMAP = "sitemapPlugin({ url: site.url })";
2468
+ if (plugins.includes(SITEMAP) && (typeof config.url !== "string" || config.url === "") && !urlFromCname) {
2469
+ plugins[plugins.indexOf(SITEMAP)] = `/* ${SITEMAP}: needs \`url\` in ${configFile} */`;
2470
+ plan.byHand.push([configFile, "no `url`: `sitemapPlugin()` needs the site's address (`url: https://example.com`), so it's commented out in the draft until there is one"]);
2471
+ }
2446
2472
  const builtIn = /* @__PURE__ */ new Set(["txt"]);
2447
2473
  out += ` // Markdown and HTML pages run through Liquid first, as in Jekyll.
2448
2474
  templateFormats: ${JSON.stringify(["liquid", "md", "html", ...otherFormats]).replaceAll(",", ", ")},
@@ -2459,9 +2485,7 @@ export default defineConfig({
2459
2485
  if (output !== "_site") dirs.push(`output: ${JSON.stringify(output)}`);
2460
2486
  out += ` dirs: { ${dirs.join(", ")} },
2461
2487
  `;
2462
- out += " // Jekyll drops the blank lines after the closing `---`.\n trimAfterFrontMatter: true,\n";
2463
- out += " // Templates see Jekyll's `page` (front matter too: `page.title`) and `site` (`site.posts`,\n // each collection, `site.data`, `site.categories`), so the layouts and includes run as written.\n jekyllTemplates: true,\n";
2464
- out += ` // kramdown's habits: markdown="1", its heading ids, smart quotes, no bare-URL links, URLs as written.
2488
+ if (markdown.length) out += ` // kramdown's auto_ids is off in ${configFile}.
2465
2489
  markdown: { ${markdown.join(", ")} },
2466
2490
  `;
2467
2491
  out += ` // ${configFile}'s \`exclude\`, and what Jekyll leaves out by itself.
@@ -2695,7 +2719,7 @@ function hugo(dir) {
2695
2719
  const calls = blockCalls.sorted();
2696
2720
  if (calls.length || inlineCalls.seen.size) {
2697
2721
  const pages = new Set([...calls, ...inlineCalls.sorted()].flatMap(([, { files }]) => [...files])).size;
2698
- plan.byHand.push([contentDir, `${(/* @__PURE__ */ new Set([...blockCalls.seen.keys(), ...inlineCalls.seen.keys()])).size} shortcodes, called in ${pages} ${pages === 1 ? "page" : "pages"}: \`markdown: { shortcodes: "hugo" }\` (in the draft) reads each call as a container, rendered by \`_includes/containers/<name>.*\` (one inside a line of text too, in its place); the draft has a template to port for each of the site's own`, { code: "hugo-shortcodes", status: "option", files: pages, option: 'markdown: { shortcodes: "hugo" }', docs: "shortcodes" }]);
2722
+ plan.byHand.push([contentDir, `${(/* @__PURE__ */ new Set([...blockCalls.seen.keys(), ...inlineCalls.seen.keys()])).size} shortcodes, called in ${pages} ${pages === 1 ? "page" : "pages"}: \`fromHugo()\` (in the draft) reads each call as a container, rendered by \`_includes/containers/<name>.*\` (one inside a line of text too, in its place); the draft has a template to port for each of the site's own`, { code: "hugo-shortcodes", status: "option", files: pages, option: 'markdown: { shortcodes: "hugo" }', defines: ["plugin:fromHugo"], docs: "shortcodes" }]);
2699
2723
  }
2700
2724
  for (const [name, { count, files, first }] of calls) {
2701
2725
  const own = shortcodeFiles.get(name);
@@ -2753,7 +2777,7 @@ function hugo(dir) {
2753
2777
  if (baseURL) site.url = baseURL;
2754
2778
  if (isPlainObject(hugoKey(config, "params"))) site.params = hugoKey(config, "params");
2755
2779
  const dirs = [`input: ${JSON.stringify(contentDir)}`, `output: ${JSON.stringify(output)}`, 'includes: "../_includes"', ...hasDir("data") ? ['data: "../data"'] : []];
2756
- const imports = ['import { defineConfig } from "ssqch";', 'import { linksPlugin } from "ssqch/links";', ...baseURL ? ['import { sitemapPlugin } from "ssqch/sitemap";'] : []];
2780
+ const imports = ['import { defineConfig } from "ssqch";', 'import { fromHugo } from "ssqch/from-hugo";', 'import { linksPlugin } from "ssqch/links";', ...baseURL ? ['import { sitemapPlugin } from "ssqch/sitemap";'] : []];
2757
2781
  let out = `// A first draft, written by \`ssqch scout\` from ${configFile ?? "the Hugo site"}.
2758
2782
  // \`ssqch docs --from hugo\` has the whole mapping.
2759
2783
  ${imports.join("\n")}
@@ -2766,11 +2790,12 @@ export default defineConfig({
2766
2790
  base: ${JSON.stringify(basePath(baseURL))},
2767
2791
  `;
2768
2792
  out += " // Hugo doesn't run template code in content, and its shortcodes on a line of their own are\n // containers (_includes/containers/<name>.jinja).\n markdownEngine: false,\n";
2769
- out += ' markdown: { shortcodes: "hugo", highlight: { classes: "pygments" } },\n';
2793
+ out += ' markdown: { highlight: { classes: "pygments" } },\n';
2770
2794
  if (hasDir("static")) out += ' passthrough: [{ static: "." }],\n';
2771
2795
  out += ` data: { site: ${JSON.stringify(sortedKeys(site))} },
2772
2796
  `;
2773
2797
  out += ` plugins: [${[
2798
+ "fromHugo()",
2774
2799
  ...baseURL ? [`sitemapPlugin({ url: ${JSON.stringify(baseURL)} })`] : [],
2775
2800
  // Hugo doesn't check links, so one that was broken there warns rather than failing the move's build.
2776
2801
  "linksPlugin({ fail: false })"
@@ -2803,9 +2828,9 @@ var MKDOCS_PLUGINS = {
2803
2828
  i18n: { say: "`ssqch docs multilingual`", status: "ssqch" }
2804
2829
  };
2805
2830
  var MKDOCS_EXTENSIONS = {
2806
- admonition: { say: '`!!!` admonitions: `markdown: { admonitions: "mkdocs" }` (in the draft) writes them as Python-Markdown does', status: "option", option: 'markdown: { admonitions: "mkdocs" }' },
2807
- "pymdownx.details": { say: '`???` collapsible admonitions: `markdown: { admonitions: "mkdocs" }` (in the draft)', status: "option", option: 'markdown: { admonitions: "mkdocs" }' },
2808
- "pymdownx.tabbed": { say: '`===` tabs: `markdown: { tabs: "mkdocs" }` (in the draft) writes them in the alternate style', status: "option", option: 'markdown: { tabs: "mkdocs" }' },
2831
+ admonition: { say: "`!!!` admonitions: `fromMkdocs()` (in the draft) writes them as Python-Markdown does", status: "option", option: 'markdown: { admonitions: "mkdocs" }' },
2832
+ "pymdownx.details": { say: "`???` collapsible admonitions: `fromMkdocs()` (in the draft)", status: "option", option: 'markdown: { admonitions: "mkdocs" }' },
2833
+ "pymdownx.tabbed": { say: "`===` tabs: `fromMkdocs()` (in the draft) writes them in the alternate style", status: "option", option: 'markdown: { tabs: "mkdocs" }' },
2809
2834
  "pymdownx.superfences": { say: "fences, built in; custom fences (mermaid) are a fence hook (`_includes/hooks/fence-mermaid.<ext>`)", status: "ssqch" },
2810
2835
  "pymdownx.highlight": { say: "`markdown: { highlight: { classes: \"pygments\" } }` (in the draft): Pygments' class names, cut by ssqch's grammars (the tokens can differ from Pygments', and the wrapper is a fence hook's: `_includes/hooks/fence.*`)", status: "option", option: 'markdown: { highlight: { classes: "pygments" } }' },
2811
2836
  codehilite: { say: "`markdown: { highlight: { classes: \"pygments\" } }` (in the draft) gives tokens Pygments' class names, cut by ssqch's grammars; codehilite's markup isn't the same (`<div class=\"codehilite\"><pre><span></span><code>`), and its tokens are Pygments', so a byte-for-byte move needs Pygments itself, or a fence hook (`_includes/hooks/fence.*`) for the wrapper", status: "option", option: 'markdown: { highlight: { classes: "pygments" } }' },
@@ -2827,7 +2852,7 @@ var MKDOCS_EXTENSIONS = {
2827
2852
  attr_list: { say: "attributes (`{#id .class}`), built in; on headings, ssqch keeps ids and classes", status: "ssqch" },
2828
2853
  md_in_html: { say: 'Markdown inside HTML with the bare `markdown` attribute: not in ssqch yet as written; `markdown: { htmlMarkdown: "kramdown" }` reads `markdown="1"`', status: "not-yet" },
2829
2854
  footnotes: { say: "footnotes, built in (their markup is a `footnotes` hook's)", status: "ssqch" },
2830
- toc: { say: "`markdown: { headingIds: \"python-markdown\" }` (in the draft): toc's default ids (a repeated heading's `_1` too; a `slugify` of the site's own needs a function). The table of contents is `page.headings` and the `toc` filter", status: "option", option: 'markdown: { headingIds: "python-markdown" }' },
2855
+ toc: { say: "`fromMkdocs()` (in the draft): toc's default ids (a repeated heading's `_1` too; a `slugify` of the site's own needs a function). The table of contents is `page.headings` and the `toc` filter", status: "option", option: 'markdown: { headingIds: "python-markdown" }' },
2831
2856
  def_list: { say: "`markdown: { definitionLists: true }` (in the draft)", status: "option", option: "markdown: { definitionLists: true }" },
2832
2857
  abbr: { say: "abbreviations: not in ssqch yet", status: "not-yet" },
2833
2858
  tables: { say: "tables, built in", status: "ssqch" },
@@ -2856,7 +2881,7 @@ function mkdocs(dir) {
2856
2881
  const extensions = named(config.markdown_extensions);
2857
2882
  const plugins = config.plugins === void 0 ? ["search"] : named(config.plugins);
2858
2883
  const theme = isPlainObject(config.theme) ? config.theme.name : config.theme;
2859
- if (typeof theme === "string") plan.byHand.push([`${configFile}: theme`, `the ${theme === "material" ? "Material" : theme} theme's templates are Jinja, which ssqch runs as written with \`mkdocsTemplates: true\` (in the draft, to turn on once they're there): it gives them MkDocs' context (\`config\`, \`nav\`, \`page\`, \`base_url\`, the \`url\` filter). Copy the theme's templates from its Python package into an ssqch theme first (\`ssqch docs --from mkdocs\`, "The theme")`, { code: "mkdocs-theme", status: "option", option: "mkdocsTemplates: true", docs: "mkdocsTemplates" }]);
2884
+ if (typeof theme === "string") plan.byHand.push([`${configFile}: theme`, `the ${theme === "material" ? "Material" : theme} theme's templates are Jinja, which ssqch runs as written with \`fromMkdocs({ templates: true })\` (in the draft, to turn on once they're there): it gives them MkDocs' context (\`config\`, \`nav\`, \`page\`, \`base_url\`, the \`url\` filter). Copy the theme's templates from its Python package into an ssqch theme first (\`ssqch docs --from mkdocs\`, "The theme")`, { code: "mkdocs-theme", status: "option", option: "mkdocsTemplates: true", docs: "mkdocsTemplates" }]);
2860
2885
  for (const name of plugins) {
2861
2886
  const known = MKDOCS_PLUGINS[name.replace(/^material\//, "")];
2862
2887
  plan.byHand.push([`${configFile}: plugins`, `\`${name}\`: ${known?.say ?? "not in ssqch yet: port it as a plugin (`ssqch docs plugins`)"}`, { code: "mkdocs-plugin", status: known?.status ?? "site" }]);
@@ -2874,9 +2899,9 @@ function mkdocs(dir) {
2874
2899
  plan.byHand.push([`${configFile}: site_url`, "MkDocs writes `sitemap.xml.gz` beside `sitemap.xml`: `sitemapPlugin()` writes the `.xml`; the gzipped copy isn't in ssqch yet (an `afterBuild` step with `node:zlib`)", { code: "mkdocs-sitemap-gz", status: "not-yet" }]);
2875
2900
  if (isFile(path.join(dir, "hooks.py")) || config.hooks) plan.byHand.push([`${configFile}: hooks`, "Python hooks don't run in ssqch: port each as a plugin or a filter (`ssqch docs plugins`)", { code: "mkdocs-hooks", status: "site", docs: "plugins" }]);
2876
2901
  const syntax = [
2877
- ["links to .md files", /\]\((?![a-z]+:)[^)\s#]*\.md(?:#[^)\s]*)?\)|^[ \t]*\[[^\]\n]+\]:[ \t]*(?![a-z]+:)[^\s#]*\.md(?:#\S*)?[ \t]*$/gm, '`markdown: { sourceLinks: "relative" }` (in the draft) links each to its page\'s URL, as MkDocs does', "mkdocs-md-links", "option"],
2878
- ["admonitions (`!!!`, `???`)", /^[ \t]*(?:!!!|\?\?\?\+?)[ \t]+\w/gm, '`markdown: { admonitions: "mkdocs" }` (in the draft)', "mkdocs-admonitions", "option"],
2879
- ["tabs (`===`)", /^[ \t]*===[+!]{0,2}[ \t]+"/gm, '`markdown: { tabs: "mkdocs" }` (in the draft)', "mkdocs-tabs", "option"],
2902
+ ["links to .md files", /\]\((?![a-z]+:)[^)\s#]*\.md(?:#[^)\s]*)?\)|^[ \t]*\[[^\]\n]+\]:[ \t]*(?![a-z]+:)[^\s#]*\.md(?:#\S*)?[ \t]*$/gm, "`fromMkdocs()` (in the draft) links each to its page's URL, as MkDocs does", "mkdocs-md-links", "option"],
2903
+ ["admonitions (`!!!`, `???`)", /^[ \t]*(?:!!!|\?\?\?\+?)[ \t]+\w/gm, "`fromMkdocs()` (in the draft)", "mkdocs-admonitions", "option"],
2904
+ ["tabs (`===`)", /^[ \t]*===[+!]{0,2}[ \t]+"/gm, "`fromMkdocs()` (in the draft)", "mkdocs-tabs", "option"],
2880
2905
  ["snippets (`--8<--`)", /^[ \t]*-+8<-+/gm, "not in ssqch yet as written", "mkdocs-snippets", "not-yet"],
2881
2906
  ["icons and emoji (`:name:`)", /:(?:material|fontawesome|octicons|simple)-[\w-]+:/g, "not in ssqch yet", "mkdocs-icons", "not-yet"],
2882
2907
  ["bare `markdown` attributes", /<[a-z][^>]*\smarkdown(?=[\s>])/g, 'not in ssqch yet as written: `htmlMarkdown: "kramdown"` reads `markdown="1"`', "mkdocs-md-in-html", "not-yet"],
@@ -2902,7 +2927,7 @@ function mkdocs(dir) {
2902
2927
  const site = {};
2903
2928
  for (const [from, to] of [["site_name", "name"], ["site_url", "url"], ["site_description", "description"], ["site_author", "author"], ["repo_url", "repo_url"], ["edit_uri", "edit_uri"], ["copyright", "copyright"]]) if (typeof config[from] === "string") site[to] = config[from];
2904
2929
  if (isPlainObject(config.extra)) site.extra = config.extra;
2905
- const markdown = ['admonitions: "mkdocs"', 'tabs: "mkdocs"', 'sourceLinks: "relative"', 'headingIds: "python-markdown"', 'dialect: "python-markdown"'];
2930
+ const markdown = [];
2906
2931
  if (extensions.some((e) => e === "pymdownx.highlight" || e === "codehilite")) markdown.push('highlight: { classes: "pygments" }');
2907
2932
  if (extensions.includes("def_list")) markdown.push("definitionLists: true");
2908
2933
  if (extensions.includes("smarty")) markdown.push("smartPunctuation: true");
@@ -2917,7 +2942,7 @@ function mkdocs(dir) {
2917
2942
  return out2;
2918
2943
  })();
2919
2944
  const url = typeof config.site_url === "string" ? config.site_url.replace(/\/$/, "") : void 0;
2920
- const imports = ['import { defineConfig } from "ssqch";', 'import { linksPlugin } from "ssqch/links";', ...url ? ['import { sitemapPlugin } from "ssqch/sitemap";'] : [], ...redirects ? ['import { redirectsPlugin } from "ssqch/redirects";'] : []];
2945
+ const imports = ['import { defineConfig } from "ssqch";', 'import { fromMkdocs } from "ssqch/from-mkdocs";', 'import { linksPlugin } from "ssqch/links";', ...url ? ['import { sitemapPlugin } from "ssqch/sitemap";'] : [], ...redirects ? ['import { redirectsPlugin } from "ssqch/redirects";'] : []];
2921
2946
  let out = `// A first draft, written by \`ssqch scout\` from ${configFile}.
2922
2947
  // \`ssqch docs --from mkdocs\` has the whole mapping. The sidebar is _data/nav.yml (navTree).
2923
2948
  ${imports.join("\n")}
@@ -2936,7 +2961,7 @@ export default defineConfig({
2936
2961
  // "The theme"), then turn these on.
2937
2962
  // theme: "theme", mkdocsTemplates: true,
2938
2963
  `;
2939
- out += ` markdown: { ${markdown.join(", ")} },
2964
+ if (markdown.length) out += ` markdown: { ${markdown.join(", ")} },
2940
2965
  `;
2941
2966
  const copied = walk(path.join(dir, docsDir), (name) => name.startsWith(".") || name === "node_modules", false).filter((e) => e.isFile && !/\.md$/i.test(e.name) && !(customDir && path.join(dir, docsDir, e.rel).startsWith(path.join(dir, customDir) + path.sep)));
2942
2967
  const others = [...new Set(copied.filter((e) => /\.[A-Za-z0-9]+$/.test(e.name)).map((e) => extensionOf(e.name).toLowerCase()))].sort(compareText);
@@ -2946,7 +2971,7 @@ export default defineConfig({
2946
2971
  `;
2947
2972
  out += ` data: { site: ${JSON.stringify(sortedKeys(site))} },
2948
2973
  `;
2949
- const pluginCalls = [...url ? [`sitemapPlugin({ url: ${JSON.stringify(url)} })`] : [], ...redirects ? [`redirectsPlugin({ redirects: ${JSON.stringify(redirects)} })`] : [], config.strict === true ? "linksPlugin()" : "linksPlugin({ fail: false })"];
2974
+ const pluginCalls = ["fromMkdocs()", ...url ? [`sitemapPlugin({ url: ${JSON.stringify(url)} })`] : [], ...redirects ? [`redirectsPlugin({ redirects: ${JSON.stringify(redirects)} })`] : [], config.strict === true ? "linksPlugin()" : "linksPlugin({ fail: false })"];
2950
2975
  out += ` plugins: [${pluginCalls.join(", ")}],
2951
2976
  });
2952
2977
  `;
@@ -2977,6 +3002,10 @@ ${open}<pre><span></span><code>{% if fence.highlighted %}{{ fence.highlighted |
2977
3002
  plan.newFiles.push(["_data/nav.yml", `the nav from ${configFile} (${entries2} entries), for \`navTree\``, `# From ${configFile}'s nav, by ssqch scout: titles as the nav gives them, or each page's first heading.
2978
3003
  ${dumpYaml(nav)}`]);
2979
3004
  } else plan.byHand.push([configFile, "no `nav`: MkDocs builds the sidebar from the folders; ssqch's is `_data/nav.yml` (`navTree`) or `pagesTree(collections.all)`", { code: "mkdocs-nav", status: "ssqch", docs: "navTree" }]);
3005
+ for (const entry of plan.byHand) {
3006
+ const meta = entry[2];
3007
+ if (meta?.option && /admonitions: "mkdocs"|tabs: "mkdocs"|sourceLinks: "relative"|headingIds: "python-markdown"|dialect: "python-markdown"/.test(meta.option)) entry[2] = { ...meta, defines: ["plugin:fromMkdocs", ...meta.defines ?? []] };
3008
+ }
2980
3009
  return plan;
2981
3010
  }
2982
3011
  function dumpYaml(nav, indent = "") {
@@ -3063,16 +3092,17 @@ function vitepress(dir) {
3063
3092
  const dialect = 'markdown: { dialect: "vitepress" }';
3064
3093
  const item = (pattern, what, say, todo, inProse = true) => {
3065
3094
  const { n, files, first } = count(pattern, inProse);
3066
- if (first) plan.byHand.push([first, `${what} (${uses(n, files)}): ${say}`, { ...todo, count: n, files }]);
3095
+ const own = todo.option === dialect ? { defines: ["plugin:fromVitepress", ...todo.defines ?? []] } : {};
3096
+ if (first) plan.byHand.push([first, `${what} (${uses(n, files)}): ${say}`, { ...todo, ...own, count: n, files }]);
3067
3097
  };
3068
- item(/^<script\b[^>]*>/m, "Vue's `<script setup>` and `<script>` blocks in pages", 'VitePress compiles them and writes none of it; `dialect: "vitepress"` leaves them out (the components they import are listed one by one)', { code: "vitepress-script-setup", status: "option", option: dialect });
3069
- item(/^<style\b[^>]*>/m, "`<style>` blocks in pages", 'left out by `dialect: "vitepress"`; put the CSS in the site\'s stylesheet', { code: "vitepress-style", status: "option", option: dialect });
3070
- item(/<ClientOnly>/, "`<ClientOnly>`", 'renders nothing on the server: `dialect: "vitepress"` leaves it out; what\'s inside needs JavaScript in the browser (a custom element from `ssqch/elements`)', { code: "vitepress-client-only", status: "option", option: dialect });
3071
- item(/^[ \t]{1,3}:{3,}[ \t]*$/m, "a container's closing `:::` indented under a list (Prettier's)", 'markdown-it-container closes the container there; so does `containers: "markdown-it"`, which `dialect: "vitepress"` turns on', { code: "vitepress-indented-container", status: "option", option: dialect });
3072
- item(/^:::+\s*(?:tip|info|warning|danger|details|raw)\b/m, "containers (`::: tip`)", 'VitePress\'s markup and default titles, built into `dialect: "vitepress"`', { code: "vitepress-containers", status: "option", option: dialect });
3073
- item(/^:::+\s*code-group\b/m, "code groups (`::: code-group`)", 'built into `dialect: "vitepress"`', { code: "vitepress-code-group", status: "option", option: dialect });
3074
- item(/^\s*(?:`{3,}|~{3,})\s*[\w-]+-vue\b/m, "`-vue` fences (Vue's `{{ }}` evaluated in them)", '`dialect: "vitepress"` prints their string literals; anything else stays as written', { code: "vitepress-vue-fences", status: "option", option: dialect }, false);
3075
- item(/^\[\[toc\]\]\s*$/im, "`[[toc]]`", 'markdown-it-table-of-contents\' list, built into `dialect: "vitepress"`', { code: "vitepress-toc", status: "option", option: dialect });
3098
+ item(/^<script\b[^>]*>/m, "Vue's `<script setup>` and `<script>` blocks in pages", "VitePress compiles them and writes none of it; `fromVitepress()` leaves them out (the components they import are listed one by one)", { code: "vitepress-script-setup", status: "option", option: dialect });
3099
+ item(/^<style\b[^>]*>/m, "`<style>` blocks in pages", "left out by `fromVitepress()`; put the CSS in the site's stylesheet", { code: "vitepress-style", status: "option", option: dialect });
3100
+ item(/<ClientOnly>/, "`<ClientOnly>`", "renders nothing on the server: `fromVitepress()` leaves it out; what's inside needs JavaScript in the browser (a custom element from `ssqch/elements`)", { code: "vitepress-client-only", status: "option", option: dialect });
3101
+ item(/^[ \t]{1,3}:{3,}[ \t]*$/m, "a container's closing `:::` indented under a list (Prettier's)", "markdown-it-container closes the container there, and so does ssqch's `:::`", { code: "vitepress-indented-container", status: "option", option: dialect });
3102
+ item(/^:::+\s*(?:tip|info|warning|danger|details|raw)\b/m, "containers (`::: tip`)", "VitePress's markup and default titles, built into `fromVitepress()`", { code: "vitepress-containers", status: "option", option: dialect });
3103
+ item(/^:::+\s*code-group\b/m, "code groups (`::: code-group`)", "built into `fromVitepress()`", { code: "vitepress-code-group", status: "option", option: dialect });
3104
+ item(/^\s*(?:`{3,}|~{3,})\s*[\w-]+-vue\b/m, "`-vue` fences (Vue's `{{ }}` evaluated in them)", "`fromVitepress()` prints their string literals; anything else stays as written", { code: "vitepress-vue-fences", status: "option", option: dialect }, false);
3105
+ item(/^\[\[toc\]\]\s*$/im, "`[[toc]]`", "markdown-it-table-of-contents' list, built into `fromVitepress()`", { code: "vitepress-toc", status: "option", option: dialect });
3076
3106
  item(/^<<<\s*@\//m, "`<<< @/` code snippets from files", "not in ssqch yet as written: an include in a template engine, or the code copied into a fence", { code: "vitepress-snippets", status: "not-yet" });
3077
3107
  item(/\{\{[^}]*\}\}/, "Vue interpolations in pages (`{{ count }}`, `{{ $frontmatter.title }}`)", 'Vue renders these; with `markdownEngine: false` (in the draft) ssqch prints them as written. Write the text itself, or move the part into a `.vue` component of its own that `vuePlugin()` renders (`ssqch docs "inline vue in pages"`)', { code: "vitepress-interpolations", status: "site", docs: "inline vue in pages" });
3078
3108
  item(/^<(?![A-Z])[a-z][\w-]*\b[^>\n]*\s(?:v-[\w:-]+|@[\w.-]+)(?:=|[\s>])/m, "Vue directives on HTML in pages (`v-if`, `@click`)", "they do something in the browser that ssqch's HTML doesn't: a custom element from `ssqch/elements` for that part", { code: "vitepress-directives", status: "site" });
@@ -3132,7 +3162,7 @@ function vitepress(dir) {
3132
3162
  const clean = /\bcleanUrls\s*:\s*true\b/.test(configText);
3133
3163
  if (!clean) plan.byHand.push([configFile, '`cleanUrls` is off (VitePress\'s default), so pages are `/guide/intro.html`: `urls: "html"` (in the draft)', { code: "vitepress-urls", status: "option", option: 'urls: "html"' }]);
3134
3164
  const hostname = /\bsitemap\s*:\s*\{[^}]*\bhostname\s*:\s*["'`]([^"'`]+)["'`]/.exec(configText)?.[1];
3135
- if (hostname) plan.byHand.push([configFile, `\`sitemap\`: \`sitemapPlugin({ url: "${hostname}", format: "vitepress" })\` writes the same file (in the draft)`, { code: "vitepress-sitemap", status: "ssqch", defines: ["plugin:ssqch/sitemap"] }]);
3165
+ if (hostname) plan.byHand.push([configFile, `\`sitemap\`: \`sitemapPlugin({ url: "${hostname}" })\` (in the draft) lists the same URLs; the file is ssqch's own, so \`ssqch diff\` shows sitemap.xml as changed`, { code: "vitepress-sitemap", status: "ssqch", defines: ["plugin:ssqch/sitemap"] }]);
3136
3166
  const head = /\bhead\s*:\s*\[/.exec(configText);
3137
3167
  if (head) {
3138
3168
  const close = closingBracket(configText, head.index + head[0].length - 1);
@@ -3144,7 +3174,7 @@ function vitepress(dir) {
3144
3174
  if (/\bthemeConfig\b[\s\S]*\b(?:sidebar|nav)\s*:/.test(configText)) plan.byHand.push([configFile, "`themeConfig`'s `nav` and `sidebar`: data for ssqch's layout. Move them to a `_data/*.js` file that the VitePress config imports too, so both read one list; `navTree` marks the page you're on (a sidebar keyed by path picks the longest key that the page's URL starts with)", { code: "vitepress-sidebar", status: "site", docs: "navTree" }]);
3145
3175
  }
3146
3176
  for (const pkg of packagesLike(dir, /^vitepress-plugin-|^@?[\w-]*\/?vitepress-plugin-/)) {
3147
- const say = /llms/.test(pkg) ? '`llms.txt`, a Markdown copy of each page and `llms-full.txt`: `llmsPlugin()` from "ssqch/llms"' : /group-icons/.test(pkg) ? "icons on code groups' tabs: its CSS keyed by the tab's label (`data-title`), which `dialect: \"vitepress\"` writes" : "not in ssqch yet: port what it does as a hook, a transform or a plugin";
3177
+ const say = /llms/.test(pkg) ? '`llms.txt`, a Markdown copy of each page and `llms-full.txt`: `llmsPlugin()` from "ssqch/llms"' : /group-icons/.test(pkg) ? "icons on code groups' tabs: its CSS keyed by the tab's label (`data-title`), which `fromVitepress()` writes" : "not in ssqch yet: port what it does as a hook, a transform or a plugin";
3148
3178
  plan.byHand.push(["package.json", `${pkg}: ${say}`, { code: "vitepress-plugin", status: /group-icons|llms/.test(pkg) ? "ssqch" : "site", .../llms/.test(pkg) ? { defines: ["plugin:ssqch/llms"] } : {} }]);
3149
3179
  }
3150
3180
  if (themeIndex !== void 0) {
@@ -3169,6 +3199,7 @@ function vitepress(dir) {
3169
3199
  ...hostname ? ['import { sitemapPlugin } from "ssqch/sitemap";'] : [],
3170
3200
  ...vue ? ['import { vuePlugin } from "ssqch/vue";'] : [],
3171
3201
  ...llms ? ['import { llmsPlugin } from "ssqch/llms";'] : [],
3202
+ 'import { fromVitepress } from "ssqch/from-vitepress";',
3172
3203
  "",
3173
3204
  "export default {",
3174
3205
  ` dirs: { input: ${JSON.stringify(src)}, output: "dist" },`,
@@ -3179,17 +3210,19 @@ function vitepress(dir) {
3179
3210
  " // VitePress's data loaders, `srcExclude`, its own folder, and `public/` (copied below).",
3180
3211
  ` ignore: [${ignore.join(", ")}],`,
3181
3212
  ...isDir(path.join(dir, ...publicDir.split("/"))) ? [` passthrough: { ${JSON.stringify(`${publicDir}/**`)}: "." },`] : [],
3182
- ' markdown: { dialect: "vitepress", highlight: true },',
3183
- ...hostname || vue || llms ? [
3213
+ " markdown: { highlight: true },",
3214
+ ...[
3184
3215
  " plugins: [",
3216
+ " // VitePress's Markdown: its containers, headings, links, code blocks and `[[toc]]`.",
3217
+ " fromVitepress(),",
3185
3218
  ...vue ? [
3186
3219
  " // The Vue components the pages use, rendered with the site's Vite and Vue (and run in the browser with `hydrate`).",
3187
3220
  ` vuePlugin({ ${vueGlobals.length ? `components: { ${vueGlobals.map(([n, f]) => `${n}: ${JSON.stringify(f)}`).join(", ")} }${stateful ? ", " : ""}` : ""}${stateful ? 'hydrate: "visible"' : ""} }),`
3188
3221
  ] : [],
3189
- ...hostname ? [` sitemapPlugin({ url: ${JSON.stringify(hostname)}, format: "vitepress" }),`] : [],
3222
+ ...hostname ? [` sitemapPlugin({ url: ${JSON.stringify(hostname)} }),`] : [],
3190
3223
  ...llms ? [` llmsPlugin({ ${[siteTitle ? `title: ${JSON.stringify(siteTitle)}` : "", siteDescription ? `description: ${JSON.stringify(siteDescription)}` : "", hostname ? `url: ${JSON.stringify(hostname)}` : ""].filter(Boolean).join(", ")} }),`] : [],
3191
3224
  " ],"
3192
- ] : [],
3225
+ ],
3193
3226
  "};",
3194
3227
  ""
3195
3228
  ];
@@ -3268,5 +3301,6 @@ export {
3268
3301
  unifiedHunks,
3269
3302
  unwrapUrlLiterals,
3270
3303
  vitepress,
3304
+ withoutBlankAfterFrontMatter,
3271
3305
  zola
3272
3306
  };
@@ -9,9 +9,9 @@ import {
9
9
  starterEngines,
10
10
  starterFiles,
11
11
  write
12
- } from "./chunk-LLOA3QXV.js";
12
+ } from "./chunk-FENJHLNM.js";
13
13
  import "./chunk-YCOTX2VM.js";
14
- import "./chunk-R7PBREXL.js";
14
+ import "./chunk-YNJNMQWU.js";
15
15
  import "./chunk-VJWQSYEG.js";
16
16
  import "./chunk-I3PS26CI.js";
17
17
  export {
@@ -1,8 +1,8 @@
1
1
  import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
- import "./chunk-DOHOKUGB.js";
4
- import "./chunk-GWWA5Y3X.js";
5
- import "./chunk-EVFNYUTR.js";
3
+ import "./chunk-VILOEVK7.js";
4
+ import "./chunk-ULCT3PAV.js";
5
+ import "./chunk-6U5VIQVY.js";
6
6
  import "./chunk-AD3HAW3W.js";
7
7
  import "./chunk-YCOTX2VM.js";
8
8
  import {
@@ -11,13 +11,13 @@ import {
11
11
  } from "./chunk-DDV6JEC2.js";
12
12
  import {
13
13
  slugWith
14
- } from "./chunk-RY3KLUQ3.js";
14
+ } from "./chunk-6OUCRDYI.js";
15
+ import "./chunk-SPIFZBIW.js";
15
16
  import "./chunk-FVZ5JBRI.js";
16
- import "./chunk-Z3XH4KWX.js";
17
17
  import {
18
18
  FIELD_NOTES
19
- } from "./chunk-UU43WIZG.js";
20
- import "./chunk-57HLSKZS.js";
19
+ } from "./chunk-FJML7INB.js";
20
+ import "./chunk-4AZFCSGJ.js";
21
21
  import {
22
22
  serdeFloat
23
23
  } from "./chunk-CMUWRPSQ.js";
@@ -25,7 +25,7 @@ import {
25
25
  bail,
26
26
  context,
27
27
  parseFrontMatter
28
- } from "./chunk-R7PBREXL.js";
28
+ } from "./chunk-YNJNMQWU.js";
29
29
  import {
30
30
  isDir,
31
31
  isFile,
@@ -6,14 +6,14 @@ import {
6
6
  fingerprint,
7
7
  isAsset,
8
8
  sameStamps
9
- } from "./chunk-IZCF4UH3.js";
9
+ } from "./chunk-FQZDUDFK.js";
10
10
  import {
11
11
  commandLine
12
12
  } from "./chunk-4Q6WMTER.js";
13
13
  import {
14
14
  Builder,
15
15
  stopBuilders
16
- } from "./chunk-JUALMFW3.js";
16
+ } from "./chunk-ER72RPD6.js";
17
17
  import {
18
18
  CONFIG_FILES,
19
19
  dirsOf
@@ -25,7 +25,7 @@ import {
25
25
  CAMPSITE_DISTURBED,
26
26
  FRESH_TRACKS,
27
27
  SQUATCH_WATCH
28
- } from "./chunk-UU43WIZG.js";
28
+ } from "./chunk-FJML7INB.js";
29
29
  import {
30
30
  BuildError,
31
31
  aliasesUsed,
@@ -34,7 +34,7 @@ import {
34
34
  red,
35
35
  warn,
36
36
  warning
37
- } from "./chunk-R7PBREXL.js";
37
+ } from "./chunk-YNJNMQWU.js";
38
38
  import {
39
39
  isInside,
40
40
  realPath,
@@ -307,6 +307,8 @@ function contentType(file) {
307
307
  return "application/xml; charset=utf-8";
308
308
  case "txt":
309
309
  return "text/plain; charset=utf-8";
310
+ case "md":
311
+ return "text/markdown; charset=utf-8";
310
312
  case "svg":
311
313
  return "image/svg+xml";
312
314
  case "png":
@@ -332,6 +334,25 @@ function contentType(file) {
332
334
  return "application/octet-stream";
333
335
  }
334
336
  }
337
+ function prefersMarkdown(accept) {
338
+ if (!accept) return false;
339
+ const q = /* @__PURE__ */ new Map();
340
+ for (const part of accept.split(",")) {
341
+ const [type, ...params] = part.split(";").map((p) => p.trim().toLowerCase());
342
+ if (!type) continue;
343
+ const given = params.find((p) => p.startsWith("q="));
344
+ const value = given === void 0 ? 1 : Number(given.slice(2));
345
+ q.set(type, Number.isFinite(value) ? value : 0);
346
+ }
347
+ const markdown = q.get("text/markdown") ?? 0;
348
+ const html = q.get("text/html") ?? q.get("text/*") ?? q.get("*/*") ?? 0;
349
+ return markdown > 0 && markdown >= html;
350
+ }
351
+ function copyOf(file) {
352
+ if (!/\.html?$/.test(file)) return void 0;
353
+ const copy = file.replace(/\.html?$/, ".md");
354
+ return isFile(copy) ? copy : void 0;
355
+ }
335
356
  function linksAnIcon(html) {
336
357
  return /<link\b[^>]*\brel\s*=\s*["']?[^"'>]*\bicon\b/is.test(html);
337
358
  }
@@ -404,6 +425,8 @@ function handle(req, res, root, live, base) {
404
425
  const url = at.path;
405
426
  const found = locate(res, root, rawUrl, url);
406
427
  if (!found) return;
428
+ const copy = found.status === 200 ? copyOf(found.file) : void 0;
429
+ if (copy && prefersMarkdown(req.headers.accept)) return respond(res, 200, { "Content-Type": "text/markdown; charset=utf-8", Vary: "Accept", ...noCache, "X-Powered-By": "pine cones" }, read(copy) ?? "");
407
430
  let body = read(found.file);
408
431
  let ctype = contentType(found.file);
409
432
  if (!body) {
@@ -420,7 +443,7 @@ function handle(req, res, root, live, base) {
420
443
  const end = html.lastIndexOf("</body>");
421
444
  body = Buffer.from(end === -1 ? `${html}<script>${LIVE_SCRIPT}</script>` : `${html.slice(0, end)}<script>${LIVE_SCRIPT}</script>${html.slice(end)}`);
422
445
  }
423
- respond(res, found.status, { "Content-Type": ctype, ...noCache, "X-Powered-By": "pine cones" }, body);
446
+ respond(res, found.status, { "Content-Type": ctype, ...copy ? { Vary: "Accept" } : {}, ...noCache, "X-Powered-By": "pine cones" }, body);
424
447
  }
425
448
  function takesGzip(req) {
426
449
  return String(req.headers["accept-encoding"] ?? "").split(",").some((encoding) => encoding.trim().split(";")[0] === "gzip");
@@ -433,8 +456,10 @@ function handleBuilt(req, res, root, base) {
433
456
  if ("redirect" in at) return respond(res, 302, { Location: at.redirect });
434
457
  const found = locate(res, root, rawUrl, at.path);
435
458
  if (!found) return;
436
- let body = read(found.file);
437
- let ctype = contentType(found.file);
459
+ const copy = found.status === 200 ? copyOf(found.file) : void 0;
460
+ const markdown = copy !== void 0 && prefersMarkdown(req.headers.accept);
461
+ let body = read(markdown ? copy : found.file);
462
+ let ctype = markdown ? "text/markdown; charset=utf-8" : contentType(found.file);
438
463
  if (!body) {
439
464
  body = Buffer.from(`Not found: ${fullUrl}`);
440
465
  ctype = "text/plain; charset=utf-8";
@@ -442,7 +467,7 @@ function handleBuilt(req, res, root, base) {
442
467
  const compressible = ctype.startsWith("text/") || ctype.startsWith("application/json") || ctype.startsWith("application/xml") || ctype === "image/svg+xml";
443
468
  const gzip = compressible && body.length > 256 && takesGzip(req);
444
469
  const headers = { "Content-Type": ctype };
445
- if (compressible) headers.Vary = "Accept-Encoding";
470
+ if (compressible) headers.Vary = copy ? "Accept, Accept-Encoding" : "Accept-Encoding";
446
471
  if (gzip) headers["Content-Encoding"] = "gzip";
447
472
  respond(res, found.status, headers, gzip ? zlib.gzipSync(body) : body);
448
473
  }