@heroiclands/package-build 23.12.8 → 24.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (258) hide show
  1. package/CHANGELOG.md +84 -0
  2. package/README.md +3 -2
  3. package/assets/preview/gitea.ini +12 -7
  4. package/assets/styles/content-base.css +293 -24
  5. package/bin/content-commands.mjs +370 -213
  6. package/bin/package-build-preview.mjs +2 -2
  7. package/bin/package-build.mjs +3 -2
  8. package/ci/check-banners.mjs +7 -7
  9. package/config.mjs +21 -6
  10. package/content-config.mjs +199 -80
  11. package/docs/api.md +110 -89
  12. package/docs/authoring/links-and-markup.md +469 -97
  13. package/docs/commands.md +259 -78
  14. package/docs/configuration.md +211 -103
  15. package/docs/content-format.md +4 -4
  16. package/docs/diagnostics.md +44 -2
  17. package/docs/getting-started.md +1 -1
  18. package/docs/guides/icons.md +1 -1
  19. package/docs/guides/module-project.md +5 -8
  20. package/docs/guides/release-and-deploy.md +2 -2
  21. package/docs/guides/site.md +112 -23
  22. package/docs/guides/system-project.md +1 -1
  23. package/docs/guides/writing-in-invented-scripts.md +1247 -0
  24. package/docs/index.md +1 -0
  25. package/docs/project-setup.md +28 -30
  26. package/docs/reference/format-details.md +677 -319
  27. package/docs/reference/note-types.md +47 -10
  28. package/docs/reference/theme-pages.md +178 -108
  29. package/docs/source-preview.md +16 -2
  30. package/engine/anchors.mjs +2 -2
  31. package/engine/asset-shipping.mjs +22 -10
  32. package/engine/base-compiler.mjs +62 -104
  33. package/engine/changelog-lint.mjs +1 -1
  34. package/engine/code-fences.mjs +3 -3
  35. package/engine/content-address.mjs +1 -1
  36. package/engine/content-alerts.mjs +8 -4
  37. package/engine/content-blocks.mjs +29 -14
  38. package/engine/content-embeds.mjs +1 -1
  39. package/engine/content-expand.mjs +376 -0
  40. package/engine/content-figures.mjs +18 -11
  41. package/engine/content-format.yaml +8 -0
  42. package/engine/content-glyphs.mjs +213 -0
  43. package/engine/content-images.mjs +6 -7
  44. package/engine/content-index.mjs +1 -1
  45. package/engine/content-links.mjs +3 -3
  46. package/engine/content-lint.mjs +1 -1
  47. package/engine/content-render.mjs +453 -0
  48. package/engine/content-scripts.mjs +376 -43
  49. package/engine/content-spans.mjs +6 -3
  50. package/engine/content-styles.mjs +91 -0
  51. package/engine/content-symbols.mjs +186 -0
  52. package/engine/content-verse.mjs +738 -0
  53. package/engine/core-report.mjs +169 -0
  54. package/engine/core-vocabulary.mjs +208 -0
  55. package/engine/dictionary-html.mjs +119 -0
  56. package/engine/dictionary-rows.mjs +15 -4
  57. package/engine/field-reference.mjs +5 -5
  58. package/engine/first-use.mjs +17 -27
  59. package/engine/frontmatter-lint.mjs +1 -1
  60. package/engine/heading-attributes.mjs +89 -0
  61. package/engine/helpers.mjs +61 -101
  62. package/engine/homepage.mjs +17 -29
  63. package/engine/html-minify.mjs +70 -0
  64. package/engine/index.mjs +8 -5
  65. package/engine/key-case-collisions.mjs +136 -0
  66. package/engine/language-data.mjs +203 -6
  67. package/engine/language-rows.mjs +8 -2
  68. package/engine/language-terms.mjs +186 -16
  69. package/engine/language-words.mjs +12 -0
  70. package/engine/logographic.mjs +255 -0
  71. package/engine/map-lexicon.mjs +262 -47
  72. package/engine/map-places.mjs +5 -4
  73. package/engine/markdown-expressions.mjs +0 -2
  74. package/engine/markdownlint-run.mjs +9 -3
  75. package/engine/markup-validation.mjs +21 -0
  76. package/engine/metre-declaration.mjs +134 -0
  77. package/engine/names.mjs +36 -9
  78. package/engine/note-matter.mjs +66 -0
  79. package/engine/note-vocabulary.mjs +187 -3
  80. package/engine/pdf-build.mjs +69 -133
  81. package/engine/pdf-render.mjs +205 -58
  82. package/engine/post-fields.mjs +157 -0
  83. package/engine/preview-index.mjs +130 -0
  84. package/engine/preview-source.mjs +450 -0
  85. package/engine/project-init.mjs +5 -12
  86. package/engine/prose-config.mjs +3 -3
  87. package/engine/read-stdin.mjs +29 -0
  88. package/engine/run-rows.mjs +2 -2
  89. package/engine/run-words.mjs +6 -112
  90. package/engine/script-emphasis-terms.mjs +38 -0
  91. package/engine/script-emphasis.mjs +295 -0
  92. package/engine/script-font-delivery.mjs +4 -4
  93. package/engine/site-build.mjs +260 -315
  94. package/engine/site-config.mjs +26 -238
  95. package/engine/site-files.mjs +175 -0
  96. package/engine/site-index.mjs +9 -4
  97. package/engine/site-preview.mjs +52 -525
  98. package/engine/site-render.mjs +593 -0
  99. package/engine/site-root.mjs +22 -13
  100. package/engine/site-search.mjs +161 -0
  101. package/engine/site-serve.mjs +273 -0
  102. package/engine/site-theme-banner.mjs +154 -0
  103. package/engine/site-theme-urls.mjs +125 -0
  104. package/engine/site-theme.mjs +926 -0
  105. package/engine/sql-tables.mjs +20 -3
  106. package/engine/text-maps.mjs +57 -10
  107. package/engine/typographer.mjs +248 -0
  108. package/engine/verse-metre.mjs +357 -0
  109. package/engine/wikilink-syntax.mjs +29 -47
  110. package/engine/wikilinks.mjs +758 -279
  111. package/engine/word-forms.mjs +364 -0
  112. package/engine/word-rows.mjs +12 -2
  113. package/engine/word-terms.mjs +38 -4
  114. package/manifest.mjs +3 -4
  115. package/package.json +11 -8
  116. package/{hugo-theme → site-theme}/data/banners.yaml +6 -10
  117. package/site-theme/layouts/base.hbs +31 -0
  118. package/site-theme/layouts/blog-list.hbs +30 -0
  119. package/site-theme/layouts/blog-post.hbs +40 -0
  120. package/site-theme/layouts/home.hbs +35 -0
  121. package/site-theme/layouts/list.hbs +20 -0
  122. package/site-theme/layouts/not-found.hbs +31 -0
  123. package/site-theme/layouts/page.hbs +7 -0
  124. package/site-theme/partials/copy-buttons.hbs +37 -0
  125. package/site-theme/partials/draft-notice.hbs +5 -0
  126. package/site-theme/partials/exturl.hbs +2 -0
  127. package/{hugo-theme/layouts/partials/footer.html → site-theme/partials/footer.hbs} +10 -7
  128. package/site-theme/partials/header.hbs +44 -0
  129. package/site-theme/partials/hero-banner.hbs +11 -0
  130. package/site-theme/partials/infobox-entry.hbs +2 -0
  131. package/site-theme/partials/infobox-section.hbs +31 -0
  132. package/site-theme/partials/infobox-value.hbs +2 -0
  133. package/site-theme/partials/infobox.hbs +18 -0
  134. package/site-theme/partials/list-members.hbs +9 -0
  135. package/site-theme/partials/nav-links.hbs +5 -0
  136. package/site-theme/partials/page-body.hbs +48 -0
  137. package/site-theme/partials/page-list.hbs +14 -0
  138. package/site-theme/partials/related.hbs +24 -0
  139. package/site-theme/partials/search-meta.hbs +6 -0
  140. package/site-theme/partials/search-names.hbs +2 -0
  141. package/site-theme/partials/search.hbs +52 -0
  142. package/site-theme/partials/tags.hbs +4 -0
  143. package/site-theme/partials/toc.hbs +7 -0
  144. package/{hugo-theme → site-theme}/static/css/style.css +106 -14
  145. package/stage.mjs +1 -2
  146. package/types/config.d.mts +8 -4
  147. package/types/content-config.d.mts +15 -15
  148. package/types/engine/asset-shipping.d.mts +5 -2
  149. package/types/engine/base-compiler.d.mts +20 -2
  150. package/types/engine/code-fences.d.mts +3 -3
  151. package/types/engine/content-address.d.mts +1 -1
  152. package/types/engine/content-alerts.d.mts +8 -2
  153. package/types/engine/content-blocks.d.mts +11 -4
  154. package/types/engine/content-expand.d.mts +288 -0
  155. package/types/engine/content-figures.d.mts +11 -3
  156. package/types/engine/content-glyphs.d.mts +85 -0
  157. package/types/engine/content-images.d.mts +6 -7
  158. package/types/engine/content-links.d.mts +1 -1
  159. package/types/engine/content-render.d.mts +199 -0
  160. package/types/engine/content-scripts.d.mts +70 -4
  161. package/types/engine/content-spans.d.mts +1 -1
  162. package/types/engine/content-styles.d.mts +33 -0
  163. package/types/engine/content-symbols.d.mts +35 -0
  164. package/types/engine/content-verse.d.mts +240 -0
  165. package/types/engine/core-report.d.mts +45 -0
  166. package/types/engine/core-vocabulary.d.mts +53 -0
  167. package/types/engine/dictionary-html.d.mts +8 -0
  168. package/types/engine/dictionary-rows.d.mts +10 -0
  169. package/types/engine/field-reference.d.mts +2 -2
  170. package/types/engine/heading-attributes.d.mts +20 -0
  171. package/types/engine/helpers.d.mts +3 -10
  172. package/types/engine/homepage.d.mts +11 -24
  173. package/types/engine/html-minify.d.mts +9 -0
  174. package/types/engine/index.d.mts +2 -1
  175. package/types/engine/key-case-collisions.d.mts +28 -0
  176. package/types/engine/language-data.d.mts +0 -2
  177. package/types/engine/language-terms.d.mts +24 -2
  178. package/types/engine/logographic.d.mts +45 -0
  179. package/types/engine/map-lexicon.d.mts +66 -13
  180. package/types/engine/map-places.d.mts +8 -0
  181. package/types/engine/markdown-expressions.d.mts +0 -2
  182. package/types/engine/metre-declaration.d.mts +39 -0
  183. package/types/engine/names.d.mts +34 -3
  184. package/types/engine/note-matter.d.mts +48 -0
  185. package/types/engine/pdf-render.d.mts +6 -2
  186. package/types/engine/post-fields.d.mts +44 -0
  187. package/types/engine/preview-index.d.mts +72 -0
  188. package/types/engine/preview-source.d.mts +51 -0
  189. package/types/engine/read-stdin.d.mts +11 -0
  190. package/types/engine/run-rows.d.mts +2 -2
  191. package/types/engine/run-words.d.mts +0 -15
  192. package/types/engine/script-emphasis-terms.d.mts +21 -0
  193. package/types/engine/script-emphasis.d.mts +84 -0
  194. package/types/engine/script-font-delivery.d.mts +4 -4
  195. package/types/engine/site-build.d.mts +71 -113
  196. package/types/engine/site-config.d.mts +14 -134
  197. package/types/engine/site-files.d.mts +73 -0
  198. package/types/engine/site-index.d.mts +11 -3
  199. package/types/engine/site-preview.d.mts +15 -19
  200. package/types/engine/site-render.d.mts +171 -0
  201. package/types/engine/site-root.d.mts +12 -4
  202. package/types/engine/site-search.d.mts +54 -0
  203. package/types/engine/site-serve.d.mts +44 -0
  204. package/types/engine/site-theme-banner.d.mts +51 -0
  205. package/types/engine/site-theme-urls.d.mts +60 -0
  206. package/types/engine/site-theme.d.mts +127 -0
  207. package/types/engine/sql-tables.d.mts +4 -1
  208. package/types/engine/text-maps.d.mts +17 -3
  209. package/types/engine/typographer.d.mts +11 -0
  210. package/types/engine/verse-metre.d.mts +131 -0
  211. package/types/engine/wikilink-syntax.d.mts +30 -48
  212. package/types/engine/wikilinks.d.mts +330 -14
  213. package/types/engine/word-forms.d.mts +83 -0
  214. package/types/manifest.d.mts +3 -4
  215. package/types/stage.d.mts +1 -2
  216. package/types/vendor/markdownlint.d.mts +8 -0
  217. package/vendor/markdownlint.mjs +20388 -0
  218. package/engine/content-poetry.mjs +0 -240
  219. package/engine/web-wikilinks.mjs +0 -594
  220. package/hugo-theme/layouts/404.html +0 -85
  221. package/hugo-theme/layouts/_default/baseof.html +0 -67
  222. package/hugo-theme/layouts/_default/list.html +0 -139
  223. package/hugo-theme/layouts/_default/single.html +0 -4
  224. package/hugo-theme/layouts/blog/list.html +0 -54
  225. package/hugo-theme/layouts/blog-post/single.html +0 -36
  226. package/hugo-theme/layouts/index.html +0 -75
  227. package/hugo-theme/layouts/partials/banner-url.html +0 -141
  228. package/hugo-theme/layouts/partials/cdn-url.html +0 -36
  229. package/hugo-theme/layouts/partials/dictionary-lists.html +0 -58
  230. package/hugo-theme/layouts/partials/draft-notice.html +0 -41
  231. package/hugo-theme/layouts/partials/draft-state.html +0 -26
  232. package/hugo-theme/layouts/partials/header.html +0 -35
  233. package/hugo-theme/layouts/partials/hero-banner.html +0 -85
  234. package/hugo-theme/layouts/partials/infobox/entry.html +0 -18
  235. package/hugo-theme/layouts/partials/infobox/items.html +0 -26
  236. package/hugo-theme/layouts/partials/infobox/section.html +0 -56
  237. package/hugo-theme/layouts/partials/infobox/value.html +0 -43
  238. package/hugo-theme/layouts/partials/infobox.html +0 -57
  239. package/hugo-theme/layouts/partials/page-body.html +0 -152
  240. package/hugo-theme/layouts/partials/related.html +0 -138
  241. package/hugo-theme/layouts/partials/search.html +0 -84
  242. package/hugo-theme/layouts/partials/site-url.html +0 -32
  243. package/hugo-theme/layouts/partials/tags.html +0 -30
  244. package/hugo-theme/layouts/partials/toc.html +0 -28
  245. package/hugo-theme/layouts/partials/warn-missing-banner.html +0 -3
  246. package/hugo-theme/layouts/shortcodes/cartouche.html +0 -64
  247. package/hugo-theme/layouts/shortcodes/exturl.html +0 -12
  248. package/hugo-theme/layouts/shortcodes/glyph.html +0 -43
  249. package/hugo-theme/layouts/shortcodes/pagelist.html +0 -63
  250. package/hugo-theme/theme.toml +0 -11
  251. package/types/engine/content-poetry.d.mts +0 -58
  252. package/types/engine/web-wikilinks.d.mts +0 -107
  253. /package/{hugo-theme → site-theme}/data/banner-kinds.yaml +0 -0
  254. /package/{hugo-theme → site-theme}/static/css/sohl-icons.css +0 -0
  255. /package/{hugo-theme → site-theme}/static/fonts/game-icons-kb.woff2 +0 -0
  256. /package/{hugo-theme → site-theme}/static/img/banners/takheperu-hieroglyphs.svg +0 -0
  257. /package/{hugo-theme → site-theme}/static/img/cartouches/takheperu.svg +0 -0
  258. /package/{hugo-theme → site-theme}/static/js/inline-spoilers.js +0 -0
