@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
@@ -14,7 +14,7 @@ export function runContext(config: {
14
14
  rootDir?: string;
15
15
  } | undefined, records?: Iterable<Record<string, any>>): RunContext;
16
16
  /**
17
- * Find the spans, divs and poetry fences marked with `lang=`, `font=` or
17
+ * Find the spans, divs and verse fences marked with `lang=`, `font=` or
18
18
  * `map=`, and every fault in their markup and their text.
19
19
  *
20
20
  * @param {string} source - Authored Markdown: a note body, or a whole file
@@ -44,10 +44,17 @@ export function scanRuns(source: string, ctx?: RunContext, syntax?: import("./co
44
44
  };
45
45
  /**
46
46
  * Rewrite text marked with `lang=`, `font=` and `map=` into the plain span,
47
- * div and poetry grammar the rest of each chain renders, one line for one line.
47
+ * div and verse grammar the rest of each chain renders, one line for one line.
48
48
  *
49
+ * - **A verse in columns is expanded first** into one span per column entry
50
+ * per verse line, by {@link module:engine/content-verse.expandVerse}, so
51
+ * each entry is mapped and set as a span with its keys is. That is the one
52
+ * rewrite that changes the number of lines.
49
53
  * - **The map, if any, is applied first.** Characters Markdown would read are
50
54
  * then backslash-escaped, so they reach every later pass as characters.
55
+ * - **Emphasis in a face** becomes an `<em>` or a `<strong>` carrying its
56
+ * convention's class, or no class where none is stated. The book reads
57
+ * only the classed form, so a classless one writes nothing there.
51
58
  * - **The construct carries** the language's tag as `lang`, the face's class
52
59
  * (with `script`, and `script-block` on a div) or the generic family's
53
60
  * class. On the site, a face's construct also carries
@@ -86,6 +93,27 @@ export const GENERIC_FONTS: Readonly<{
86
93
  serif: "font-serif";
87
94
  sans: "font-sans";
88
95
  }>;
96
+ /**
97
+ * One `*`, `_`, `**` or `__` that Markdown reads as opening or closing emphasis.
98
+ */
99
+ export type Delimiter = {
100
+ /**
101
+ * - Its first character's offset.
102
+ */
103
+ offset: number;
104
+ /**
105
+ * - 1 for `*` or `_`, 2 for `**` or `__`.
106
+ */
107
+ length: number;
108
+ /**
109
+ * - Which level it opens or closes.
110
+ */
111
+ tag: "em" | "strong";
112
+ /**
113
+ * - Whether it opens.
114
+ */
115
+ open: boolean;
116
+ };
89
117
  /**
90
118
  * One marked construct, with what rendering it needs beside its {@link Run}.
91
119
  */
@@ -141,6 +169,21 @@ export type RunDetail = {
141
169
  * - A span's offset of its closing `]`.
142
170
  */
143
171
  contentEnd: number | undefined;
172
+ /**
173
+ * -
174
+ * The convention its language's note states.
175
+ */
176
+ languageEmphasis: import("./script-emphasis.mjs").LanguageEmphasis | undefined;
177
+ /**
178
+ * -
179
+ * What its emphasis is set by: its language's convention, else its face's
180
+ * script's; `undefined` sets it plain.
181
+ */
182
+ conventions: import("./script-emphasis.mjs").Emphasis | undefined;
183
+ /**
184
+ * - The emphasis it holds, by absolute offset.
185
+ */
186
+ emphasis: Delimiter[];
144
187
  };
145
188
  /**
146
189
  * What a run is checked against.
@@ -177,9 +220,32 @@ export type RunContext = {
177
220
  * {@link module :engine/run-words.wordBooksFromRecords}.
178
221
  */
179
222
  wordBooks?: ReadonlyMap<string, import("./run-words.mjs").WordBook> | undefined;
