@dogsbay/types 0.2.0-beta.13 → 0.2.0-beta.131
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/dist/directives.d.ts +124 -0
- package/dist/directives.js +26 -0
- package/dist/format.d.ts +252 -5
- package/dist/format.js +0 -1
- package/dist/frontmatter-check.d.ts +42 -0
- package/dist/frontmatter-check.js +223 -0
- package/dist/frontmatter-schema.d.ts +96 -0
- package/dist/frontmatter-schema.js +243 -0
- package/dist/index.d.ts +9 -4
- package/dist/index.js +4 -2
- package/dist/json.d.ts +0 -1
- package/dist/json.js +0 -1
- package/dist/meta.d.ts +26 -5
- package/dist/meta.js +34 -7
- package/dist/plugin.d.ts +3 -4
- package/dist/plugin.js +0 -1
- package/dist/tree.d.ts +70 -2
- package/dist/tree.js +0 -1
- package/package.json +3 -3
- package/dist/format.d.ts.map +0 -1
- package/dist/format.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/json.d.ts.map +0 -1
- package/dist/json.js.map +0 -1
- package/dist/meta.d.ts.map +0 -1
- package/dist/meta.js.map +0 -1
- package/dist/plugin.d.ts.map +0 -1
- package/dist/plugin.js.map +0 -1
- package/dist/tree.d.ts.map +0 -1
- package/dist/tree.js.map +0 -1
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Directive nodes — source-level DITA/Jinja authoring constructs.
|
|
3
|
+
*
|
|
4
|
+
* ── Corpus survey (2026-07-06) ────────────────────────────────────────
|
|
5
|
+
* The authoritative directive vocabulary is @dogsbay/minja's AST
|
|
6
|
+
* (packages/minja/src/types.ts):
|
|
7
|
+
* - variable `{{ name }}` → VariableNode { name }
|
|
8
|
+
* - if/elif/else `{% if expr %}…` → IfNode { condition, trueBranch, elif[], else }
|
|
9
|
+
* - include `{% include "path" %}` → IncludeNode { path }
|
|
10
|
+
* - set `{% set name = expr %}` → SetNode { name, value }
|
|
11
|
+
* - switch / leveloffset / comment → richer forms
|
|
12
|
+
* AsciiDoc `ifdef`/`ifndef` convert to minja `if` (adoc2md-modular);
|
|
13
|
+
* DITA conref/keyref map to includes/variables (format-dita). Profiling
|
|
14
|
+
* attributes (`@platform`/`@audience`) are plain node `props`, filtered
|
|
15
|
+
* at build via ditaval — no new node type needed.
|
|
16
|
+
*
|
|
17
|
+
* ── Why these types exist ─────────────────────────────────────────────
|
|
18
|
+
* Today these constructs are resolved to a STRING before TreeNode exists
|
|
19
|
+
* (standalone minja; see docs-dev/editor-framework-decision.md). TreeNode
|
|
20
|
+
* is the resolved-output model and has no representation of them. The
|
|
21
|
+
* editor edits the *unresolved source*, so it needs them as first-class,
|
|
22
|
+
* round-trippable nodes. The definitions below are ADDITIVE:
|
|
23
|
+
* - block directives ride TreeNode's open `type: string` — NO union change;
|
|
24
|
+
* - inline directives extend InlineNode via `InlineNodeWithDirectives`
|
|
25
|
+
* (below) rather than the base union, so the monorepo's ~10 exhaustive
|
|
26
|
+
* InlineNode consumers keep compiling. Folding them into the base
|
|
27
|
+
* union and updating those consumers is Phase 2 — see
|
|
28
|
+
* plans/editor-directive-model.md.
|
|
29
|
+
*
|
|
30
|
+
* ── Fidelity rule ─────────────────────────────────────────────────────
|
|
31
|
+
* Anything not modeled first-class (elif/else chains, switch, leveloffset,
|
|
32
|
+
* unknown directives) is preserved verbatim as a `directive-raw` node — a
|
|
33
|
+
* source-of-truth tool must never drop a construct it cannot fully model.
|
|
34
|
+
*/
|
|
35
|
+
import type { TreeNode, InlineNode } from "./tree.js";
|
|
36
|
+
/** `{% if test %} … {% endif %}` — guarded flow content. elif/else: Phase 2. */
|
|
37
|
+
export interface ConditionalNode extends TreeNode {
|
|
38
|
+
type: "conditional";
|
|
39
|
+
/** raw expression source, e.g. `platform == "mac"` */
|
|
40
|
+
props: {
|
|
41
|
+
test: string;
|
|
42
|
+
};
|
|
43
|
+
children: TreeNode[];
|
|
44
|
+
}
|
|
45
|
+
/** `{% include "src" %}` — transclusion of another topic/fragment. */
|
|
46
|
+
export interface IncludeNode extends TreeNode {
|
|
47
|
+
type: "include";
|
|
48
|
+
/** `src` is the include target as written; extra keys pass through */
|
|
49
|
+
props: {
|
|
50
|
+
src: string;
|
|
51
|
+
[key: string]: unknown;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/** `{% set name = value %}` — in-document variable definition. */
|
|
55
|
+
export interface VarDefNode extends TreeNode {
|
|
56
|
+
type: "var-def";
|
|
57
|
+
/** `value` is the raw value-expression source */
|
|
58
|
+
props: {
|
|
59
|
+
name: string;
|
|
60
|
+
value: string;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/** Any directive not modeled first-class, preserved verbatim for round-trip. */
|
|
64
|
+
export interface DirectiveRawNode extends TreeNode {
|
|
65
|
+
type: "directive-raw";
|
|
66
|
+
/** `source` is the exact span; `kind` is a best-effort hint (e.g. "switch") */
|
|
67
|
+
props: {
|
|
68
|
+
source: string;
|
|
69
|
+
kind?: string;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
export type DirectiveBlockNode = ConditionalNode | IncludeNode | VarDefNode | DirectiveRawNode;
|
|
73
|
+
export declare const isConditional: (n: TreeNode) => n is ConditionalNode;
|
|
74
|
+
export declare const isInclude: (n: TreeNode) => n is IncludeNode;
|
|
75
|
+
export declare const isVarDef: (n: TreeNode) => n is VarDefNode;
|
|
76
|
+
export declare const isDirectiveRaw: (n: TreeNode) => n is DirectiveRawNode;
|
|
77
|
+
export declare const isDirectiveBlock: (n: TreeNode) => n is DirectiveBlockNode;
|
|
78
|
+
/**
|
|
79
|
+
* Inline `{{ expr }}` — a variable/expression chip.
|
|
80
|
+
*
|
|
81
|
+
* The optional flags mirror InlineText's flat formatting annotations:
|
|
82
|
+
* a directive inside `**…**` carries its containing span's formatting
|
|
83
|
+
* (there is no wrapper node in the flat inline model to carry it).
|
|
84
|
+
*/
|
|
85
|
+
export interface InlineVariable {
|
|
86
|
+
type: "variable";
|
|
87
|
+
/** raw source between the braces, e.g. `product.name` */
|
|
88
|
+
expr: string;
|
|
89
|
+
bold?: boolean;
|
|
90
|
+
italic?: boolean;
|
|
91
|
+
strikethrough?: boolean;
|
|
92
|
+
}
|
|
93
|
+
/** Inline conditional span: content shown only when `test` holds. */
|
|
94
|
+
export interface InlineConditionalSpan {
|
|
95
|
+
type: "conditional-span";
|
|
96
|
+
/** raw expression source */
|
|
97
|
+
test: string;
|
|
98
|
+
children: InlineNode[];
|
|
99
|
+
bold?: boolean;
|
|
100
|
+
italic?: boolean;
|
|
101
|
+
strikethrough?: boolean;
|
|
102
|
+
}
|
|
103
|
+
/** Inline directive not modeled first-class, preserved verbatim. */
|
|
104
|
+
export interface InlineDirectiveRaw {
|
|
105
|
+
type: "directive-raw-inline";
|
|
106
|
+
/** exact source span */
|
|
107
|
+
source: string;
|
|
108
|
+
bold?: boolean;
|
|
109
|
+
italic?: boolean;
|
|
110
|
+
strikethrough?: boolean;
|
|
111
|
+
}
|
|
112
|
+
export type InlineDirectiveNode = InlineVariable | InlineConditionalSpan | InlineDirectiveRaw;
|
|
113
|
+
/**
|
|
114
|
+
* InlineNode extended with directive members. Directive-aware code (the
|
|
115
|
+
* editor, the preserve-mode parser) uses this; the base `InlineNode` union
|
|
116
|
+
* stays unchanged so existing exhaustive consumers keep compiling. Phase 2
|
|
117
|
+
* folds these into the base union and updates those consumers.
|
|
118
|
+
*/
|
|
119
|
+
export type InlineNodeWithDirectives = InlineNode | InlineDirectiveNode;
|
|
120
|
+
export declare const isInlineDirective: (n: InlineNodeWithDirectives) => n is InlineDirectiveNode;
|
|
121
|
+
export declare const PROFILING_ATTRS: readonly ["platform", "product", "audience", "rev", "otherprops"];
|
|
122
|
+
export type ProfilingAttr = (typeof PROFILING_ATTRS)[number];
|
|
123
|
+
/** Extract the profiling attributes present on a node's `props`. */
|
|
124
|
+
export declare function profilingOf(node: TreeNode): Partial<Record<ProfilingAttr, unknown>>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const isConditional = (n) => n.type === "conditional";
|
|
2
|
+
export const isInclude = (n) => n.type === "include";
|
|
3
|
+
export const isVarDef = (n) => n.type === "var-def";
|
|
4
|
+
export const isDirectiveRaw = (n) => n.type === "directive-raw";
|
|
5
|
+
export const isDirectiveBlock = (n) => isConditional(n) || isInclude(n) || isVarDef(n) || isDirectiveRaw(n);
|
|
6
|
+
const INLINE_DIRECTIVE_TYPES = new Set([
|
|
7
|
+
"variable",
|
|
8
|
+
"conditional-span",
|
|
9
|
+
"directive-raw-inline",
|
|
10
|
+
]);
|
|
11
|
+
export const isInlineDirective = (n) => INLINE_DIRECTIVE_TYPES.has(n.type);
|
|
12
|
+
/* ───────────────────── profiling attributes ───────────────────────────
|
|
13
|
+
* DITA-style profiling — the *attribute* form of a conditional (the
|
|
14
|
+
* *wrapper* form is ConditionalNode). Lives in plain `props`, filtered at
|
|
15
|
+
* build via ditaval. A reserved-key convention, not a type change.
|
|
16
|
+
*/
|
|
17
|
+
export const PROFILING_ATTRS = ["platform", "product", "audience", "rev", "otherprops"];
|
|
18
|
+
/** Extract the profiling attributes present on a node's `props`. */
|
|
19
|
+
export function profilingOf(node) {
|
|
20
|
+
const out = {};
|
|
21
|
+
for (const key of PROFILING_ATTRS) {
|
|
22
|
+
if (node.props && key in node.props)
|
|
23
|
+
out[key] = node.props[key];
|
|
24
|
+
}
|
|
25
|
+
return out;
|
|
26
|
+
}
|
package/dist/format.d.ts
CHANGED
|
@@ -16,6 +16,14 @@ export interface Heading {
|
|
|
16
16
|
export interface ExportPage {
|
|
17
17
|
/** File path relative to docs root, e.g. "getting-started" or "guides/install" */
|
|
18
18
|
slug: string;
|
|
19
|
+
/**
|
|
20
|
+
* The source file, relative to the content root (`agent/index.md`), for an
|
|
21
|
+
* importer whose pages keep the author's relative links. Relative links are
|
|
22
|
+
* written against the FILE, and a directory's `index.md` has the directory
|
|
23
|
+
* as its slug, so the slug alone cannot say where `./overview` points.
|
|
24
|
+
* Importers that rewrite links to root-absolute leave it unset.
|
|
25
|
+
*/
|
|
26
|
+
sourcePath?: string;
|
|
19
27
|
/** Page title */
|
|
20
28
|
title: string;
|
|
21
29
|
/** Page content as TreeNode[] */
|
|
@@ -24,6 +32,26 @@ export interface ExportPage {
|
|
|
24
32
|
headings: Heading[];
|
|
25
33
|
/** Target URL for redirect/navigation pages (no body content, just a link) */
|
|
26
34
|
redirect?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Marks an include fragment (not a routable page): content meant to be
|
|
37
|
+
* `{% include %}`'d into other pages. Exporters write it as a plain `.md`
|
|
38
|
+
* include target at its slug — no frontmatter, no title, no nav entry. Used
|
|
39
|
+
* by structural-partial import modes (Docusaurus `--partial-mode include`,
|
|
40
|
+
* AsciiDoc fragments).
|
|
41
|
+
*/
|
|
42
|
+
fragment?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* The page uses template-page syntax (plans/page-templates.md): Dogsbay-MD
|
|
45
|
+
* writes `template: jinja` in its front matter so the build renders it as
|
|
46
|
+
* a template page. Set by importers converting partials with parameters.
|
|
47
|
+
*/
|
|
48
|
+
template?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* A template partial's declared parameters (`name`, or `name?` when
|
|
51
|
+
* optional). Dogsbay-MD writes them as front matter `params:` on the
|
|
52
|
+
* fragment, and the build validates every include against them.
|
|
53
|
+
*/
|
|
54
|
+
templateParams?: string[];
|
|
27
55
|
/**
|
|
28
56
|
* Raw frontmatter data from the source page. Includes all YAML fields that
|
|
29
57
|
* were present in the original source (title, description, tags, custom
|
|
@@ -60,6 +88,26 @@ export interface ExportPage {
|
|
|
60
88
|
* See plans/multi-source-content.md.
|
|
61
89
|
*/
|
|
62
90
|
multiSource?: MultiSourceMeta;
|
|
91
|
+
/**
|
|
92
|
+
* Direct-from-source markdown body, when the importer can produce
|
|
93
|
+
* one. Bypasses the TreeNode round-trip for callers that want to
|
|
94
|
+
* preserve the source's line structure verbatim (most importantly,
|
|
95
|
+
* `migrate-asciidoc`, which would otherwise see markdown-it fold
|
|
96
|
+
* adjacent non-blank lines into one paragraph and the
|
|
97
|
+
* format-dogsbay-md serializer flatten that paragraph onto a single
|
|
98
|
+
* line — turning every `ifdef` / `endif` block in the original
|
|
99
|
+
* `.adoc` into an unreadable wall of text).
|
|
100
|
+
*
|
|
101
|
+
* Importers that produce a faithful direct-from-source markdown
|
|
102
|
+
* (currently `format-asciidoc`) populate this field. Importers that
|
|
103
|
+
* don't (most format plugins) leave it `undefined` and consumers
|
|
104
|
+
* fall back to the TreeNode-derived body via `treeToDogsbayMd`.
|
|
105
|
+
*
|
|
106
|
+
* The TreeNode round-trip is still the canonical path for runtime
|
|
107
|
+
* rendering — `bodyMarkdown` is a migration-time convenience that
|
|
108
|
+
* doesn't change the import contract.
|
|
109
|
+
*/
|
|
110
|
+
bodyMarkdown?: string;
|
|
63
111
|
}
|
|
64
112
|
/**
|
|
65
113
|
* Per-page axis metadata. Set by the loader's aggregator when
|
|
@@ -93,6 +141,39 @@ export interface NavItem {
|
|
|
93
141
|
label: string;
|
|
94
142
|
href?: string;
|
|
95
143
|
children?: NavItem[];
|
|
144
|
+
/**
|
|
145
|
+
* Granularity book view (plans/granularity-views.md). Opt-in, per nav node:
|
|
146
|
+
* - "yes" — emit one rolled-up single page for this node's subtree.
|
|
147
|
+
* - "children" — emit a single page for each direct child (chapters); a
|
|
148
|
+
* child may override with its own "no".
|
|
149
|
+
* - "no" — no single page (the default when omitted).
|
|
150
|
+
*/
|
|
151
|
+
singlePage?: "yes" | "no" | "children";
|
|
152
|
+
/**
|
|
153
|
+
* A state marker rendered beside the label — structured DATA, not text
|
|
154
|
+
* baked into `label`. Release comparisons use it for changed/new/removed
|
|
155
|
+
* pages; the same slot serves "new since your last visit", deprecation
|
|
156
|
+
* flags, and version badges.
|
|
157
|
+
*
|
|
158
|
+
* The renderer is responsible for making it perceivable WITHOUT colour
|
|
159
|
+
* (distinct glyph + visually-hidden text) — see SidebarNavTree.
|
|
160
|
+
*
|
|
161
|
+
* A branch may carry a marker for its SUBTREE: a collapsed group hides
|
|
162
|
+
* its children, so a change inside it must signal outward (the same
|
|
163
|
+
* visibility rule the diff renderer applies to tabs).
|
|
164
|
+
*/
|
|
165
|
+
mark?: NavMark;
|
|
166
|
+
}
|
|
167
|
+
export type NavMarkKind = "added" | "changed" | "removed" | "moved";
|
|
168
|
+
export interface NavMark {
|
|
169
|
+
kind: NavMarkKind;
|
|
170
|
+
/**
|
|
171
|
+
* Announced to assistive tech and shown on hover. Defaults to `kind`.
|
|
172
|
+
* A branch aggregating its subtree says so ("3 pages changed").
|
|
173
|
+
*/
|
|
174
|
+
label?: string;
|
|
175
|
+
/** True when this marker summarizes DESCENDANTS, not the item itself. */
|
|
176
|
+
subtree?: boolean;
|
|
96
177
|
}
|
|
97
178
|
/**
|
|
98
179
|
* Standard interface for format plugins.
|
|
@@ -114,12 +195,121 @@ export interface FormatPlugin {
|
|
|
114
195
|
/** Format-specific CLI options for export */
|
|
115
196
|
exportOptions?: FormatOption[];
|
|
116
197
|
/** Import: read source format, produce pages + nav */
|
|
117
|
-
import?(source: string, opts: Record<string, unknown>): Promise<
|
|
118
|
-
pages: ExportPage[];
|
|
119
|
-
nav: NavItem[];
|
|
120
|
-
}>;
|
|
198
|
+
import?(source: string, opts: Record<string, unknown>): Promise<ImportResult>;
|
|
121
199
|
/** Export: write pages + nav to target format */
|
|
122
200
|
export?(pages: ExportPage[], nav: NavItem[], output: string, opts: Record<string, unknown>): Promise<void>;
|
|
201
|
+
/**
|
|
202
|
+
* What the exporter can represent, per TreeNode type: one cell of the
|
|
203
|
+
* component × format matrix (`MATRIX_ROWS` in @dogsbay/serialize-core).
|
|
204
|
+
* Required of every exporter — the CLI's capability-matrix test fails on a
|
|
205
|
+
* missing cell. Same shape as serialize-core's `CapabilityDeclaration`.
|
|
206
|
+
*/
|
|
207
|
+
capabilities?: readonly FormatCapability[];
|
|
208
|
+
}
|
|
209
|
+
/** One feature's support in one export format (see `FormatPlugin.capabilities`). */
|
|
210
|
+
export interface FormatCapability {
|
|
211
|
+
feature: string;
|
|
212
|
+
support: "full" | "partial" | "none";
|
|
213
|
+
/** Required when support is not "full": how it degrades. */
|
|
214
|
+
note?: string;
|
|
215
|
+
rendersAs?: string;
|
|
216
|
+
}
|
|
217
|
+
export interface ImportResult {
|
|
218
|
+
pages: ExportPage[];
|
|
219
|
+
nav: NavItem[];
|
|
220
|
+
/**
|
|
221
|
+
* Directories whose CONTENTS should be mounted at `_assets/` in the output,
|
|
222
|
+
* so the `/_assets/…` refs importers rewrite image paths to actually
|
|
223
|
+
* resolve.
|
|
224
|
+
*
|
|
225
|
+
* An importer that knows where its media lives (a Starlight `src/assets`, a
|
|
226
|
+
* Docusaurus `static/`) declares it here. Without this the reference
|
|
227
|
+
* survives the conversion and the FILE does not — a page count, a retention
|
|
228
|
+
* score and a clean exit all look fine while every image 404s.
|
|
229
|
+
*
|
|
230
|
+
* `into` targets an `_assets/<into>` subdir; `mediaOnly` copies only media
|
|
231
|
+
* files, for the case where the mounted dir is the docs tree itself and
|
|
232
|
+
* carries co-located images.
|
|
233
|
+
*/
|
|
234
|
+
assetMounts?: {
|
|
235
|
+
dir: string;
|
|
236
|
+
into?: string;
|
|
237
|
+
mediaOnly?: boolean;
|
|
238
|
+
exclude?: string[];
|
|
239
|
+
/**
|
|
240
|
+
* Public directory the mount lands in. Defaults to `_assets` — the name
|
|
241
|
+
* every IMPORTER rewrites its refs to. Hand-authored content differs: an
|
|
242
|
+
* author who has not read docs/images.md types `/images/logo.png`, so
|
|
243
|
+
* `format-dogsbay-md` also recognises `images/` and `assets/` and sets
|
|
244
|
+
* this to whichever it found. The copy must preserve the name, or the
|
|
245
|
+
* reference and the file disagree — the exact failure this field's
|
|
246
|
+
* neighbours exist to prevent.
|
|
247
|
+
*/
|
|
248
|
+
root?: string;
|
|
249
|
+
}[];
|
|
250
|
+
/**
|
|
251
|
+
* Directory that page slugs are relative to, when it is NOT the path the
|
|
252
|
+
* user passed on the command line.
|
|
253
|
+
*
|
|
254
|
+
* MkDocs keeps its pages under `docs/`, Hugo under `content/`, a Docusaurus
|
|
255
|
+
* instance under its own docs dir — so a page at slug `guide/install`
|
|
256
|
+
* writing `{% include "_snippets/note.md" %}` means
|
|
257
|
+
* `<source>/docs/_snippets/note.md`, not `<source>/_snippets/note.md`.
|
|
258
|
+
* Resolving includes against the CLI argument missed every fragment in
|
|
259
|
+
* those corpora, which (since unresolved includes now fail the run) turned
|
|
260
|
+
* a working conversion into a hard error.
|
|
261
|
+
*
|
|
262
|
+
* Omit when slugs are relative to `source` itself.
|
|
263
|
+
*/
|
|
264
|
+
contentRoot?: string;
|
|
265
|
+
/**
|
|
266
|
+
* SEVERAL content roots, each mounted under a slug prefix — the Antora
|
|
267
|
+
* PLAYBOOK case (#067): `docs/guides/` → `guides/`, `docs/server-admin-4.9/`
|
|
268
|
+
* → `server-admin/server-4.9/`. Fragments (partials, examples, images)
|
|
269
|
+
* under each `dir` are mirrored beneath its `prefix` so a page at
|
|
270
|
+
* `guides/deploy/x` writing `{% include "../../modules/ROOT/partials/y.md" %}`
|
|
271
|
+
* finds `<content>/guides/modules/ROOT/partials/y.md`. Takes precedence
|
|
272
|
+
* over `contentRoot` when present. `prefix` is `""` for the root mount.
|
|
273
|
+
*/
|
|
274
|
+
sourceMounts?: {
|
|
275
|
+
dir: string;
|
|
276
|
+
prefix: string;
|
|
277
|
+
}[];
|
|
278
|
+
/**
|
|
279
|
+
* Antora playbook mode (#067): loaded components by NAME → root dir +
|
|
280
|
+
* slug prefix, for the engine's cross-component resource-ID
|
|
281
|
+
* resolution in fragments (pages get it via the plugin's own parse).
|
|
282
|
+
*/
|
|
283
|
+
antoraComponents?: Record<string, {
|
|
284
|
+
dir: string;
|
|
285
|
+
prefix: string;
|
|
286
|
+
}>;
|
|
287
|
+
/**
|
|
288
|
+
* Attribute values the CORPUS declares (Antora playbook + component
|
|
289
|
+
* `asciidoc.attributes`, an AsciiBinder distro map, …) that the site
|
|
290
|
+
* build must resolve — a `{{ serverversion49 }}` the migrate emitted
|
|
291
|
+
* shipped as literal `{serverversion49}` because nothing wrote them into
|
|
292
|
+
* `dogsbay.config.yml` (#067 review). Migrate persists these under the
|
|
293
|
+
* user's own `--attribute` values (user wins).
|
|
294
|
+
*/
|
|
295
|
+
corpusAttributes?: Record<string, unknown>;
|
|
296
|
+
/**
|
|
297
|
+
* What the import could not convert cleanly, by source file and line (the file is relative
|
|
298
|
+
* to the corpus root). A host lists these (the playground under Problems, the CLI in its
|
|
299
|
+
* summary); `MIGRATION.md` carries them too. Known loss, never silent loss.
|
|
300
|
+
*/
|
|
301
|
+
ledger?: ImportLedgerEntry[];
|
|
302
|
+
}
|
|
303
|
+
/** One note from an import: what was not converted cleanly, and where. */
|
|
304
|
+
export interface ImportLedgerEntry {
|
|
305
|
+
/** Source file, relative to the corpus root. */
|
|
306
|
+
file?: string;
|
|
307
|
+
/** 1-based line in that file, front matter included. */
|
|
308
|
+
line?: number;
|
|
309
|
+
severity: "info" | "warning";
|
|
310
|
+
/** Stable kebab-case kind, e.g. `unmapped-construct`, `slug-collision`. */
|
|
311
|
+
code: string;
|
|
312
|
+
message: string;
|
|
123
313
|
}
|
|
124
314
|
export interface FormatOption {
|
|
125
315
|
flags: string;
|
|
@@ -157,6 +347,8 @@ export interface PlausibleConfig {
|
|
|
157
347
|
export interface SiteConfig {
|
|
158
348
|
/** Site name shown in header, page title suffixes, copyright notices. */
|
|
159
349
|
siteName: string;
|
|
350
|
+
/** The line under the site name in the sidebar header (`site.tagline`). Default "Documentation". */
|
|
351
|
+
tagline?: string;
|
|
160
352
|
/**
|
|
161
353
|
* Canonical site URL. Required for `<link rel="canonical">`,
|
|
162
354
|
* sitemap.xml entries, and absolute OG meta tags. Without it, those
|
|
@@ -197,6 +389,11 @@ export interface SiteConfig {
|
|
|
197
389
|
editUri?: string;
|
|
198
390
|
/** Footer copyright text. */
|
|
199
391
|
copyright?: string;
|
|
392
|
+
/**
|
|
393
|
+
* "Powered by DogsBay" footer attribution. Defaults to true for generated
|
|
394
|
+
* sites; `poweredBy: false` in dogsbay.config.yml removes it entirely.
|
|
395
|
+
*/
|
|
396
|
+
poweredBy?: boolean;
|
|
200
397
|
/**
|
|
201
398
|
* Brand keywords for the site, used by the
|
|
202
399
|
* `seo/h1-brand-keyword` audit rule to verify that landing
|
|
@@ -223,6 +420,12 @@ export interface SiteConfig {
|
|
|
223
420
|
* chips with prefix-keyed colors. See plans/tag-display-config.md.
|
|
224
421
|
*/
|
|
225
422
|
tagPrefixes?: Record<string, TagPrefixDisplay>;
|
|
423
|
+
/**
|
|
424
|
+
* Color tag chips whose prefix has no color with a palette color
|
|
425
|
+
* chosen by a hash of the first segment. Sourced from
|
|
426
|
+
* `taxonomies.tags.autoColor`. See plans/tag-auto-color.md.
|
|
427
|
+
*/
|
|
428
|
+
tagAutoColor?: boolean;
|
|
226
429
|
/**
|
|
227
430
|
* Per-tag leaf-label overrides (slug → display string). URLs and
|
|
228
431
|
* taxonomy term-page paths still use the slug; only chip text
|
|
@@ -270,6 +473,30 @@ export interface SiteConfig {
|
|
|
270
473
|
* human-facing UI cluster.
|
|
271
474
|
*/
|
|
272
475
|
llmActions?: LlmActionsConfig;
|
|
476
|
+
/**
|
|
477
|
+
* Resolved glyphs for the internal/external link-icon affordance.
|
|
478
|
+
* When present, `DocsLayout` marks links in the prose with a small
|
|
479
|
+
* trailing icon so readers can tell internal navigation from links
|
|
480
|
+
* that leave the site. Sourced from `content.linkIcons` in
|
|
481
|
+
* `dogsbay.config.yml` and normalized by the CLI. Omitted (whole
|
|
482
|
+
* object absent) when the feature is off. Either side may be absent
|
|
483
|
+
* to show an icon for only that link kind. A core feature — not tied
|
|
484
|
+
* to any importer. See plans/link-resolution-and-icons.md.
|
|
485
|
+
*/
|
|
486
|
+
linkIcons?: LinkIconsConfig;
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* Resolved glyphs for the internal/external link-icon affordance
|
|
490
|
+
* (`SiteConfig.linkIcons`). Classification is by href shape at render
|
|
491
|
+
* time: external = absolute (`http(s)://`) or protocol-relative
|
|
492
|
+
* (`//host`); internal = root/relative. An absent side shows no icon
|
|
493
|
+
* for that kind.
|
|
494
|
+
*/
|
|
495
|
+
export interface LinkIconsConfig {
|
|
496
|
+
/** Glyph appended after external links (e.g. "↗"). */
|
|
497
|
+
external?: string;
|
|
498
|
+
/** Glyph appended after internal links (e.g. "→"). */
|
|
499
|
+
internal?: string;
|
|
273
500
|
}
|
|
274
501
|
/**
|
|
275
502
|
* Closed list of LLM provider deep-link targets. Each one is a
|
|
@@ -329,6 +556,27 @@ export interface TaxonomyDisplay {
|
|
|
329
556
|
prefixes?: Record<string, TagPrefixDisplay>;
|
|
330
557
|
/** Per-slug label overrides; key = full slug, value = display string. */
|
|
331
558
|
labels?: Record<string, string>;
|
|
559
|
+
/**
|
|
560
|
+
* Sort weight for the facet column in the search dialog. Lower
|
|
561
|
+
* numbers appear first; unset facets sort alphabetically after
|
|
562
|
+
* any pinned ones. Use this to pin "Type" or "Audience" to the
|
|
563
|
+
* top of the sidebar even though they sort later by name.
|
|
564
|
+
*/
|
|
565
|
+
order?: number;
|
|
566
|
+
/**
|
|
567
|
+
* Render this facet as a hierarchical tree in the search dialog
|
|
568
|
+
* instead of a flat checkbox list. Two render strategies depending
|
|
569
|
+
* on the value shape:
|
|
570
|
+
* - Values containing `/` are treated as slash-encoded paths
|
|
571
|
+
* (`concept/a11y` → `concept → a11y`). Common for tag taxonomies.
|
|
572
|
+
* - Values without `/` derive their tree from `nav.json` document
|
|
573
|
+
* order (the auto-`category` facet shape).
|
|
574
|
+
* Parent click auto-selects all descendant values; three-state
|
|
575
|
+
* checkboxes reflect partial selection. Off by default — set true
|
|
576
|
+
* on `category` and on slash-nested tag taxonomies.
|
|
577
|
+
* See plans/hierarchical-facets.md.
|
|
578
|
+
*/
|
|
579
|
+
hierarchical?: boolean;
|
|
332
580
|
}
|
|
333
581
|
/**
|
|
334
582
|
* Display config for one taxonomy prefix. Color is one of the
|
|
@@ -347,4 +595,3 @@ export interface TagPrefixDisplay {
|
|
|
347
595
|
* type-narrow without importing CLI internals.
|
|
348
596
|
*/
|
|
349
597
|
export type TagPaletteName = "blue" | "amber" | "emerald" | "violet" | "rose" | "slate";
|
|
350
|
-
//# sourceMappingURL=format.d.ts.map
|
package/dist/format.js
CHANGED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The frontmatter checker: one page's frontmatter against the vocabulary in
|
|
3
|
+
* frontmatter-schema.ts and the site's policy. Pure, so every surface reports
|
|
4
|
+
* the same findings:
|
|
5
|
+
*
|
|
6
|
+
* - `dogsbay validate` (@dogsbay/commands), which adds a one-click fix;
|
|
7
|
+
* - the `frontmatter/valid` rule of `@dogsbay/site-check`, run by
|
|
8
|
+
* `dogsbay site check` and `dogsbay-ssg check`.
|
|
9
|
+
*/
|
|
10
|
+
import { type FrontmatterPolicy } from "./frontmatter-schema.js";
|
|
11
|
+
export interface FrontmatterFinding {
|
|
12
|
+
severity: "error" | "warning";
|
|
13
|
+
/** `frontmatter-type`, `frontmatter-required`, … (the codes `dogsbay validate` reports). */
|
|
14
|
+
code: string;
|
|
15
|
+
message: string;
|
|
16
|
+
/** The top-level key the finding is about, when there is one. */
|
|
17
|
+
key?: string;
|
|
18
|
+
/** 1-based line of that key, when `keyLines` has it. */
|
|
19
|
+
line?: number;
|
|
20
|
+
/** Near-miss values for a closed set. */
|
|
21
|
+
candidates?: string[];
|
|
22
|
+
/** A replacement safe to apply without asking (a case-only slip): set `key` to `value`. */
|
|
23
|
+
fix?: {
|
|
24
|
+
key: string;
|
|
25
|
+
value: string;
|
|
26
|
+
label: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Findings for one page. `path` is the page's source path as the policy's
|
|
31
|
+
* `roots` see it (the globs match its content-relative form); `keyLines`
|
|
32
|
+
* gives each key's line (`frontmatterKeyLines(source)`).
|
|
33
|
+
*/
|
|
34
|
+
export declare function checkFrontmatter(frontmatter: Record<string, unknown> | undefined, path: string, policy: FrontmatterPolicy, keyLines?: Map<string, number>): FrontmatterFinding[];
|
|
35
|
+
/**
|
|
36
|
+
* The policy from a parsed `dogsbay.config.*` object: declared `taxonomies:`
|
|
37
|
+
* (their `values`/`hierarchical` ARE the check), `propSchema:`, and the
|
|
38
|
+
* opt-in `content.frontmatter` strictness. `roots` are the content roots
|
|
39
|
+
* (`content.sources[].path`). A malformed `content.frontmatter.unknown` sets
|
|
40
|
+
* `invalid` rather than being guessed around.
|
|
41
|
+
*/
|
|
42
|
+
export declare function frontmatterPolicyFromConfig(cfg: Record<string, unknown> | null | undefined, roots: string[]): FrontmatterPolicy;
|