@@ -0,0 +1,72 @@
1
+ /**
2
+ * What a preview reads to render with an index.
3
+ *
4
+ * @typedef {object} PreviewIndex
5
+ * @property {object} runs - The package's languages, faces and maps.
6
+ * @property {object|undefined} icons - The package's icon registry.
7
+ * @property {(src: string) => ({role?: string, width?: number|"", height?: number|""}|undefined)} lookupAsset -
8
+ * From a picture's address to its asset.
9
+ * @property {(src: string) => string} resolveSrc - From a picture's authored
10
+ * pathname to the address the website serves it at.
11
+ * @property {(markdown: string, note: {fm: object, file?: string}) => {markdown: string, figures: object[]}} expand -
12
+ * Expand a buffer's body as the website expands a page: links, embeds,
13
+ * expressions and figure numbers resolved. A query, which a buffer cannot
14
+ * answer, is left as written.
15
+ */
16
+ /**
17
+ * Build the object a preview with an index renders from.
18
+ *
19
+ * @param {object} options
20
+ * @param {object} options.config - The resolved package configuration.
21
+ * @param {object[]} options.records - The content index's records: every note
22
+ * and every asset.
23
+ * @param {object} [options.foreign] - The dependencies' indexes, as
24
+ * {@link module:engine/metadata-index.loadForeignIndexes} returns them.
25
+ * Omitted, the package links only to itself.
26
+ * @returns {PreviewIndex} The index.
27
+ */
28
+ export function previewIndex({ config, records, foreign }: {
29
+ config: object;
30
+ records: object[];
31
+ foreign?: object | undefined;
32
+ }): PreviewIndex;
33
+ /**
34
+ * What a preview reads to render with an index.
35
+ */
36
+ export type PreviewIndex = {
37
+ /**
38
+ * - The package's languages, faces and maps.
39
+ */
40
+ runs: object;
41
+ /**
42
+ * - The package's icon registry.
43
+ */
44
+ icons: object | undefined;
45
+ /**
46
+ * -
47
+ * From a picture's address to its asset.
48
+ */
49
+ lookupAsset: (src: string) => ({
50
+ role?: string;
51
+ width?: number | "";
52
+ height?: number | "";
53
+ } | undefined);
54
+ /**
55
+ * - From a picture's authored
56
+ * pathname to the address the website serves it at.
57
+ */
58
+ resolveSrc: (src: string) => string;
59
+ /**
60
+ * -
61
+ * Expand a buffer's body as the website expands a page: links, embeds,
62
+ * expressions and figure numbers resolved. A query, which a buffer cannot
63
+ * answer, is left as written.
64
+ */
65
+ expand: (markdown: string, note: {
66
+ fm: object;
67
+ file?: string;
68
+ }) => {
69
+ markdown: string;
70
+ figures: object[];
71
+ };
72
+ };
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Highlight a wikilink or an embed without interpreting any Markdown or HTML
3
+ * inside the source.
4
+ *
5
+ * @param {string} raw - The link as written, from `[[` or `![[` to its end.
6
+ * @returns {string} The highlighted source.
7
+ */
8
+ export function wikiSource(raw: string): string;
9
+ /**
10
+ * Install the preview target's rules.
11
+ *
12
+ * @param {import("markdown-it")} md - The shared parser.
13
+ * @param {object} [options]
14
+ * @param {boolean} [options.source] - The buffer has no index: show wikilinks,
15
+ * embeds, spans and local expressions as authored source.
16
+ * @param {object} [options.fm] - The buffer's frontmatter, which a local
17
+ * expression reads.
18
+ * @param {string} [options.file] - The buffer's name, for a finding.
19
+ * @param {Map<string, object>} [options.figures] - The buffer's captioned items
20
+ * by id, which a local `ref` reads.
21
+ */
22
+ export function previewSourcePlugin(md: typeof import("markdown-it"), { source, fm, file, figures }?: {
23
+ source?: boolean | undefined;
24
+ fm?: object | undefined;
25
+ file?: string | undefined;
26
+ figures?: Map<string, object> | undefined;
27
+ }): void;
28
+ /** Explicit dependency policy: a new registered helper requires a preview decision. */
29
+ export const PREVIEW_HELPERS: Readonly<{
30
+ eq: "local";
31
+ gt: "local";
32
+ gte: "local";
33
+ lt: "local";
34
+ lte: "local";
35
+ not: "local";
36
+ and: "local";
37
+ or: "local";
38
+ words: "local";
39
+ digits: "local";
40
+ sql: "dependent";
41
+ dateformat: "dependent";
42
+ ref: "reference";
43
+ }>;
44
+ /**
45
+ * What stands for an authored `<` in the preview between
46
+ * {@link module:engine/content-render.inertHtml} and the rendered HTML, where
47
+ * it is written `&lt;`. A private-use character, so it can neither be read as
48
+ * markup nor collide with prose.
49
+ */
50
+ export const INERT_BRACKET: "\uE000";
51
+ export function colored(role: string, source: string): string;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Reads standard input to its end as UTF-8 text.
3
+ *
4
+ * The stream is read asynchronously, so a pipe whose writer is slower than the
5
+ * reader, or a non-blocking descriptor, delivers the whole input instead of
6
+ * failing with `EAGAIN`.
7
+ *
8
+ * @param {NodeJS.ReadableStream} [stream] The stream to drain; standard input by default.
9
+ * @returns {Promise<string>} The complete input.
10
+ */
11
+ export function readStdin(stream?: NodeJS.ReadableStream): Promise<string>;
@@ -2,7 +2,7 @@
2
2
  * One run as an index record carries it.