223
+ /**
224
+ * -
225
+ * The metres the `doc` notes declare, by name.
226
+ */
227
+ metres?: ReadonlyMap<string, import("./metre-declaration.mjs").Metre> | undefined;
228
+ /**
229
+ * -
230
+ * What each configured language's verse is counted by, from
231
+ * {@link module :engine/verse-metre.metreBooksFromRecords}.
232
+ */
233
+ metreBooks?: ReadonlyMap<string, import("./verse-metre.mjs").MetreBook> | undefined;
234
+ /**
235
+ * -
236
+ * Each face's emphasis conventions, from the script notes, by
237
+ * {@link module :engine/script-emphasis.emphasesFromRecords}.
238
+ */
239
+ emphases?: ReadonlyMap<string, import("./script-emphasis.mjs").Emphasis> | undefined;
240
+ /**
241
+ * -
242
+ * The convention each configured language's note states, by language name,
243
+ * from {@link module :engine/script-emphasis.languageEmphasesOf}.
244
+ */
245
+ languageEmphases?: ReadonlyMap<string, import("./script-emphasis.mjs").LanguageEmphasis> | undefined;
180
246
  };
181
247
  /**
182
- * One span, div or poetry fence carrying `lang=`, `font=` or `map=`. Its
248
+ * One span, div or verse fence carrying `lang=`, `font=` or `map=`. Its
183
249
  * `lang`, `font` and `map` are the ones it is set with: its own, else the
184
250
  * innermost div or fence around it that states one.
185
251
  */
