@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.
- package/CHANGELOG.md +84 -0
- package/README.md +3 -2
- package/assets/preview/gitea.ini +12 -7
- package/assets/styles/content-base.css +293 -24
- package/bin/content-commands.mjs +370 -213
- package/bin/package-build-preview.mjs +2 -2
- package/bin/package-build.mjs +3 -2
- package/ci/check-banners.mjs +7 -7
- package/config.mjs +21 -6
- package/content-config.mjs +199 -80
- package/docs/api.md +110 -89
- package/docs/authoring/links-and-markup.md +469 -97
- package/docs/commands.md +259 -78
- package/docs/configuration.md +211 -103
- package/docs/content-format.md +4 -4
- package/docs/diagnostics.md +44 -2
- package/docs/getting-started.md +1 -1
- package/docs/guides/icons.md +1 -1
- package/docs/guides/module-project.md +5 -8
- package/docs/guides/release-and-deploy.md +2 -2
- package/docs/guides/site.md +112 -23
- package/docs/guides/system-project.md +1 -1
- package/docs/guides/writing-in-invented-scripts.md +1247 -0
- package/docs/index.md +1 -0
- package/docs/project-setup.md +28 -30
- package/docs/reference/format-details.md +677 -319
- package/docs/reference/note-types.md +47 -10
- package/docs/reference/theme-pages.md +178 -108
- package/docs/source-preview.md +16 -2
- package/engine/anchors.mjs +2 -2
- package/engine/asset-shipping.mjs +22 -10
- package/engine/base-compiler.mjs +62 -104
- package/engine/changelog-lint.mjs +1 -1
- package/engine/code-fences.mjs +3 -3
- package/engine/content-address.mjs +1 -1
- package/engine/content-alerts.mjs +8 -4
- package/engine/content-blocks.mjs +29 -14
- package/engine/content-embeds.mjs +1 -1
- package/engine/content-expand.mjs +376 -0
- package/engine/content-figures.mjs +18 -11
- package/engine/content-format.yaml +8 -0
- package/engine/content-glyphs.mjs +213 -0
- package/engine/content-images.mjs +6 -7
- package/engine/content-index.mjs +1 -1
- package/engine/content-links.mjs +3 -3
- package/engine/content-lint.mjs +1 -1
- package/engine/content-render.mjs +453 -0
- package/engine/content-scripts.mjs +376 -43
- package/engine/content-spans.mjs +6 -3
- package/engine/content-styles.mjs +91 -0
- package/engine/content-symbols.mjs +186 -0
- package/engine/content-verse.mjs +738 -0
- package/engine/core-report.mjs +169 -0
- package/engine/core-vocabulary.mjs +208 -0
- package/engine/dictionary-html.mjs +119 -0
- package/engine/dictionary-rows.mjs +15 -4
- package/engine/field-reference.mjs +5 -5
- package/engine/first-use.mjs +17 -27
- package/engine/frontmatter-lint.mjs +1 -1
- package/engine/heading-attributes.mjs +89 -0
- package/engine/helpers.mjs +61 -101
- package/engine/homepage.mjs +17 -29
- package/engine/html-minify.mjs +70 -0
- package/engine/index.mjs +8 -5
- package/engine/key-case-collisions.mjs +136 -0
- package/engine/language-data.mjs +203 -6
- package/engine/language-rows.mjs +8 -2
- package/engine/language-terms.mjs +186 -16
- package/engine/language-words.mjs +12 -0
- package/engine/logographic.mjs +255 -0
- package/engine/map-lexicon.mjs +262 -47
- package/engine/map-places.mjs +5 -4
- package/engine/markdown-expressions.mjs +0 -2
- package/engine/markdownlint-run.mjs +9 -3
- package/engine/markup-validation.mjs +21 -0
- package/engine/metre-declaration.mjs +134 -0
- package/engine/names.mjs +36 -9
- package/engine/note-matter.mjs +66 -0
- package/engine/note-vocabulary.mjs +187 -3
- package/engine/pdf-build.mjs +69 -133
- package/engine/pdf-render.mjs +205 -58
- package/engine/post-fields.mjs +157 -0
- package/engine/preview-index.mjs +130 -0
- package/engine/preview-source.mjs +450 -0
- package/engine/project-init.mjs +5 -12
- package/engine/prose-config.mjs +3 -3
- package/engine/read-stdin.mjs +29 -0
- package/engine/run-rows.mjs +2 -2
- package/engine/run-words.mjs +6 -112
- package/engine/script-emphasis-terms.mjs +38 -0
- package/engine/script-emphasis.mjs +295 -0
- package/engine/script-font-delivery.mjs +4 -4
- package/engine/site-build.mjs +260 -315
- package/engine/site-config.mjs +26 -238
- package/engine/site-files.mjs +175 -0
- package/engine/site-index.mjs +9 -4
- package/engine/site-preview.mjs +52 -525
- package/engine/site-render.mjs +593 -0
- package/engine/site-root.mjs +22 -13
- package/engine/site-search.mjs +161 -0
- package/engine/site-serve.mjs +273 -0
- package/engine/site-theme-banner.mjs +154 -0
- package/engine/site-theme-urls.mjs +125 -0
- package/engine/site-theme.mjs +926 -0
- package/engine/sql-tables.mjs +20 -3
- package/engine/text-maps.mjs +57 -10
- package/engine/typographer.mjs +248 -0
- package/engine/verse-metre.mjs +357 -0
- package/engine/wikilink-syntax.mjs +29 -47
- package/engine/wikilinks.mjs +758 -279
- package/engine/word-forms.mjs +364 -0
- package/engine/word-rows.mjs +12 -2
- package/engine/word-terms.mjs +38 -4
- package/manifest.mjs +3 -4
- package/package.json +11 -8
- package/{hugo-theme → site-theme}/data/banners.yaml +6 -10
- package/site-theme/layouts/base.hbs +31 -0
- package/site-theme/layouts/blog-list.hbs +30 -0
- package/site-theme/layouts/blog-post.hbs +40 -0
- package/site-theme/layouts/home.hbs +35 -0
- package/site-theme/layouts/list.hbs +20 -0
- package/site-theme/layouts/not-found.hbs +31 -0
- package/site-theme/layouts/page.hbs +7 -0
- package/site-theme/partials/copy-buttons.hbs +37 -0
- package/site-theme/partials/draft-notice.hbs +5 -0
- package/site-theme/partials/exturl.hbs +2 -0
- package/{hugo-theme/layouts/partials/footer.html → site-theme/partials/footer.hbs} +10 -7
- package/site-theme/partials/header.hbs +44 -0
- package/site-theme/partials/hero-banner.hbs +11 -0
- package/site-theme/partials/infobox-entry.hbs +2 -0
- package/site-theme/partials/infobox-section.hbs +31 -0
- package/site-theme/partials/infobox-value.hbs +2 -0
- package/site-theme/partials/infobox.hbs +18 -0
- package/site-theme/partials/list-members.hbs +9 -0
- package/site-theme/partials/nav-links.hbs +5 -0
- package/site-theme/partials/page-body.hbs +48 -0
- package/site-theme/partials/page-list.hbs +14 -0
- package/site-theme/partials/related.hbs +24 -0
- package/site-theme/partials/search-meta.hbs +6 -0
- package/site-theme/partials/search-names.hbs +2 -0
- package/site-theme/partials/search.hbs +52 -0
- package/site-theme/partials/tags.hbs +4 -0
- package/site-theme/partials/toc.hbs +7 -0
- package/{hugo-theme → site-theme}/static/css/style.css +106 -14
- package/stage.mjs +1 -2
- package/types/config.d.mts +8 -4
- package/types/content-config.d.mts +15 -15
- package/types/engine/asset-shipping.d.mts +5 -2
- package/types/engine/base-compiler.d.mts +20 -2
- package/types/engine/code-fences.d.mts +3 -3
- package/types/engine/content-address.d.mts +1 -1
- package/types/engine/content-alerts.d.mts +8 -2
- package/types/engine/content-blocks.d.mts +11 -4
- package/types/engine/content-expand.d.mts +288 -0
- package/types/engine/content-figures.d.mts +11 -3
- package/types/engine/content-glyphs.d.mts +85 -0
- package/types/engine/content-images.d.mts +6 -7
- package/types/engine/content-links.d.mts +1 -1
- package/types/engine/content-render.d.mts +199 -0
- package/types/engine/content-scripts.d.mts +70 -4
- package/types/engine/content-spans.d.mts +1 -1
- package/types/engine/content-styles.d.mts +33 -0
- package/types/engine/content-symbols.d.mts +35 -0
- package/types/engine/content-verse.d.mts +240 -0
- package/types/engine/core-report.d.mts +45 -0
- package/types/engine/core-vocabulary.d.mts +53 -0
- package/types/engine/dictionary-html.d.mts +8 -0
- package/types/engine/dictionary-rows.d.mts +10 -0
- package/types/engine/field-reference.d.mts +2 -2
- package/types/engine/heading-attributes.d.mts +20 -0
- package/types/engine/helpers.d.mts +3 -10
- package/types/engine/homepage.d.mts +11 -24
- package/types/engine/html-minify.d.mts +9 -0
- package/types/engine/index.d.mts +2 -1
- package/types/engine/key-case-collisions.d.mts +28 -0
- package/types/engine/language-data.d.mts +0 -2
- package/types/engine/language-terms.d.mts +24 -2
- package/types/engine/logographic.d.mts +45 -0
- package/types/engine/map-lexicon.d.mts +66 -13
- package/types/engine/map-places.d.mts +8 -0
- package/types/engine/markdown-expressions.d.mts +0 -2
- package/types/engine/metre-declaration.d.mts +39 -0
- package/types/engine/names.d.mts +34 -3
- package/types/engine/note-matter.d.mts +48 -0
- package/types/engine/pdf-render.d.mts +6 -2
- package/types/engine/post-fields.d.mts +44 -0
- package/types/engine/preview-index.d.mts +72 -0
- package/types/engine/preview-source.d.mts +51 -0
- package/types/engine/read-stdin.d.mts +11 -0
- package/types/engine/run-rows.d.mts +2 -2
- package/types/engine/run-words.d.mts +0 -15
- package/types/engine/script-emphasis-terms.d.mts +21 -0
- package/types/engine/script-emphasis.d.mts +84 -0
- package/types/engine/script-font-delivery.d.mts +4 -4
- package/types/engine/site-build.d.mts +71 -113
- package/types/engine/site-config.d.mts +14 -134
- package/types/engine/site-files.d.mts +73 -0
- package/types/engine/site-index.d.mts +11 -3
- package/types/engine/site-preview.d.mts +15 -19
- package/types/engine/site-render.d.mts +171 -0
- package/types/engine/site-root.d.mts +12 -4
- package/types/engine/site-search.d.mts +54 -0
- package/types/engine/site-serve.d.mts +44 -0
- package/types/engine/site-theme-banner.d.mts +51 -0
- package/types/engine/site-theme-urls.d.mts +60 -0
- package/types/engine/site-theme.d.mts +127 -0
- package/types/engine/sql-tables.d.mts +4 -1
- package/types/engine/text-maps.d.mts +17 -3
- package/types/engine/typographer.d.mts +11 -0
- package/types/engine/verse-metre.d.mts +131 -0
- package/types/engine/wikilink-syntax.d.mts +30 -48
- package/types/engine/wikilinks.d.mts +330 -14
- package/types/engine/word-forms.d.mts +83 -0
- package/types/manifest.d.mts +3 -4
- package/types/stage.d.mts +1 -2
- package/types/vendor/markdownlint.d.mts +8 -0
- package/vendor/markdownlint.mjs +20388 -0
- package/engine/content-poetry.mjs +0 -240
- package/engine/web-wikilinks.mjs +0 -594
- package/hugo-theme/layouts/404.html +0 -85
- package/hugo-theme/layouts/_default/baseof.html +0 -67
- package/hugo-theme/layouts/_default/list.html +0 -139
- package/hugo-theme/layouts/_default/single.html +0 -4
- package/hugo-theme/layouts/blog/list.html +0 -54
- package/hugo-theme/layouts/blog-post/single.html +0 -36
- package/hugo-theme/layouts/index.html +0 -75
- package/hugo-theme/layouts/partials/banner-url.html +0 -141
- package/hugo-theme/layouts/partials/cdn-url.html +0 -36
- package/hugo-theme/layouts/partials/dictionary-lists.html +0 -58
- package/hugo-theme/layouts/partials/draft-notice.html +0 -41
- package/hugo-theme/layouts/partials/draft-state.html +0 -26
- package/hugo-theme/layouts/partials/header.html +0 -35
- package/hugo-theme/layouts/partials/hero-banner.html +0 -85
- package/hugo-theme/layouts/partials/infobox/entry.html +0 -18
- package/hugo-theme/layouts/partials/infobox/items.html +0 -26
- package/hugo-theme/layouts/partials/infobox/section.html +0 -56
- package/hugo-theme/layouts/partials/infobox/value.html +0 -43
- package/hugo-theme/layouts/partials/infobox.html +0 -57
- package/hugo-theme/layouts/partials/page-body.html +0 -152
- package/hugo-theme/layouts/partials/related.html +0 -138
- package/hugo-theme/layouts/partials/search.html +0 -84
- package/hugo-theme/layouts/partials/site-url.html +0 -32
- package/hugo-theme/layouts/partials/tags.html +0 -30
- package/hugo-theme/layouts/partials/toc.html +0 -28
- package/hugo-theme/layouts/partials/warn-missing-banner.html +0 -3
- package/hugo-theme/layouts/shortcodes/cartouche.html +0 -64
- package/hugo-theme/layouts/shortcodes/exturl.html +0 -12
- package/hugo-theme/layouts/shortcodes/glyph.html +0 -43
- package/hugo-theme/layouts/shortcodes/pagelist.html +0 -63
- package/hugo-theme/theme.toml +0 -11
- package/types/engine/content-poetry.d.mts +0 -58
- package/types/engine/web-wikilinks.d.mts +0 -107
- /package/{hugo-theme → site-theme}/data/banner-kinds.yaml +0 -0
- /package/{hugo-theme → site-theme}/static/css/sohl-icons.css +0 -0
- /package/{hugo-theme → site-theme}/static/fonts/game-icons-kb.woff2 +0 -0
- /package/{hugo-theme → site-theme}/static/img/banners/takheperu-hieroglyphs.svg +0 -0
- /package/{hugo-theme → site-theme}/static/img/cartouches/takheperu.svg +0 -0
- /package/{hugo-theme → site-theme}/static/js/inline-spoilers.js +0 -0
|
@@ -69,19 +69,86 @@ export function buildWikilinkIndex(docs: Array<{
|
|
|
69
69
|
types: Set<string>;
|
|
70
70
|
};
|
|
71
71
|
/**
|
|
72
|
-
*
|
|
72
|
+
* Resolve every wikilink in a markdown body, and write each in one target's
|
|
73
|
+
* form.
|
|
73
74
|
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
75
|
+
* The one link resolver. The two indexes a link is read against differ, and
|
|
76
|
+
* only that differs, so the index is a {@link LinkView} and the target a
|
|
77
|
+
* writer: {@link convertWikilinks} and {@link resolveWebWikilinks} are this,
|
|
78
|
+
* with their own view and writer.
|
|
77
79
|
*
|
|
78
80
|
* **Code is verbatim.** A `[[…]]` inside a fenced or indented code block, or
|
|
79
81
|
* inside an inline code span, is source text an author wrote to be read as
|
|
80
|
-
* written, so it is left alone and not reported. Without that, a
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
82
|
+
* written, so it is left alone and not reported. Without that, a script sample
|
|
83
|
+
* containing `grid[[0]]` would become a link — and only for some array shapes,
|
|
84
|
+
* `[[1,2],[3,4]]` having an inner `]` the pattern cannot cross.
|
|
85
|
+
*
|
|
86
|
+
* **Every failure is a finding**, classified into the vocabulary
|
|
87
|
+
* {@link LINK_FINDING_REASONS} names for every reader of a link. A finding
|
|
88
|
+
* keeps the link's `offset` in `markdown` and its `occurrence` — the how-many-th
|
|
89
|
+
* finding on that literal — so a caller can report the line and column it sits
|
|
90
|
+
* on by either.
|
|
91
|
+
*
|
|
92
|
+
* @param {string} markdown - The body.
|
|
93
|
+
* @param {object} opts
|
|
94
|
+
* @param {LinkView} opts.view - The index the links resolve against.
|
|
95
|
+
* @param {(link: ResolvedLink) => string} opts.write - The target's writer,
|
|
96
|
+
* from {@link LINK_WRITERS}.
|
|
97
|
+
* @param {Map<string, string>} [opts.captionLabels] - Numbered caption labels.
|
|
98
|
+
* @returns {{markdown: string, links: ResolvedLink[], findings: Array<{link:
|
|
99
|
+
* string, offset: number, occurrence: number, target: string, reason:
|
|
100
|
+
* string}>, resolved: object[]}} The written body; every link in body order;
|
|
101
|
+
* the findings; and every destination a link outside its own page resolved
|
|
102
|
+
* to, in body order, repeats included — the page's edges.
|
|
103
|
+
*/
|
|
104
|
+
export function resolveWikilinks(markdown: string, { view, write, captionLabels }: {
|
|
105
|
+
view: LinkView;
|
|
106
|
+
write: (link: ResolvedLink) => string;
|
|
107
|
+
captionLabels?: Map<string, string> | undefined;
|
|
108
|
+
}): {
|
|
109
|
+
markdown: string;
|
|
110
|
+
links: ResolvedLink[];
|
|
111
|
+
findings: Array<{
|
|
112
|
+
link: string;
|
|
113
|
+
offset: number;
|
|
114
|
+
occurrence: number;
|
|
115
|
+
target: string;
|
|
116
|
+
reason: string;
|
|
117
|
+
}>;
|
|
118
|
+
resolved: object[];
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* The pack compile's view of a link: {@link buildWikilinkIndex}'s index,
|
|
122
|
+
* answered with compendium UUIDs.
|
|
123
|
+
*
|
|
124
|
+
* `[[type-shortcode|Text]]` defaults to the readable `note` Address. A stated
|
|
125
|
+
* game system names an Actor or Item; `none` names a systemless document.
|
|
126
|
+
* `doc<type>` names the readable note of an item. A journal link may carry a
|
|
127
|
+
* heading anchor, which addresses the journal's page for it; an Actor, Item or
|
|
128
|
+
* Macro link opens a sheet, which has no sections, so its anchor addresses
|
|
129
|
+
* nothing and is dropped.
|
|
130
|
+
*
|
|
131
|
+
* @param {object} index - From {@link buildWikilinkIndex}.
|
|
132
|
+
* @param {object} source - The note the links are written on.
|
|
133
|
+
* @param {string} source.type - Its type.
|
|
134
|
+
* @param {string} source.id - Its document id.
|
|
135
|
+
* @param {string} [source.pack] - The pack its own document lands in.
|
|
136
|
+
* @param {string} [source.docPack] - The pack its documentation entry lands in.
|
|
137
|
+
* @returns {LinkView} The view.
|
|
138
|
+
*/
|
|
139
|
+
export function packLinkView(index: object, { type, id, pack, docPack }: {
|
|
140
|
+
type: string;
|
|
141
|
+
id: string;
|
|
142
|
+
pack?: string | undefined;
|
|
143
|
+
docPack?: string | undefined;
|
|
144
|
+
}): LinkView;
|
|
145
|
+
/**
|
|
146
|
+
* Rewrites every wikilink in a markdown body as a Foundry UUID enricher — see
|
|
147
|
+
* {@link resolveWikilinks}, with the pack compile's {@link packLinkView} and
|
|
148
|
+
* the `foundry` {@link LINK_WRITERS} entry.
|
|
149
|
+
*
|
|
150
|
+
* A link that cannot be resolved renders marked and is reported in
|
|
151
|
+
* `unresolved`.
|
|
85
152
|
*
|
|
86
153
|
* @param {string} markdown - The note body (frontmatter already stripped).
|
|
87
154
|
* @param {object} ctx
|
|
@@ -96,10 +163,10 @@ export function buildWikilinkIndex(docs: Array<{
|
|
|
96
163
|
* @param {{byShortcode: Map, types: Set}} ctx.index - From
|
|
97
164
|
* {@link buildWikilinkIndex}.
|
|
98
165
|
* @param {Map<string, string>} [ctx.captionLabels] - Numbered caption references.
|
|
99
|
-
* @returns {{markdown: string, unresolved: Array<{link:
|
|
100
|
-
* offset: number, reason: string, packages?:
|
|
101
|
-
* Each `reason` is one of
|
|
102
|
-
*
|
|
166
|
+
* @returns {{markdown: string, links: ResolvedLink[], unresolved: Array<{link:
|
|
167
|
+
* string, target: string, offset: number, reason: string, packages?:
|
|
168
|
+
* string[], anchor?: string}>}} Each `reason` is one of
|
|
169
|
+
* {@link LINK_FINDING_REASONS} — `ambiguous` carries the claiming `packages`
|
|
103
170
|
* and `unknown-anchor` the section it named. `offset` is the link's 0-based
|
|
104
171
|
* position in `markdown`, which is what lets a caller report the line and
|
|
105
172
|
* column it sits on.
|
|
@@ -116,6 +183,7 @@ export function convertWikilinks(markdown: string, { type, id, pack, docPack, in
|
|
|
116
183
|
captionLabels?: Map<string, string> | undefined;
|
|
117
184
|
}): {
|
|
118
185
|
markdown: string;
|
|
186
|
+
links: ResolvedLink[];
|
|
119
187
|
unresolved: Array<{
|
|
120
188
|
link: string;
|
|
121
189
|
target: string;
|
|
@@ -148,9 +216,257 @@ export function resolveReference(index: object, ref: unknown, hint?: object): {
|
|
|
148
216
|
subType?: string;
|
|
149
217
|
standings?: object;
|
|
150
218
|
} | undefined;
|
|
219
|
+
/**
|
|
220
|
+
* The website's and the book's view of a link: the site index, answered with
|
|
221
|
+
* URLs.
|
|
222
|
+
*
|
|
223
|
+
* The site index is keyed case-insensitively by the canonical
|
|
224
|
+
* `package-system-type-shortcode` address, by `type/shortcode` and by the
|
|
225
|
+
* site's own `section/slug`; a fully qualified address another package
|
|
226
|
+
* publishes is looked up in its fetched index. Local wins: a live build is
|
|
227
|
+
* authoritative and a fetched index can only be staler. A short address two
|
|
228
|
+
* packages claim is in the index's `ambiguous` set, and is a finding of its
|
|
229
|
+
* own.
|
|
230
|
+
*
|
|
231
|
+
* A target that **resolved** to an entry with no page is not unresolved: a
|
|
232
|
+
* pack-only package publishes Foundry addresses and no web pages, so the
|
|
233
|
+
* author wrote a real address and there is simply nothing to link to.
|
|
234
|
+
*
|
|
235
|
+
* @param {object} ctx - What {@link module:engine/site-index.wikiContext}
|
|
236
|
+
* returns, with the page's own `anchors` and `eventAnchors`.
|
|
237
|
+
* @param {string} body - The page's text, which a link to its own section is
|
|
238
|
+
* concealed by when the section is secret.
|
|
239
|
+
* @returns {LinkView} The view.
|
|
240
|
+
*/
|
|
241
|
+
export function siteLinkView(ctx: object, body: string): LinkView;
|
|
242
|
+
/**
|
|
243
|
+
* Every wikilink authored inside a frontmatter value.
|
|
244
|
+
*
|
|
245
|
+
* Wikilinks are resolved in a note's **body**. Frontmatter is not markdown and
|
|
246
|
+
* is never walked by the resolver, so a link written in one would be copied
|
|
247
|
+
* through verbatim and reach the reader as literal `[[…]]` text, in whatever the
|
|
248
|
+
* theme renders that field as (an infobox row, a description, a card
|
|
249
|
+
* subtitle). Nothing downstream notices: the value is a valid string, the page
|
|
250
|
+
* builds, and the defect is visible only to someone who looks at it.
|
|
251
|
+
*
|
|
252
|
+
* So the form is refused rather than resolved. Resolving it would mean choosing
|
|
253
|
+
* an output syntax for a field whose renderer is unknown to this build — a
|
|
254
|
+
* markdown link is inert in a template that prints the value as text, and an
|
|
255
|
+
* `<a>` is unusable in one that escapes it — and would quietly bless an
|
|
256
|
+
* authoring habit that the pack build has no way to honour at all. Frontmatter
|
|
257
|
+
* carries data; a link belongs in prose.
|
|
258
|
+
*
|
|
259
|
+
* Values are read from the *parsed* frontmatter, so a `[[` inside a YAML comment
|
|
260
|
+
* is not a hit, and every hit can be named by the path a reader would look at.
|
|
261
|
+
*
|
|
262
|
+
* @param {unknown} fm - Parsed frontmatter, as `readMatter` returns it.
|
|
263
|
+
* @returns {Array<{path: string, link: string}>} In reading order; `path` is the
|
|
264
|
+
* dotted key path of the offending value (`government.summary`, `aliases.1`).
|
|
265
|
+
*/
|
|
266
|
+
export function frontmatterWikilinks(fm: unknown): Array<{
|
|
267
|
+
path: string;
|
|
268
|
+
link: string;
|
|
269
|
+
}>;
|
|
270
|
+
/**
|
|
271
|
+
* Rewrites the embeds and wikilinks in a markdown body for the website or the
|
|
272
|
+
* book — see {@link resolveWikilinks}, with {@link siteLinkView} and the `web`
|
|
273
|
+
* or `book` {@link LINK_WRITERS} entry.
|
|
274
|
+
*
|
|
275
|
+
* `[[type-shortcode|Text]]` → `[Text](/section/slug/)`
|
|
276
|
+
* `[[type-shortcode|]]` → the same, showing the target's own name
|
|
277
|
+
* `[[type-shortcode#slug|Text]]` → `[Text](/section/slug/#slug)`
|
|
278
|
+
* `[[#slug|Text]]` → `[Text](#slug)`
|
|
279
|
+
*
|
|
280
|
+
* **Every target that resolves nowhere fails the build.** Failures are
|
|
281
|
+
* collected in `ctx.errors`, each carrying the authored `link` and its
|
|
282
|
+
* `occurrence` so a caller can report the line and column it sits on. The
|
|
283
|
+
* link still renders, marked: the mark is for whoever reads the page, the
|
|
284
|
+
* failure for its author.
|
|
285
|
+
*
|
|
286
|
+
* ## Embeds first, and they are not links
|
|
287
|
+
*
|
|
288
|
+
* `![[address|label]]` names a file rather than a note, so it is resolved into
|
|
289
|
+
* an ordinary markdown image before anything looks for a link — which is what
|
|
290
|
+
* stops the link pass reading an embed's interior as a link to a note nobody
|
|
291
|
+
* wrote. The image the rewrite leaves behind is what
|
|
292
|
+
* {@link module:engine/content-images.renderImageFigures} turns into a figure
|
|
293
|
+
* for the website, and what the book reads its staging list out of.
|
|
294
|
+
*
|
|
295
|
+
* ## Every hit is recorded, so the page's edges come out of one pass
|
|
296
|
+
*
|
|
297
|
+
* A caller that hands in `ctx.resolved` is given every index entry a link on
|
|
298
|
+
* the page resolved to, in body order, repeats included. Nothing is recorded
|
|
299
|
+
* for a same-page anchor or for a target that resolved nowhere.
|
|
300
|
+
*
|
|
301
|
+
* @param {string} body - The markdown body.
|
|
302
|
+
* @param {object} ctx - `{ index, assets, collide, contentTypes, packages,
|
|
303
|
+
* noIndexPackages, foreign, errors, src, file, resolved, output, anchors,
|
|
304
|
+
* eventAnchors, captionLabels }`, as
|
|
305
|
+
* {@link module:engine/site-index.wikiContext} builds it. `output` is
|
|
306
|
+
* `"book"` for the book and defaults to the website. `anchors` and
|
|
307
|
+
* `eventAnchors` are what *this* page declares, which a `[[#slug]]`
|
|
308
|
+
* self-link is checked against; absent, a self-link is not checked. `src`
|
|
309
|
+
* is the page's display path and `file` the source file a diagnostic names
|
|
310
|
+
* — absent, `src` stands in.
|
|
311
|
+
* @returns {string} The body with embeds and wikilinks rewritten.
|
|
312
|
+
*/
|
|
313
|
+
export function resolveWebWikilinks(body: string, ctx: object): string;
|
|
314
|
+
/**
|
|
315
|
+
* How each target writes a {@link ResolvedLink}.
|
|
316
|
+
*
|
|
317
|
+
* | | `foundry` | `web` | `book` |
|
|
318
|
+
* | --- | --- | --- | --- |
|
|
319
|
+
* | a link | `@UUID[…]{text}`, a content link that survives import into a world | `[text](url)`, the page's relative URL | `[text](url)`, which the book sets as a cross-reference to the entry it prints, or as the page's address where it prints none |
|
|
320
|
+
* | a draft target | the link in a `sohl-draft-link` span | the same span | the link, then `(draft)` |
|
|
321
|
+
* | nothing to open | the text | the text, marked when the target is a draft | the text, then `(draft)` when the target is one |
|
|
322
|
+
* | unresolved | the text in a `sohl-unresolved-link` span | the same span | the text, then `(unresolved link)` |
|
|
323
|
+
*
|
|
324
|
+
* A link to a GM-only note, or to a secret section, is concealed by
|
|
325
|
+
* {@link presentWikilink} on every target alike.
|
|
326
|
+
*
|
|
327
|
+
* Foundry does not mark a link to a note another package publishes as a
|
|
328
|
+
* draft: its `@UUID` names the document the dependency installed, and the
|
|
329
|
+
* dependency's journal is what the reader opens.
|
|
330
|
+
*
|
|
331
|
+
* @type {Readonly<Record<"foundry"|"web"|"book", (link: ResolvedLink) => string>>}
|
|
332
|
+
*/
|
|
333
|
+
export const LINK_WRITERS: Readonly<Record<"foundry" | "web" | "book", (link: ResolvedLink) => string>>;
|
|
334
|
+
/**
|
|
335
|
+
* A wikilink once it is resolved, before any target writes it.
|
|
336
|
+
*
|
|
337
|
+
* This is the link's **neutral form**: what it names and how it reads, with no
|
|
338
|
+
* target's syntax in it. Each target writes it through its own
|
|
339
|
+
* {@link LINK_WRITERS} entry, so one authored link reaches a Foundry journal as
|
|
340
|
+
* an `@UUID` content link, a web page as a relative URL and the book as a
|
|
341
|
+
* cross-reference, from the same resolution.
|
|
342
|
+
*/
|
|
343
|
+
export type ResolvedLink = {
|
|
344
|
+
/**
|
|
345
|
+
* - `link`: the target has a
|
|
346
|
+
* destination the reader can open. `text`: the address is real and names a
|
|
347
|
+
* note with nothing to open — a note with no single Foundry document, or one
|
|
348
|
+
* a package publishing no pages holds — so the reader gets the words.
|
|
349
|
+
* `unresolved`: the link is a finding, and the words are kept, marked.
|
|
350
|
+
*/
|
|
351
|
+
kind: "link" | "text" | "unresolved";
|
|
352
|
+
/**
|
|
353
|
+
* - What the reader sees.
|
|
354
|
+
*/
|
|
355
|
+
text: string;
|
|
356
|
+
/**
|
|
357
|
+
* - The link exactly as authored.
|
|
358
|
+
*/
|
|
359
|
+
literal: string;
|
|
360
|
+
/**
|
|
361
|
+
* - The target as authored, `""` for a link to a
|
|
362
|
+
* section of the same page.
|
|
363
|
+
*/
|
|
364
|
+
target: string;
|
|
365
|
+
/**
|
|
366
|
+
* - The `#section` named, `""` when none.
|
|
367
|
+
*/
|
|
368
|
+
anchor: string;
|
|
369
|
+
/**
|
|
370
|
+
* - Whether it names a section of its own page.
|
|
371
|
+
*/
|
|
372
|
+
samePage: boolean;
|
|
373
|
+
/**
|
|
374
|
+
* - The canonical address it names, the
|
|
375
|
+
* same on every target; `undefined` for a same-page link and for a target
|
|
376
|
+
* that is not an address.
|
|
377
|
+
*/
|
|
378
|
+
address: string | undefined;
|
|
379
|
+
/**
|
|
380
|
+
* - The Foundry document or page it opens.
|
|
381
|
+
*/
|
|
382
|
+
uuid?: string | undefined;
|
|
383
|
+
/**
|
|
384
|
+
* - The URL it opens on the web and in the book,
|
|
385
|
+
* fragment included.
|
|
386
|
+
*/
|
|
387
|
+
href?: string | undefined;
|
|
388
|
+
/**
|
|
389
|
+
* - Whether it names a note tagged `draft`.
|
|
390
|
+
*/
|
|
391
|
+
draft: boolean;
|
|
392
|
+
/**
|
|
393
|
+
* - What it resolved to: an index entry,
|
|
394
|
+
* which decides whether the reference is concealed.
|
|
395
|
+
*/
|
|
396
|
+
destination?: object | undefined;
|
|
397
|
+
/**
|
|
398
|
+
* - The link's parts, from {@link readWikilink}.
|
|
399
|
+
*/
|
|
400
|
+
parsed: object;
|
|
401
|
+
/**
|
|
402
|
+
* - For `unresolved`, what is wrong: a `reason`
|
|
403
|
+
* from {@link LINK_FINDING_REASONS}, the `target` the message names, and the
|
|
404
|
+
* fields that reason carries.
|
|
405
|
+
*/
|
|
406
|
+
finding?: object | undefined;
|
|
407
|
+
};
|
|
408
|
+
/**
|
|
409
|
+
* What one index answers a link with: the half of resolution that depends on
|
|
410
|
+
* which index is read. A pack compile reads {@link buildWikilinkIndex}'s
|
|
411
|
+
* index and answers with UUIDs ({@link packLinkView}); the website and the
|
|
412
|
+
* book read the site index and answer with URLs ({@link siteLinkView}).
|
|
413
|
+
* Everything else — the syntax, the label rule, which failure is which, and
|
|
414
|
+
* the order the checks run in — is {@link resolveWikilinks}'s, once.
|
|
415
|
+
*/
|
|
416
|
+
export type LinkView = {
|
|
417
|
+
/**
|
|
418
|
+
* - The Address context a target is read in:
|
|
419
|
+
* `{package, system, types, packages, noIndexPackages}`.
|
|
420
|
+
*/
|
|
421
|
+
context: object;
|
|
422
|
+
/**
|
|
423
|
+
* - The page the link is written
|
|
424
|
+
* on, as a destination.
|
|
425
|
+
*/
|
|
426
|
+
self: (markdown: string) => object;
|
|
427
|
+
/**
|
|
428
|
+
* - What an address names: a destination, which
|
|
429
|
+
* may be an item's readable note or another package's note; a claim by more
|
|
430
|
+
* than one package; or nothing.
|
|
431
|
+
*/
|
|
432
|
+
find: (read: object, target: string) => ({
|
|
433
|
+
destination: object;
|
|
434
|
+
itemDoc?: boolean;
|
|
435
|
+
foreign?: boolean;
|
|
436
|
+
} | {
|
|
437
|
+
ambiguous: true;
|
|
438
|
+
packages?: string[];
|
|
439
|
+
} | undefined);
|
|
440
|
+
/**
|
|
441
|
+
* - Whether a
|
|
442
|
+
* target that is not an address is a short address two packages claim.
|
|
443
|
+
*/
|
|
444
|
+
collides: (read: object, target: string) => boolean;
|
|
445
|
+
/**
|
|
446
|
+
* - Whether a lowercase
|
|
447
|
+
* spelling of the shortcode names a note.
|
|
448
|
+
*/
|
|
449
|
+
declared: (read: object) => boolean;
|
|
450
|
+
/**
|
|
451
|
+
* - Where a destination opens: a finding reason
|
|
452
|
+
* when the anchor does not belong to it, the UUID or URL it opens, or
|
|
453
|
+
* neither when there is nothing to open.
|
|
454
|
+
*/
|
|
455
|
+
locate: (destination: object, anchor: string, how: {
|
|
456
|
+
samePage: boolean;
|
|
457
|
+
itemDoc?: boolean;
|
|
458
|
+
foreign?: boolean;
|
|
459
|
+
}) => {
|
|
460
|
+
reason?: string;
|
|
461
|
+
uuid?: string;
|
|
462
|
+
href?: string;
|
|
463
|
+
draft?: boolean;
|
|
464
|
+
};
|
|
465
|
+
};
|
|
466
|
+
import { slugify } from "./content-slug.mjs";
|
|
151
467
|
import { ITEM_PACK } from "./ids.mjs";
|
|
152
468
|
import { PACK_BY_TYPE } from "./ids.mjs";
|
|
153
469
|
import { packForType } from "./ids.mjs";
|
|
154
470
|
import { readQualifier } from "./address.mjs";
|
|
155
471
|
import { resolveItemDocType } from "./address.mjs";
|
|
156
|
-
export { ITEM_PACK, PACK_BY_TYPE, packForType, readQualifier, resolveItemDocType };
|
|
472
|
+
export { slugify, ITEM_PACK, PACK_BY_TYPE, packForType, readQualifier, resolveItemDocType };
|
|
@@ -0,0 +1,83 @@
|
|
|
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
|
+
* Add a text's words to a set, each whole and each part of a compound.
|
|
10
|
+
*
|
|
11
|
+
* @param {Set<string>} set - The set.
|
|
12
|
+
* @param {string} text - A form or a name.
|
|
13
|
+
*/
|
|
14
|
+
export function addWords(set: Set<string>, text: string): void;
|
|
15
|
+
/**
|
|
16
|
+
* One form a rule derives from a lexicon word.
|
|
17
|
+
*
|
|
18
|
+
* @typedef {object} DerivedForm
|
|
19
|
+
* @property {string} form - The form, folded.
|
|
20
|
+
* @property {Record<string, any>} word - The `data.words` entry it comes from.
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Every form the language's rules derive from its lexicon words, and each
|
|
24
|
+
* declared variant of a word, in `data.words` order, each once, leaving out a
|
|
25
|
+
* form that is a lexicon word.
|
|
26
|
+
*
|
|
27
|
+
* @param {Record<string, any>|undefined} data - The language note's `data`.
|
|
28
|
+
* @returns {DerivedForm[]} The forms.
|
|
29
|
+
*/
|
|
30
|
+
export function derivedForms(data: Record<string, any> | undefined): DerivedForm[];
|
|
31
|
+
/**
|
|
32
|
+
* The words a language note accepts of its own: its forms, and what its rules
|
|
33
|
+
* derive from them (see {@link derivedForms}), each whole and each part of a
|
|
34
|
+
* compound.
|
|
35
|
+
*
|
|
36
|
+
* @param {Record<string, any>} data - The language note's `data`.
|
|
37
|
+
* @returns {Set<string>} The words, folded.
|
|
38
|
+
*/
|
|
39
|
+
export function lexiconWords(data: Record<string, any>): Set<string>;
|
|
40
|
+
/**
|
|
41
|
+
* A language's agreement rule, as derivation reads it.
|
|
42
|
+
*/
|
|
43
|
+
export type Agreement = {
|
|
44
|
+
/**
|
|
45
|
+
* - The class bases that agree.
|
|
46
|
+
*/
|
|
47
|
+
classes: ReadonlySet<string>;
|
|
48
|
+
/**
|
|
49
|
+
* - The endings, folded, longest first.
|
|
50
|
+
*/
|
|
51
|
+
endings: readonly string[];
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* A language's participle rule, as derivation reads it.
|
|
55
|
+
*/
|
|
56
|
+
export type Participles = {
|
|
57
|
+
/**
|
|
58
|
+
* - The root endings, folded, longest
|
|
59
|
+
* first.
|
|
60
|
+
*/
|
|
61
|
+
root: readonly string[];
|
|
62
|
+
/**
|
|
63
|
+
* -
|
|
64
|
+
* The participle suffixes, folded.
|
|
65
|
+
*/
|
|
66
|
+
suffixes: Array<{
|
|
67
|
+
suffix: string;
|
|
68
|
+
replaces: string | undefined;
|
|
69
|
+
}>;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* One form a rule derives from a lexicon word.
|
|
73
|
+
*/
|
|
74
|
+
export type DerivedForm = {
|
|
75
|
+
/**
|
|
76
|
+
* - The form, folded.
|
|
77
|
+
*/
|
|
78
|
+
form: string;
|
|
79
|
+
/**
|
|
80
|
+
* - The `data.words` entry it comes from.
|
|
81
|
+
*/
|
|
82
|
+
word: Record<string, any>;
|
|
83
|
+
};
|
package/types/manifest.d.mts
CHANGED
|
@@ -27,10 +27,9 @@ export function normalizeRepoUrl(repository: string | {
|
|
|
27
27
|
* to drift — and the one that drifts is this one, because nothing fetches `url`
|
|
28
28
|
* the way Foundry fetches `manifest`, so a wrong value is never reported.
|
|
29
29
|
*
|
|
30
|
-
*
|
|
31
|
-
* source: it
|
|
32
|
-
*
|
|
33
|
-
* repository keeps its site configuration.
|
|
30
|
+
* `package.json`'s `homepage` says the same thing, and is deliberately not the
|
|
31
|
+
* source: reading it would mean the packaging half depending on the site's
|
|
32
|
+
* configuration.
|
|
34
33
|
*
|
|
35
34
|
* @param {string} contentPackage - The package's content-package name.
|
|
36
35
|
* @returns {string} The homepage URL, with its trailing slash.
|
package/types/stage.d.mts
CHANGED
|
@@ -88,7 +88,6 @@ export function resetStage(root: string, stageDir: string): boolean;
|
|
|
88
88
|
*
|
|
89
89
|
* A repository adds its own through `packageBuild.clean.extra`, but these four
|
|
90
90
|
* are common to all of them because they come from the shared toolchain rather
|
|
91
|
-
* than from any one package's layout. Everything the site build writes
|
|
92
|
-
* Hugo source tree, Hugo's cache and the rendered site — is under `build/`.
|
|
91
|
+
* than from any one package's layout. Everything the site build writes is under `build/`.
|
|
93
92
|
*/
|
|
94
93
|
export const BUILD_ARTIFACT_DIRS: readonly string[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export function applyFix(line: any, fixInfo: any, lineEnding2?: string): any;
|
|
2
|
+
export function applyFixes(input: any, errors: any): any;
|
|
3
|
+
declare function extendConfigPromise(config: any, file: any, parsers: any, fs2: any): Promise<any>;
|
|
4
|
+
export function getVersion(): string;
|
|
5
|
+
declare function lintPromise(options: any): Promise<any>;
|
|
6
|
+
declare function readConfigPromise(file: any, parsers: any, fs2: any): Promise<any>;
|
|
7
|
+
declare var export_resolveModule: any;
|
|
8
|
+
export { extendConfigPromise as extendConfig, lintPromise as lint, readConfigPromise as readConfig, export_resolveModule as resolveModule };
|