3
3
  *
4
4
  * @typedef {object} RecordRun
5
- * @property {"span"|"block"|"poetry"} kind - The construct.
5
+ * @property {"span"|"block"|"verse"} kind - The construct.
6
6
  * @property {string|null} lang - The language it is set in, as written: its
7
7
  * own `lang=`, else the one the div or fence around it states.
8
8
  * @property {string|null} tag - The BCP 47 tag it resolves to, or null.
@@ -57,7 +57,7 @@ export type RecordRun = {
57
57
  /**
58
58
  * - The construct.
59
59
  */
60
- kind: "span" | "block" | "poetry";
60
+ kind: "span" | "block" | "verse";
61
61
  /**
62
62
  * - The language it is set in, as written: its
63
63
  * own `lang=`, else the one the div or fence around it states.
@@ -1,18 +1,3 @@
1
- /**
2
- * A word as it is compared: NFC, lowercase, `’` read as `'`.
3
- *
4
- * @param {string} word - The word.
5
- * @returns {string} Its folded form.
6
- */
7
- export function foldWord(word: string): string;
8
- /**
9
- * The words a language note accepts of its own: its forms, and what its
10
- * plural rows, verb pattern and replacing suffixes derive from them.
11
- *
12
- * @param {Record<string, any>} data - The language note's `data`.
13
- * @returns {Set<string>} The words, folded.
14
- */
15
- export function lexiconWords(data: Record<string, any>): Set<string>;
16
1
  /**
17
2
  * The words of every name a language note registers under a tongue other than
18
3
  * `translation`.
@@ -0,0 +1,21 @@
1
+ /**
2
+ * **The words a script note and a language note state emphasis by.** Read by
3
+ * the vocabulary as it is declared, so this module imports nothing; the
4
+ * checks and the conventions' use are in {@link module:engine/script-emphasis}.
5
+ *
6
+ * @module
7
+ */
8
+ /** The conventions a script states its emphasis by. */
9
+ export const EMPHASIS_CONVENTIONS: readonly string[];
10
+ /** The class each convention gives an `<em>` or a `<strong>`. */
11
+ export const EMPHASIS_CLASSES: Readonly<{
12
+ rubric: "emph-rubric";
13
+ overline: "emph-overline";
14
+ }>;
15
+ /**
16
+ * The conventions a language note states, which override its script's.
17
+ * `words` marks emphasis with a word, so a mark in its text is a finding.
18
+ */
19
+ export const LANGUAGE_EMPHASES: readonly string[];
20
+ /** The `subType` of a script note. */
21
+ export const SCRIPT_SUBTYPE: "script";
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Each face's conventions, from the script notes among the index records. The
3
+ * first note to list a face keeps it; a second is the lint's to report, and a
4
+ * note whose convention is unknown gives none.
5
+ *
6
+ * @param {Iterable<Record<string, any>>|undefined} records - Index records.
7
+ * @returns {Map<string, Emphasis>} The conventions, by face slug.
8
+ */
9
+ export function emphasesFromRecords(records: Iterable<Record<string, any>> | undefined): Map<string, Emphasis>;
10
+ /**
11
+ * The convention each language's note states.
12
+ *
13
+ * @param {ReadonlyMap<string, Record<string, any>>} byName - Each configured
14
+ * language's note record, by language name, from
15
+ * {@link module:engine/map-lexicon.languageRecordsByName}.
16
+ * @returns {Map<string, LanguageEmphasis>} The conventions, by language name;
17
+ * a language whose note states none, or one the build does not know, is
18
+ * absent.
19
+ */
20
+ export function languageEmphasesOf(byName: ReadonlyMap<string, Record<string, any>>): Map<string, LanguageEmphasis>;
21
+ /**
22
+ * Refuse `data.emphasis` on a skill that is not a language, at its key.
23
+ *
24
+ * @param {{file: string, raw?: string, fm?: Record<string, any>}} note - The note.
25
+ * @returns {object[]} The findings.
26
+ */
27
+ export function checkLanguageEmphasis(note: {
28
+ file: string;
29
+ raw?: string;
30
+ fm?: Record<string, any>;
31
+ }): object[];
32
+ /**
33
+ * Check a note's `data.script`: that the note is a script, and that its
34
+ * `fonts` is not empty, names no generic family, lists no face twice, and
35
+ * lists no face another script note lists. The data-key check owns every key,
36
+ * its kind and the conventions; whether a face is installed is
37
+ * {@link checkScriptNoteFonts}'s.
38
+ *
39
+ * @param {{file: string, raw?: string, fm?: Record<string, any>}} note - The note.
40
+ * @param {{index?: {notes?: Iterable<object>}}} [context] - The lint index.
41
+ * @returns {object[]} The findings, each at its key or entry.
42
+ */
43
+ export function checkScriptField(note: {
44
+ file: string;
45
+ raw?: string;
46
+ fm?: Record<string, any>;
47
+ }, { index }?: {
48
+ index?: {
49
+ notes?: Iterable<object>;
50
+ };
51
+ }): object[];
52
+ /**
53
+ * Each face a script note lists that is not installed, at its entry.
54
+ *
55
+ * @param {{file: string, raw?: string, fm?: Record<string, any>}} note - The note.
56
+ * @param {{faces?: ReadonlyMap<string, unknown>}} [ctx] - The installed faces,
57
+ * from {@link module:engine/content-scripts.runContext}.
58
+ * @returns {object[]} The findings.
59
+ */
60
+ export function checkScriptNoteFonts(note: {
61
+ file: string;
62
+ raw?: string;
63
+ fm?: Record<string, any>;
64
+ }, ctx?: {
65
+ faces?: ReadonlyMap<string, unknown>;
66
+ }): object[];
67
+ /**
68
+ * One face's conventions, one for each level of emphasis.
69
+ */
70
+ export type Emphasis = {
71
+ /**
72
+ * - What `*…*` is set by.
73
+ */
74
+ em: "rubric" | "overline";
75
+ /**
76
+ * - What `**…**` is set by.
77
+ */
78
+ strong: "rubric" | "overline";
79
+ };
80
+ /**
81
+ * A convention a language note states.
82
+ */
83
+ export type LanguageEmphasis = "words" | "rubric" | "overline";
84
+ export { EMPHASIS_CLASSES, EMPHASIS_CONVENTIONS, LANGUAGE_EMPHASES } from "./script-emphasis-terms.mjs";
@@ -69,10 +69,10 @@ export function checkScriptFonts(config: DeliveryConfig): {
69
69
  */
70
70
  export function siteFontsParam(config: DeliveryConfig): string | undefined;
71
71
  /**
72
- * The directory under the Hugo static tree that holds this version's fonts.
72
+ * The directory under the site's static tree that holds this version's fonts.
73
73
  *
74
74
  * @param {string} version - The fonts package's version.
75
- * @returns {string} The POSIX path, relative to `build/hugo/static`.
75
+ * @returns {string} The POSIX path, relative to the static tree.
76
76
  */
77
77
  export function siteFontsDestination(version: string): string;
78
78
  /**
@@ -104,8 +104,8 @@ export function typstScriptFontPath(config: DeliveryConfig): string | undefined;
104
104
  */
105
105
  export const STAGED_FONTS_DIR: string;
106
106
  /**
107
- * Where the files land in the Hugo static tree, relative to `build/hugo/static`,
108
- * beneath a directory per version.
107
+ * Where the files land in the site's static tree, beneath a directory per
108
+ * version.
109
109
  *
110
110
  * @type {string}
111
111
  */
@@ -3,9 +3,10 @@
3
3
  *
4
4
  * @param {string} contentBase - Absolute path to the content tree.
5
5
  * @param {object} ctx - `{ packages, contentPackage, skipDirectories, base,
6
- * mount, scheme }`. `contentPackage` is the package a note that declares none
7
- * belongs to; `base` is where the package is served and `mount` is where its
8
- * content tree sits inside it.
6
+ * mount, scheme, only }`. `contentPackage` is the package a note that
7
+ * declares none belongs to; `base` is where the package is served and `mount`
8
+ * is where its content tree sits inside it. `only`, an absolute path, reads
9
+ * that one note and no other.
9
10
  * @returns {{pages: object[], addressFindings: object[], fmLinkFindings: object[]}}
10
11
  */
11
12
  export function collectContentPages(contentBase: string, ctx: object): {
@@ -42,34 +43,10 @@ export function collectHomepages(contentBase: string, ctx: object): {
42
43
  addressFindings: object[];
43
44
  };
44
45
  /**
45
- * Writes each homepage as the package root's `_index.md`.
46
+ * Each homepage's frontmatter as its page publishes it, and its body.
46
47
  *
47
- * Its own writer, deliberately small. A homepage is authored markdown published
48
- * verbatim — no table expansion and no link resolution — so routing it through
49
- * {@link renderPages} would give it a pipeline it does not use.
50
- *
51
- * **Verbatim is the answer, not a gap.** A homepage's links could not be
52
- * *resolved* here, so they are **checked** instead:
53
- * {@link auditHomepageLinks} reads the body's markdown links, and reports a
54
- * wikilink on the page rather than resolving one.
55
- *
56
- * **Its destination is fixed**: {@link HOMEPAGE_DESTINATION}, at the package's
57
- * site root, which Hugo renders as the `home` kind at `/<package>/`. The page
58
- * states no `url` — the home kind has none to state — and the mount below it
59
- * holds pages and nothing else, so this is the only `_index.md` in the tree.
60
- *
61
- * **Verbatim, but not unconnected.** The homepage is a page like any other on
62
- * both sides of the link graph: a content page reaches it through
63
- * `[[homepage-root|Text]]`, and its own markdown links name content pages. So
64
- * it carries the same `related` block every content page does — handed in by
65
- * the caller, since the graph is read off the content render and a tree with
66
- * only a homepage has no such graph.
67
- *
68
- * @param {string} outRoot - The package's site root — the content mount's
69
- * root, `build/hugo/content`, one level above the mount itself.
70
48
  * @param {readonly object[]} pages - From {@link collectHomepages}.
71
- * @param {object} config - The resolved configuration, for the package name and
72
- * the default title.
49
+ * @param {object} config - The resolved configuration.
73
50
  * @param {object} [options] - Options.
74
51
  * @param {import("./related-pages.mjs").Related} [options.related] - The
75
52
  * homepage's backlinks and mentions. Absent where nothing connects to it,
@@ -78,13 +55,18 @@ export function collectHomepages(contentBase: string, ctx: object): {
78
55
  * address resolves against the images this package ships.
79
56
  * @param {object} [options.foreign] - The dependencies' vendored indexes, so a
80
57
  * `data.banner` may name an image a dependency ships.
81
- * @returns {number} How many pages were written.
58
+ * @returns {Array<{file: string, body: string, data: object}>} One entry per
59
+ * homepage, in walk order.
82
60
  */
83
- export function writeHomepages(outRoot: string, pages: readonly object[], config: object, { related, records, foreign }?: {
61
+ export function homepageData(pages: readonly object[], config: object, { related, records, foreign }?: {
84
62
  related?: import("./related-pages.mjs").Related | undefined;
85
63
  records?: readonly object[] | undefined;
86
64
  foreign?: object | undefined;
87
- }): number;
65
+ }): Array<{
66
+ file: string;
67
+ body: string;
68
+ data: object;
69
+ }>;
88
70
  /**
89
71
  * The integrity gates a site build runs before it writes anything.
90
72
  *
@@ -132,7 +114,7 @@ export function emptyGates(): object;
132
114
  /**
133
115
  * Whether any gate produced a finding.
134
116
  * @param {{homepages: unknown[], frontmatterLinks: unknown[],
135
- * addressErrors: unknown[], staleManifests: unknown[],
117
+ * addressErrors: unknown[], sections?: unknown[], staleManifests: unknown[],
136
118
  * unaddressable: unknown[]}} gates - Results of the site checks.
137
119
  * @returns {boolean} Whether at least one check found an error.
138
120
  */
@@ -140,9 +122,20 @@ export function gatesFailed(gates: {
140
122
  homepages: unknown[];
141
123
  frontmatterLinks: unknown[];
142
124
  addressErrors: unknown[];
125
+ sections?: unknown[];
143
126
  staleManifests: unknown[];
144
127
  unaddressable: unknown[];
145
128
  }): boolean;
129
+ /**
130
+ * Whether a site build found anything that stops its pages being written: a
131
+ * gate that fired, or a note whose table, expression, block, caption, heading,
132
+ * footnote, link, image or embed is in error. What drawing the maps found does
133
+ * not stop it.
134
+ *
135
+ * @param {object} result - From {@link buildSite}.
136
+ * @returns {boolean} Whether the build failed.
137
+ */
138
+ export function siteBuildFailed(result: object): boolean;
146
139
  /**
147
140
  * The universe a generated table searches, grouped by package.
148
141
  *
@@ -156,39 +149,19 @@ export function tableUniverse(pages: object[]): Map<string, object[]>;
156
149
  /**
157
150
  * The frontmatter a page publishes with.
158
151
  *
159
- * An authored `aliases` is a list of names a reader might call the note. Hugo reads
160
- * `aliases` as **URL redirects**, so passing them through would publish a
161
- * redirect stub at each name. They are dropped, and this build emits no
162
- * redirects of its own.
163
- *
164
- * A content page states its own **`url`**, which is its address rather than its
165
- * path. It is written flat under the content mount, so Hugo would
166
- * otherwise publish it at `<mount><type>-<shortcode>/` rather than at the
167
- * package-wide address the link manifest records — the same address, one
168
- * segment too deep. So the address is stated and the mount does not reach it.
169
- *
170
- * **It is stated relative to the site root, and so carries no package base**.
171
- * Hugo resolves a `url` against `baseURL`, whose path is already where
172
- * the package is served — a consumer's Hugo site *is* its package — so writing
173
- * `page.url`, which carries the base for every href this build renders, wrote
174
- * that base a second time and published every content page a segment too deep
175
- * (`/sohl/sohl/doc-rulesintro/`). The two are separate quantities: the page
176
- * states `/<slug>/`, and everything that points *at* the page — the address
177
- * index a wikilink resolves through, and the link manifest — composes
178
- * `<base><slug>/`.
152
+ * An authored `aliases` is a list of names a reader might call the note. It is
153
+ * dropped: this build emits no redirects.
179
154
  *
180
155
  * A content page carries the package the build **derived**. No note
181
- * declares one, so the note's frontmatter alone
182
- * would publish a page that does not say which package it belongs to. The
183
- * emitted page is what a theme reads: `breadcrumbs.html` reads
184
- * `.Params.package`. Writing the derived value keeps a page
156
+ * declares one, so the note's frontmatter alone would publish a page that does
157
+ * not say which package it belongs to. Writing the derived value keeps a page
185
158
  * self-describing and makes sweeping the field out of a content tree
186
159
  * output-preserving for a site as it already is for the packs.
187
160
  *
188
161
  * **`related` is derived, never authored.** What links to a page is a fact
189
162
  * about every other page, known only once the whole tree has resolved — see
190
163
  * {@link module:engine/related-pages} — so an authored value is dropped the
191
- * way `aliases` is, and {@link renderPages} writes the derived block once it
164
+ * way `aliases` is, and {@link renderPages} sets the derived block once it
192
165
  * holds the graph.
193
166
  *
194
167
  * @param {object} page - The page.
@@ -202,41 +175,19 @@ export function tableUniverse(pages: object[]): Map<string, object[]>;
202
175
  * pathname into the address the website serves. Every artwork field goes
203
176
  * through it, so a page's `img:` and its body images name the same file the
204
177
  * same way.
205
- * @returns {object} The frontmatter to write.
178
+ * @returns {object} The frontmatter.
206
179
  */
207
180
  export function pageFrontmatter(page: object, { decorate, webSrc, artSrc }: {
208
181
  decorate?: ((data: object, page: object) => void) | undefined;
209
182
  artSrc?: ((value: unknown, type: string, accepts?: Iterable<string>) => string | null) | undefined;
210
183
  webSrc?: ((src: string) => string) | undefined;
211
184
  }): object;
212
- /**
213
- * Where a page is written, relative to the output root.
214
- *
215
- * **Flat, under the mount, named by its address**. A content page's URL
216
- * is its address — `/<package>/<type>-<shortcode>/` — and the file is named
217
- * the same way, so the two agree. No page creates a directory: a section is
218
- * a Hugo listing over a content directory, the `section` kind is disabled on
219
- * every site, and a directory chosen only to satisfy a rendering engine's idea
220
- * of what a section is has no business in the note format.
221
- *
222
- * The name is the *whole* address, so two types cannot fight over one file: a
223
- * `doc` note's `subType` may be spelled the same as another note's `type`, and
224
- * `doc-gear.md` and `weapongear-gear.md` are distinct.
225
- *
226
- * @param {{slug: string}} page - The page.
227
- * @returns {string} The file, relative to the mount.
228
- */
229
- export function pageDestination(page: {
230
- slug: string;
231
- }): string;
232
- /** Transform one content page without writing the site mount. */
233
- export function renderSitePage(page: any, { index, foreign, universe, pass, decorate, linkable, sqlTables, config, artIndex, figuresByAddress, events, drawings, runs, }: {
185
+ /** Transform one content page. */
186
+ export function renderSitePage(page: any, { index, foreign, pass, decorate, sqlTables, config, artIndex, figuresByAddress, events, drawings, runs, }: {
234
187
  index: any;
235
188
  foreign: any;
236
- universe: any;
237
189
  pass?: {} | undefined;
238
190
  decorate: any;
239
- linkable?: ((d: any) => boolean) | undefined;
240
191
  sqlTables: any;
241
192
  config: any;
242
193
  artIndex: any;
@@ -246,11 +197,12 @@ export function renderSitePage(page: any, { index, foreign, universe, pass, deco
246
197
  runs?: import("./content-scripts.mjs").RunContext | undefined;
247
198
  }): {
248
199
  page: any;
249
- body: string;
200
+ markdown: string;
201
+ figures: object[];
250
202
  data: object;
251
- resolved: any[];
203
+ resolved: object[];
252
204
  tableErrors: object[];
253
- expressionErrors: any[];
205
+ expressionErrors: object[];
254
206
  secretErrors: {
255
207
  file: any;
256
208
  line: number;
@@ -260,8 +212,8 @@ export function renderSitePage(page: any, { index, foreign, universe, pass, deco
260
212
  captionErrors: {
261
213
  file: any;
262
214
  line: any;
263
- column: number;
264
- message: string;
215
+ column: any;
216
+ message: any;
265
217
  }[];
266
218
  headingErrors: {
267
219
  line: number;
@@ -275,7 +227,7 @@ export function renderSitePage(page: any, { index, foreign, universe, pass, deco
275
227
  column: number;
276
228
  message: string;
277
229
  }[];
278
- wikiErrors: any[];
230
+ wikiErrors: object[];
279
231
  imageErrors: any[];
280
232
  embedErrors: {
281
233
  file: string;
@@ -286,24 +238,20 @@ export function renderSitePage(page: any, { index, foreign, universe, pass, deco
286
238
  }[];
287
239
  };
288
240
  /**
289
- * Renders and writes every page.
290
- *
291
- * The order inside a page is load-bearing and is the same order the pack
292
- * compilers use:
293
- *
294
- * 1. **Tables expand first**, and outside code-fence protection. A table is
295
- * authored as a fenced `sql` block, which `protectCode` would otherwise
296
- * stash away before the expander saw it. Expanding first leaves an ordinary
297
- * markdown table to walk, with every other fence still protected.
298
- * 2. **Then, inside protection**: the consumer's `beforeLinks` pass, then
299
- * wikilink resolution. A `{@link}` tag may sit in prose a wikilink also
300
- * touches, so the repository's own rewrite runs before the shared one
301
- * rather than replacing it.
302
- *
303
- * **Every page is rendered before any is written.** What links *to* a page is
304
- * known only once every other page has resolved, and it is written into the
305
- * page's own front matter, so the render is one pass over the tree and the
306
- * write is a second — with the link graph read off the first, at the one
241
+ * Renders every page.
242
+ *
243
+ * Each page's body is expanded by
244
+ * {@link module:engine/content-expand.expandContent}, the step the pack
245
+ * compilers take too: tables first and outside code-fence protection, then
246
+ * figure numbers and expressions, then, inside protection, the consumer's
247
+ * `beforeLinks` pass and wikilink resolution. A `{@link}` tag may sit in prose
248
+ * a wikilink also touches, so the repository's own rewrite runs before the
249
+ * shared one rather than replacing it.
250
+ *
251
+ * **Every page is rendered before any is finished.** What links *to* a page is
252
+ * known only once every other page has resolved, and it is set in the page's
253
+ * own front matter, so the render is one pass over the tree and the
254
+ * finishing is a second — with the link graph read off the first, at the one
307
255
  * point the resolver answers, and inverted once between them. Nothing is
308
256
  * resolved twice.
309
257
  *
@@ -320,10 +268,12 @@ export function renderSitePage(page: any, { index, foreign, universe, pass, deco
320
268
  * @returns {{written: number, byKind: Record<string, number>, tableErrors: object[],
321
269
  * wikiErrors: object[], imageErrors: object[], embedErrors: object[],
322
270
  * related: Map<string, import("./related-pages.mjs").Related>,
323
- * maps: number}} `related`
271
+ * maps: number, pages: object[], runs: object}} `related`
324
272
  * is keyed by page URL, and holds the homepage's block beside every content
325
- * page's, so the caller can write it on the page this render does not.
326
- * `maps` counts the pages carrying a map.
273
+ * page's, so the caller can set it on the page this render does not.
274
+ * `maps` counts the pages carrying a map. `pages` holds
275
+ * `{page, markdown, figures, data}` for each page and `runs` the package's
276
+ * marked-text context.
327
277
  */
328
278
  export function renderPages(pages: object[], options: object): {
329
279
  written: number;
@@ -334,6 +284,8 @@ export function renderPages(pages: object[], options: object): {
334
284
  embedErrors: object[];
335
285
  related: Map<string, import("./related-pages.mjs").Related>;
336
286
  maps: number;
287
+ pages: object[];
288
+ runs: object;
337
289
  };
338
290
  /**
339
291
  * Resolves `site.pass` to its bundle.
@@ -348,7 +300,7 @@ export function resolveSitePass(name: string | undefined, options: object): {
348
300
  /** The site frontmatter decoration shared by the site writer and page preview. */
349
301
  export function sitePageDecorator(config: any, index: any): (data: any, page: any) => void;
350
302
  /**
351
- * Builds a Hugo content tree from a content tree, and reports what it found.
303
+ * Collects, checks and renders a content tree's pages, and reports what it found.
352
304
  *
353
305
  * Returns rather than exits, in every case. A caller — the command, or a test —
354
306
  * decides what a finding means; the gates below are grouped so it can report
@@ -366,8 +318,13 @@ export function sitePageDecorator(config: any, index: any): (data: any, page: an
366
318
  * @returns {{gates: object, stats: object|null, tableErrors: object[],
367
319
  * wikiErrors: object[], imageErrors: object[], embedErrors: object[],
368
320
  * mapFindings: object[],
369
- * manifests: object|null}} `mapFindings` is what drawing the maps found —
370
- * warnings, never a reason to fail the build.
321
+ * manifests: object|null, site?: object}} `mapFindings` is what drawing the
322
+ * maps found — warnings, never a reason to fail the build. `site` holds what a page renderer needs: `base`, `pages` (each content
323
+ * page's `{page, markdown, figures, data}`), `homepages` (each
324
+ * `{file, body, data}`), `runs`, `index`, `foreign` and `records`; and
325
+ * `renderNote(file)`, which reads one content note again and renders it
326
+ * against the rest of the build, or returns `null` when its address, name
327
+ * or type changed and the whole site must be built again.
371
328
  */
372
329
  export function buildSite({ config, sqlTables }?: {
373
330
  config?: object | undefined;
@@ -381,6 +338,7 @@ export function buildSite({ config, sqlTables }?: {
381
338
  embedErrors: object[];
382
339
  mapFindings: object[];
383
340
  manifests: object | null;
341
+ site?: object;
384
342
  };
385
343
  export { formatUnaddressableFinding };
386
344
  import { formatUnaddressableFinding } from "./metadata-index.mjs";