@@ -187,7 +253,7 @@ export type Run = {
187
253
  /**
188
254
  * - Which construct.
189
255
  */
190
- kind: "span" | "block" | "poetry";
256
+ kind: "span" | "block" | "verse";
191
257
  /**
192
258
  * - The language as written.
193
259
  */
@@ -13,7 +13,7 @@ export function spanMarkdownPlugin(md: typeof import("markdown-it"), { spoilers,
13
13
  * @returns {import("./name-markup.mjs").SpanScan} Actual spans, explicit names and located diagnostics.
14
14
  */
15
15
  export function scanSpans(source: string): import("./name-markup.mjs").SpanScan;
16
- /** Emit span tags while leaving their inline content as Markdown for Hugo.
16
+ /** Emit span tags while leaving their inline content as Markdown.
17
17
  * @param {string} source - Authored Markdown.
18
18
  */
19
19
  export function renderSpans(source: string): {
@@ -0,0 +1,33 @@
1
+ /**
2
+ * The rules the Foundry content stylesheet shares with other surfaces, scoped
3
+ * to a selector.
4
+ *
5
+ * @param {string} scope - The selector that replaces the Foundry roots.
6
+ * @returns {string} The rules.
7
+ * @throws {Error} When the stylesheet marks no shared rules.
8
+ */
9
+ export function sharedContentRules(scope: string): string;
10
+ /**
11
+ * The rules that colour highlighted code, scoped to a selector.
12
+ *
13
+ * A rule belongs to the set when one of its selectors names a `hljs-` token
14
+ * class. The rules are taken from the shared stretches, so the colours, their
15
+ * custom properties and their `light-dark()` pairs are the stylesheet's own.
16
+ *
17
+ * @param {string} scope - The selector that replaces the Foundry roots.
18
+ * @returns {string} The token rules, one per block.
19
+ */
20
+ export function highlightRules(scope: string): string;
21
+ /**
22
+ * The stylesheet a site links for highlighted code.
23
+ *
24
+ * A site sets no colour scheme, and the token colours are `light-dark()` pairs
25
+ * that read the scheme in force, so code is given the dark one its pages are
26
+ * drawn in.
27
+ *
28
+ * @param {string} [scope] - The element the page body sits in.
29
+ * @returns {string} The stylesheet.
30
+ */
31
+ export function siteCodeStylesheet(scope?: string): string;
32
+ /** The roots the shipped content stylesheet scopes its rules to. */
33
+ export const CONTENT_ROOTS: ":is(.journal-entry-page, .journal-entry-content, .editor-content, .prosemirror)";
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Markdown-it plugin: write each cartouche placeholder as the inline HTML of
3
+ * its figure, in whatever paragraph, cell or title it stands.
4
+ * @param {import("markdown-it")} md - Parser to extend.
5
+ */
6
+ export function cartoucheFigures(md: typeof import("markdown-it")): void;
7
+ /**
8
+ * Write each glyph and cartouche span as the HTML that draws its picture. A
9
+ * cartouche is written as a placeholder that {@link cartoucheFigures} turns
10
+ * into its figure.
11
+ *
12
+ * @param {string} source - Markdown that may contain glyph and cartouche spans.
13
+ * @param {(src: string) => string} [resolveSrc] - From a sign's authored
14
+ * pathname to the address the target serves; omitted, the pathname.
15
+ * @param {object} [options]
16
+ * @param {boolean} [options.glyphs] - Write glyph spans; `false` leaves them
17
+ * as the source they were written in. Default `true`.
18
+ * @returns {string} The Markdown with each well-formed sign written as HTML or a placeholder.
19
+ */
20
+ export function renderSymbolSpans(source: string, resolveSrc?: (src: string) => string, { glyphs }?: {
21
+ glyphs?: boolean | undefined;
22
+ }): string;
23
+ /**
24
+ * Every picture the glyphs and cartouches of a body name, for a stage that has
25
+ * to place the files before a compiler reads them.
26
+ *
27
+ * @param {string} body - The note's Markdown.
28
+ * @returns {Array<{src: string, locate: string}>} The authored pathname of each
29
+ * picture and the slug that locates it in the note's text, in document order
30
+ * within glyphs and then cartouches.
31
+ */
32
+ export function symbolImagesIn(body: string): Array<{
33
+ src: string;
34
+ locate: string;
35
+ }>;
@@ -0,0 +1,240 @@
1
+ /** The authored verse lines, excluding stanza separators. */
2
+ export function verseLines(body: any): string[];
3
+ /**
4
+ * The least-indented verse is level zero. Every two additional leading spaces
5
+ * add one level; a leftover space is discarded and the level stops at eight.
6
+ * Blank lines divide stanzas rather than contributing to the baseline.
7
+ */
8
+ export function verseStanzas(body: any): {
9
+ text: string;
10
+ level: number;
11
+ }[][];
12
+ /** A verse is inline Markdown even when it starts with block syntax. */
13
+ export function inlineVerse(text: any): string;
14
+ /**
15
+ * Keep stanzas as Markdown paragraphs and make every verse line a hard break.
16
+ * The surrounding renderer still sees the entire note, so links and footnote
17
+ * definitions remain in scope. The span carries the indent for each line.
18
+ */
19
+ export function verseMarkdown(body: any, step?: number): string;
20
+ /**
21
+ * The number a line shows: `undefined` when the verse is not numbered, `""`
22
+ * when this line is not one of every `step`th.
23
+ *
24
+ * @param {number} line - The line's number, 1-based across the verse.
25
+ * @param {number} step - The verse's `numstep`.
26
+ * @returns {string|undefined} The number shown.
27
+ */
28
+ export function lineNumber(line: number, step: number): string | undefined;
29
+ /** Read verse code fences; start/end are inclusive zero-based source lines.
30
+ * @param {string} source - Authored Markdown.
31
+ */
32
+ export function scanVerse(source: string): {
33
+ blocks: {
34
+ end: number;
35
+ body: string;
36
+ start: number;
37
+ fence: string;
38
+ name: string;
39
+ attributes: {};
40
+ id: string;
41
+ classes: never[];
42
+ indent: string;
43
+ }[];
44
+ errors: {
45
+ line: number;
46
+ column: number;
47
+ message: string;
48
+ }[];
49
+ };
50
+ /** Whether a verse states a column. */
51
+ export function hasColumns(block: any): boolean;
52
+ /**
53
+ * A column's stacked entries, each with its offset in the written value.
54
+ *
55
+ * @param {string} value - A `col1=` or `col2=` value.
56
+ * @returns {Array<{raw: string, offset: number, lang?: string, map?: string, font?: string, offsets: {lang: number, map?: number, font?: number}}>}
57
+ * Each entry; one whose `lang` is `undefined` is malformed.
58
+ */
59
+ export function columnEntries(value: string): Array<{
60
+ raw: string;
61
+ offset: number;
62
+ lang?: string;
63
+ map?: string;
64
+ font?: string;
65
+ offsets: {
66
+ lang: number;
67
+ map?: number;
68
+ font?: number;
69
+ };
70
+ }>;
71
+ /**
72
+ * The columns of a verse, the left first, each entry located in the opening
73
+ * line.
74
+ *
75
+ * @param {object} block - A verse from {@link scanVerse}.
76
+ * @param {string} opening - Its opening line.
77
+ * @returns {Array<{key: string, entries: Array<ReturnType<typeof columnEntries>[number] & {column: number, columns: {lang: number, map?: number, font?: number}}>}>}
78
+ * 1-based columns.
79
+ */
80
+ export function verseColumns(block: object, opening: string): Array<{
81
+ key: string;
82
+ entries: Array<ReturnType<typeof columnEntries>[number] & {
83
+ column: number;
84
+ columns: {
85
+ lang: number;
86
+ map?: number;
87
+ font?: number;
88
+ };
89
+ }>;
90
+ }>;
91
+ /**
92
+ * The verse lines of a verse in columns: each blank-line group of span lines
93
+ * is one verse line, and a line holding only `***` breaks the stanza.
94
+ *
95
+ * @param {object} block - A verse from {@link scanVerse}.
96
+ * @param {string[]} lines - The source, by line.
97
+ * @returns {Array<{stanzaBreak: true, line: number}|{stanzaBreak?: false, parts: Array<{line: number, column: number, text: string, textColumn: number, lang?: string, span: boolean, extra: boolean, indent: number}>}>}
98
+ * 0-based lines, 1-based columns.
99
+ */
100
+ export function verseGroups(block: object, lines: string[]): Array<{
101
+ stanzaBreak: true;
102
+ line: number;
103
+ } | {
104
+ stanzaBreak?: false;
105
+ parts: Array<{
106
+ line: number;
107
+ column: number;
108
+ text: string;
109
+ textColumn: number;
110
+ lang?: string;
111
+ span: boolean;
112
+ extra: boolean;
113
+ indent: number;
114
+ }>;
115
+ }>;
116
+ /**
117
+ * Whether text runs right to left: its first letter is in a right-to-left
118
+ * block. A face's right-to-left code points sit in U+1E800–U+1EFFF.
119
+ *
120
+ * @param {string} text - Text, after any map.
121
+ * @returns {boolean} Whether it starts right to left.
122
+ */
123
+ export function rightToLeft(text: string): boolean;
124
+ /**
125
+ * Where a line of {@link expandVerseOrigins}'s output came from.
126
+ *
127
+ * @typedef {object} VerseOrigin
128
+ * @property {number} line - The source line, 0-based.
129
+ * @property {number} [textColumn] - For an entry's line, the 1-based source
130
+ * column of its text's first character.
131
+ * @property {boolean} [span] - Whether the source line is a span, whose `[`
132
+ * sits before its text.
133
+ * @property {number} [textLength] - The length of the entry's text.
134
+ * @property {{line: number, columns: {lang: number, map?: number, font?: number}}} [entry] -
135
+ * Where the entry is written in the opening line.
136
+ */
137
+ /**
138
+ * Write each verse line of a sound verse in columns as one span per column
139
+ * entry, the left column's entries first, each with the entry's language,
140
+ * mapping and font. Every target runs it before marked text is rewritten, so
141
+ * each entry is set exactly as a span with those keys is. The verse gains the
142
+ * class {@link COLUMNS_CLASS}; a verse already carrying it, a verse with a
143
+ * finding, and a verse without columns are left as written.
144
+ *
145
+ * @param {string} source - Markdown.
146
+ * @returns {{markdown: string, origins: VerseOrigin[]}} The Markdown, and
147
+ * where each of its lines came from.
148
+ */
149
+ export function expandVerseOrigins(source: string): {
150
+ markdown: string;
151
+ origins: VerseOrigin[];
152
+ };
153
+ /**
154
+ * {@link expandVerseOrigins}'s Markdown alone.
155
+ *
156
+ * @param {string} source - Markdown.
157
+ * @returns {string} The Markdown with each verse in columns expanded.
158
+ */
159
+ export function expandVerse(source: string): string;
160
+ /**
161
+ * Where a position in {@link expandVerseOrigins}'s output was written.
162
+ *
163
+ * A position in an entry's text is the same character of the source line; a
164
+ * position in its keys is the entry's part in the opening line that states
165
+ * the key it falls in.
166
+ *
167
+ * @param {{line: number, column: number}} at - 1-based, in the output.
168
+ * @param {string[]} expanded - The output, by line.
169
+ * @param {VerseOrigin[]} origins - From {@link expandVerseOrigins}.
170
+ * @returns {{line: number, column: number}} 1-based, in the source.
171
+ */
172
+ export function sourcePosition(at: {
173
+ line: number;
174
+ column: number;
175
+ }, expanded: string[], origins: VerseOrigin[]): {
176
+ line: number;
177
+ column: number;
178
+ };
179
+ /** Replace verse fences with HTML wrappers whose body remains inline Markdown.
180
+ * @param {string} source - Authored Markdown.
181
+ */
182
+ export function renderVerse(source: string): {
183
+ markdown: string;
184
+ errors: {
185
+ line: number;
186
+ column: number;
187
+ message: string;
188
+ }[];
189
+ };
190
+ /** The keys that set a verse in columns, the left first. */
191
+ export const COLUMN_KEYS: readonly string[];
192
+ /** The class the build gives a verse in columns once its lines are expanded. */
193
+ export const COLUMNS_CLASS: "verse-columns";
194
+ /**
195
+ * The keys a verse fence's attribute block takes. `lang`, `font` and `map`
196
+ * are read by `scanRuns` in content-scripts.mjs; `dir`, and on the site
197
+ * `data-pagefind-ignore`, are written by its rewrite of a fence set in one of
198
+ * the faces, and reach the element as they are written.
199
+ */
200
+ export const VERSE_KEYS: readonly string[];
201
+ /**
202
+ * The line that breaks a stanza in a verse in columns, `***`, also as the
203
+ * rewrite of marked text escapes it.
204
+ */
205
+ export const STANZA_BREAK: RegExp;
206
+ /**
207
+ * Where a line of {@link expandVerseOrigins}'s output came from.
208
+ */
209
+ export type VerseOrigin = {
210
+ /**
211
+ * - The source line, 0-based.
212
+ */
213
+ line: number;
214
+ /**
215
+ * - For an entry's line, the 1-based source
216
+ * column of its text's first character.
217
+ */
218
+ textColumn?: number | undefined;
219
+ /**
220
+ * - Whether the source line is a span, whose `[`
221
+ * sits before its text.
222
+ */
223
+ span?: boolean | undefined;
224
+ /**
225
+ * - The length of the entry's text.
226
+ */
227
+ textLength?: number | undefined;
228
+ /**
229
+ * -
230
+ * Where the entry is written in the opening line.
231
+ */
232
+ entry?: {
233
+ line: number;
234
+ columns: {
235
+ lang: number;
236
+ map?: number;
237
+ font?: number;
238
+ };
239
+ } | undefined;
240
+ };
@@ -0,0 +1,45 @@
1
+ /**
2
+ * The core report of a set of index records.
3
+ *
4
+ * @param {Iterable<Record<string, any>>} records - Index records.
5
+ * @param {{language?: string}} [options] - A language to report alone, by its
6
+ * name, shortcode or reference slug whether or not it states `data.core`.
7
+ * @returns {{concepts: number, languages: Array<{name: string, language: string, core: boolean, total: number, covered: number, missing: Array<{group: string, count: number, total: number, concepts: Array<{id: string, gloss: string}>}>}>}|{problem: string, about: string}}
8
+ * The report, or the problem when there is no concept list or the language
9
+ * asked for is none.
10
+ */
11
+ export function coreReport(records: Iterable<Record<string, any>>, { language }?: {
12
+ language?: string;
13
+ }): {
14
+ concepts: number;
15
+ languages: Array<{
16
+ name: string;
17
+ language: string;
18
+ core: boolean;
19
+ total: number;
20
+ covered: number;
21
+ missing: Array<{
22
+ group: string;
23
+ count: number;
24
+ total: number;
25
+ concepts: Array<{
26
+ id: string;
27
+ gloss: string;
28
+ }>;
29
+ }>;
30
+ }>;
31
+ } | {
32
+ problem: string;
33
+ about: string;
34
+ };
35
+ /**
36
+ * A core report as text: one block per language, its missing concepts under
37
+ * their groups with counts, each concept's id and gloss tab-separated.
38
+ *
39
+ * @param {{concepts: number, languages: Array<object>}} report - A report from {@link coreReport}.
40
+ * @returns {string} The text, ending in a newline.
41
+ */
42
+ export function coreReportText(report: {
43
+ concepts: number;
44
+ languages: Array<object>;
45
+ }): string;
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Every concept id the index's notes state.
3
+ *
4
+ * @param {{notes?: Iterable<object>}|undefined} index - The lint index.
5
+ * @returns {Set<string>|undefined} The ids, or `undefined` without an index.
6
+ */
7
+ export function conceptIdsIn(index: {
8
+ notes?: Iterable<object>;
9
+ } | undefined): Set<string> | undefined;
10
+ /**
11
+ * Check a `doc` note's `data.concepts`: each id's spelling, an id stated twice,
12
+ * an id another note states, and a blank `gloss` or `group`.
13
+ *
14
+ * @param {{file: string, raw?: string, fm?: Record<string, any>}} note - The note.
15
+ * @param {{index?: {notes?: Iterable<object>}}} [context] - The lint index.
16
+ * @returns {object[]} The findings, each at its key.
17
+ */
18
+ export function checkConceptList(note: {
19
+ file: string;
20
+ raw?: string;
21
+ fm?: Record<string, any>;
22
+ }, { index }?: {
23
+ index?: {
24
+ notes?: Iterable<object>;
25
+ };
26
+ }): object[];
27
+ /**
28
+ * Check a `skill` note's `data.core`: stated on a language only.
29
+ *
30
+ * @param {{file: string, raw?: string, fm?: Record<string, any>}} note - A `skill` note.
31
+ * @returns {object[]} The findings.
32
+ */
33
+ export function checkCoreFlag(note: {
34
+ file: string;
35
+ raw?: string;
36
+ fm?: Record<string, any>;
37
+ }): object[];
38
+ /**
39
+ * What is wrong with a word's `concept`: an id the list does not declare, and
40
+ * an id stated twice.
41
+ *
42
+ * @param {unknown} value - The word's `concept`: an id, or a list of them.
43
+ * @param {Set<string>|undefined} known - The ids the index declares, or
44
+ * `undefined` where there is no index to check against.
45
+ * @returns {Array<{entry: number|null, message: string}>} Each problem and the
46
+ * list entry it sits at, `null` for a single id.
47
+ */
48
+ export function conceptProblems(value: unknown, known: Set<string> | undefined): Array<{
49
+ entry: number | null;
50
+ message: string;
51
+ }>;
52
+ /** What a concept's `id` is made of. */
53
+ export const CONCEPT_ID: RegExp;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Group each term of every definition list with its definitions.
3
+ *
4
+ * @param {string} html - A page's HTML.
5
+ * @returns {string} The HTML with a `dictionary` class on each `dl` and a `div`
6
+ * around each term and the definitions that follow it.
7
+ */
8
+ export function groupDictionaryLists(html: string): string;
@@ -13,6 +13,16 @@ export function pluralOf(word: {
13
13
  class?: unknown;
14
14
  plural?: unknown;
15
15
  }, grammar: Record<string, any> | undefined): string | null;
16
+ /**
17
+ * The plural a language's `data.grammar.plural` rule gives a form: the first
18
+ * literal ending replacement that fits, whatever the form's class.
19
+ *
20
+ * @param {string} form - The form.
21
+ * @param {Record<string, any>|undefined} grammar - Its language's
22
+ * `data.grammar`.
23
+ * @returns {string|null} The plural, or `null` where no rule fits.
24
+ */
25
+ export function pluralByRule(form: string, grammar: Record<string, any> | undefined): string | null;
16
26
  /**
17
27
  * The stable prose anchor of a word in one language's dictionary. The exact
18
28
  * language and NFC form identify it, including case and accents.
@@ -45,7 +45,7 @@ export function renderItemFieldReference({ title, preamble, generatedBy, config,
45
45
  * The one question that decides whether `docs item-fields` writes a note
46
46
  * envelope: `assets/content/` walks every file under it for its `type:`, so a
47
47
  * generated page filed there needs one to publish at all, while a page filed
48
- * anywhere else — a repository's own `docs/` — is read by nobody but Hugo's
48
+ * anywhere else — a repository's own `docs/` — is read by nobody but the
49
49
  * `--check` guard and the reader following a link, neither of which wants
50
50
  * frontmatter.
51
51
  *
@@ -84,7 +84,7 @@ export function shortcodeFromBasename(destination: string): string;
84
84
  * {@link shortcodeFromBasename}.
85
85
  * @param {Record<string, unknown>} [options.frontmatter] - The consumer's
86
86
  * declared `docs.itemFields.frontmatter`.
87
- * @returns {Record<string, unknown>} The envelope, ready for `matter.stringify`.
87
+ * @returns {Record<string, unknown>} The envelope, ready for `writeMatter`.
88
88
  */
89
89
  export function itemFieldsEnvelope({ title, shortcode, frontmatter }: {
90
90
  title: string;
@@ -82,6 +82,26 @@ export function scanHeadingAttributes(source: string, bodyLine?: number): {
82
82
  * @returns {void}
83
83
  */
84
84
  export function headingAttributesPlugin(md: object): void;
85
+ /**
86
+ * The id a heading's text gives it on the web: GitHub's form, lower case, each
87
+ * space or hyphen a hyphen, every character that is not a letter, a digit or
88
+ * an underscore dropped.
89
+ *
90
+ * @param {string} text - The heading's text, without its markup.
91
+ * @returns {string} The id, or `heading` when nothing is left of the text.
92
+ */
93
+ export function headingId(text: string): string;
94
+ /**
95
+ * Give every heading an id, so a page's contents list and a reader's link can
96
+ * name any section.
97
+ *
98
+ * An authored `{#id}` is kept, and every other heading takes {@link headingId}
99
+ * of its text. A repeated id takes `-1`, `-2` and so on, counted over every id
100
+ * on the page that came before it.
101
+ *
102
+ * @param {import("markdown-it")} md - Markdown parser to extend.
103
+ */
104
+ export function headingIdsPlugin(md: typeof import("markdown-it")): void;
85
105
  /**
86
106
  * Parse one line as a heading, and say whether it starts a journal page.
87
107
  *
@@ -432,7 +432,7 @@ export function buildContentLinkIndex(contentBase: string, router?: object, { co
432
432
  * @param {number} [ctx.bodyLine] - 1-based file line of the body's first line.
433
433
  * @param {number} [ctx.bodyColumn] - 1-based file column of the same character.
434
434
  * @param {Array<{line: number, generated: boolean}>} [ctx.lineMap] - Which
435
- * authored line each body line came from, from {@link expandNoteTables}.
435
+ * authored line each body line came from, from {@link module:engine/content-tables.expandContentTables}.
436
436
  * @returns {{markdown: string, unresolved: Array<object>}}
437
437
  * @throws {Error} On any link that does not resolve — an unlabelled one, a
438
438
  * target that is not an address, or an address nothing publishes — and on a
@@ -491,15 +491,8 @@ export function expandNoteTables(body: string, { name, bodyLine, sqlTables, page
491
491
  * @returns {string} Filename for the folder.
492
492
  */
493
493
  export function folderFilename(name: string, id: string): string;
494
- /**
495
- * The markdown renderer every surface shares.
496
- *
497
- * `html: true` is long-standing and load-bearing — notes carry raw blocks — and
498
- * it is also why {@link module:engine/content-icons} exists rather than an
499
- * instruction to write `<i class="fa-solid …">` by hand: that would render on
500
- * the two HTML surfaces and be silently dropped by the third.
501
- */
502
- export const md: import("markdown-it").MarkdownIt;
494
+ /** The Foundry renderer's parser, for callers that parse or render a fragment. */
495
+ export const md: typeof import("markdown-it");
503
496
  export { slugify } from "./content-slug.mjs";
504
497
  export { makeId } from "./ids.mjs";
505
498
  export { getFrontmatter, sohlField, folderField, resolveCharges, resolveSkillAptitudes, resolveRelation, requireSubType, parseValueDesc } from "./frontmatter.mjs";