@dogsbay/site-files 0.2.0-beta.141 → 0.2.0-beta.143

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/index.d.ts CHANGED
@@ -13,3 +13,5 @@ export * from "./canonical.js";
13
13
  export * from "./hreflang.js";
14
14
  export * from "./translations.js";
15
15
  export * from "./namespaces.js";
16
+ export * from "./mounts.js";
17
+ export * from "./markdown-links.js";
package/dist/index.js CHANGED
@@ -13,3 +13,5 @@ export * from "./canonical.js";
13
13
  export * from "./hreflang.js";
14
14
  export * from "./translations.js";
15
15
  export * from "./namespaces.js";
16
+ export * from "./mounts.js";
17
+ export * from "./markdown-links.js";
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Links inside Markdown TEXT that a tree carries as a string prop, not as nodes: an OpenAPI
3
+ * `endpoint` keeps its description, and its parameters', request and response fields' and
4
+ * responses' descriptions, as Markdown that is rendered later. The ref rewrites (`mountRefs`,
5
+ * `rewriteContentRefs`) walk `href` fields and raw HTML, so without this they never saw those
6
+ * links, and a link from one operation to another missed the mount, version and namespace
7
+ * prefixes (the SSG team, 2026-10-28).
8
+ */
9
+ /**
10
+ * Rewrites each root-relative destination (`/…`, not `//host`) in Markdown text with `fn`:
11
+ * inline links and images `[text](/x "title")` / `[text](</x>)`, reference definitions
12
+ * `[id]: /x`, and `<a href="/x">`. Code spans and fenced code are left as written.
13
+ */
14
+ export declare function rewriteMarkdownLinks(md: string, fn: (url: string) => string): string;
15
+ /**
16
+ * The Markdown an `endpoint` node holds, rewritten with `fn`: the operation's `description`, its
17
+ * parameters', request fields' (nested through `properties`/`items`) and responses' and their
18
+ * fields'. Only those: an example value is the API's data and is published as written, even
19
+ * where it has a `description` or `href` key of its own. Changes `props` in place.
20
+ */
21
+ export declare function rewriteEndpointMarkdown(props: unknown, fn: (url: string) => string): void;
@@ -0,0 +1,141 @@
1
+ /**
2
+ * Links inside Markdown TEXT that a tree carries as a string prop, not as nodes: an OpenAPI
3
+ * `endpoint` keeps its description, and its parameters', request and response fields' and
4
+ * responses' descriptions, as Markdown that is rendered later. The ref rewrites (`mountRefs`,
5
+ * `rewriteContentRefs`) walk `href` fields and raw HTML, so without this they never saw those
6
+ * links, and a link from one operation to another missed the mount, version and namespace
7
+ * prefixes (the SSG team, 2026-10-28).
8
+ */
9
+ /**
10
+ * Rewrites each root-relative destination (`/…`, not `//host`) in Markdown text with `fn`:
11
+ * inline links and images `[text](/x "title")` / `[text](</x>)`, reference definitions
12
+ * `[id]: /x`, and `<a href="/x">`. Code spans and fenced code are left as written.
13
+ */
14
+ export function rewriteMarkdownLinks(md, fn) {
15
+ if (!md.includes("/"))
16
+ return md;
17
+ let out = "";
18
+ let last = 0;
19
+ for (const [start, end] of codeRanges(md)) {
20
+ out += rewriteText(md.slice(last, start), fn) + md.slice(start, end);
21
+ last = end;
22
+ }
23
+ return out + rewriteText(md.slice(last), fn);
24
+ }
25
+ const ROOTED = String.raw `\/(?!\/)`;
26
+ // Each alternative is bounded or anchored, so a hostile description cannot make it backtrack
27
+ const LINK_REF = new RegExp([
28
+ // An inline link or image destination
29
+ String.raw `(?<lh>(?<!\\)\]\([ \t]*(?:\n[ \t]*)?<?)(?<lu>${ROOTED}[^\s)>]*)`,
30
+ // <a href="/x">
31
+ String.raw `(?<ah><a\b[^>]{0,200}?\bhref[ \t\n]*=[ \t\n]*)(?:(?<aq>["'])(?<au>${ROOTED}[^"'\n]*)\k<aq>|(?<bu>${ROOTED}[^\s"'<>=\x60]*))`,
32
+ // A reference definition
33
+ String.raw `(?<dh>^ {0,3}\[[^\]\n]{1,999}\]:[ \t]*<?)(?<du>${ROOTED}[^\s>]*)`,
34
+ ].join("|"), "gim");
35
+ function rewriteText(text, fn) {
36
+ if (!text.includes("/"))
37
+ return text;
38
+ return text.replace(LINK_REF, (match, ...args) => {
39
+ const g = args[args.length - 1];
40
+ if (g.lh !== undefined)
41
+ return `${g.lh}${fn(g.lu)}`;
42
+ if (g.ah !== undefined)
43
+ return g.au !== undefined ? `${g.ah}${g.aq}${fn(g.au)}${g.aq}` : `${g.ah}${fn(g.bu)}`;
44
+ if (g.dh !== undefined)
45
+ return `${g.dh}${fn(g.du)}`;
46
+ return match;
47
+ });
48
+ }
49
+ /**
50
+ * The code in Markdown text, as [start, end) ranges in order: fenced blocks (to the closing fence
51
+ * of the same character, at least as long, or the end) and, outside them, code spans (a backtick
52
+ * run to the next run of the same length). One pass over lines and one over backtick runs.
53
+ */
54
+ function codeRanges(md) {
55
+ const ranges = [];
56
+ const lineRe = /[^\n]*(?:\n|$)/g;
57
+ let fence;
58
+ let textStart = 0;
59
+ for (let m = lineRe.exec(md); m && m[0] !== ""; m = lineRe.exec(md)) {
60
+ const line = m[0];
61
+ const open = /^ {0,3}(`{3,}|~{3,})/.exec(line);
62
+ if (fence) {
63
+ const close = open && open[1][0] === fence.char && open[1].length >= fence.len && /^ {0,3}[`~]+[ \t]*\r?\n?$/.test(line);
64
+ if (close) {
65
+ ranges.push([fence.start, m.index + line.length]);
66
+ fence = undefined;
67
+ textStart = m.index + line.length;
68
+ }
69
+ }
70
+ else if (open && !(open[1][0] === "`" && line.slice(open[0].length).includes("`"))) {
71
+ ranges.push(...spanRanges(md, textStart, m.index));
72
+ fence = { char: open[1][0], len: open[1].length, start: m.index };
73
+ }
74
+ }
75
+ if (fence)
76
+ ranges.push([fence.start, md.length]);
77
+ else
78
+ ranges.push(...spanRanges(md, textStart, md.length));
79
+ return ranges;
80
+ }
81
+ function spanRanges(md, from, to) {
82
+ const runs = [];
83
+ const re = /`+/g;
84
+ re.lastIndex = from;
85
+ for (let m = re.exec(md); m && m.index < to; m = re.exec(md))
86
+ runs.push({ at: m.index, len: Math.min(m[0].length, to - m.index) });
87
+ // For each run, the index of the next run of the same length, found from the end
88
+ const next = new Array(runs.length).fill(-1);
89
+ const seen = new Map();
90
+ for (let i = runs.length - 1; i >= 0; i--) {
91
+ next[i] = seen.get(runs[i].len) ?? -1;
92
+ seen.set(runs[i].len, i);
93
+ }
94
+ const ranges = [];
95
+ for (let i = 0; i < runs.length; i++) {
96
+ const j = next[i];
97
+ if (j === -1)
98
+ continue;
99
+ ranges.push([runs[i].at, runs[j].at + runs[j].len]);
100
+ i = j;
101
+ }
102
+ return ranges;
103
+ }
104
+ /**
105
+ * The Markdown an `endpoint` node holds, rewritten with `fn`: the operation's `description`, its
106
+ * parameters', request fields' (nested through `properties`/`items`) and responses' and their
107
+ * fields'. Only those: an example value is the API's data and is published as written, even
108
+ * where it has a `description` or `href` key of its own. Changes `props` in place.
109
+ */
110
+ export function rewriteEndpointMarkdown(props, fn) {
111
+ if (!props || typeof props !== "object")
112
+ return;
113
+ const p = props;
114
+ const desc = (o) => {
115
+ if (o && typeof o === "object" && typeof o.description === "string") {
116
+ o.description = rewriteMarkdownLinks(o.description, fn);
117
+ }
118
+ };
119
+ const fields = (list, depth = 0) => {
120
+ if (!Array.isArray(list) || depth > 64)
121
+ return;
122
+ for (const f of list) {
123
+ desc(f);
124
+ if (f && typeof f === "object") {
125
+ fields(f.properties, depth + 1);
126
+ fields(f.items, depth + 1);
127
+ }
128
+ }
129
+ };
130
+ desc(p);
131
+ if (Array.isArray(p.parameters))
132
+ p.parameters.forEach(desc);
133
+ fields(p.requestBody);
134
+ if (Array.isArray(p.responses)) {
135
+ for (const r of p.responses) {
136
+ desc(r);
137
+ if (r && typeof r === "object")
138
+ fields(r.schema);
139
+ }
140
+ }
141
+ }
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Mounted sources: a source whose pages go under a path INSIDE its version and
3
+ * locale, beside the Markdown it belongs to, instead of under a `/<name>/` of
4
+ * its own. An OpenAPI reference that replaced an API viewer page is the case:
5
+ *
6
+ * sources:
7
+ * - { path: ./content, version: "3.33" }
8
+ * - { path: ./content/reference/rest-api/openapi.yaml, from: openapi,
9
+ * version: "3.33", mount: reference/rest-api }
10
+ *
11
+ * → /3.33/reference/rest-api/ the API's root page
12
+ * /3.33/reference/rest-api/<tag>/… its tag and operation pages
13
+ *
14
+ * The Astro pipeline (dogsbay CLI, import-content.ts) and dogsbay-ssg apply the
15
+ * same rules from here: where the pages go, which page is the root, and where
16
+ * the API's menu section goes. See docs/openapi.md and docs/versioning.md.
17
+ */
18
+ import type { PrefixableNavItem } from "./namespaces.js";
19
+ /** A mount path's segments, or why it cannot be one. */
20
+ export declare function parseMount(mount: unknown): {
21
+ segments: string[];
22
+ } | {
23
+ error: string;
24
+ };
25
+ /**
26
+ * A mounted source's page slug: its root page (`index` or `""`) is the mount
27
+ * itself, every other page goes under it. `(["reference","rest-api"], "pets")`
28
+ * → `reference/rest-api/pets`.
29
+ */
30
+ export declare function mountSlug(segments: readonly string[], slug: string): string;
31
+ /** Whether `slug` is a mounted source's root page (before mounting). */
32
+ export declare function isMountRoot(slug: string): boolean;
33
+ /**
34
+ * A mounted source's links to its OWN pages, moved under the mount:
35
+ * `/pets/list-pets` → `/reference/rest-api/pets/list-pets` when `pets/list-pets`
36
+ * is one of `ownSlugs` (the source's slugs before mounting; `index` or `""`
37
+ * is the root, linked as `/`). Every other ref is left for the source's
38
+ * prefix as usual: an image (`/_assets/x.png`) is the site's, and a link to a
39
+ * site page (`/guide/x`) stays one. Covers `href` fields, `href="…"` in raw
40
+ * HTML and links in an endpoint's Markdown descriptions. Changes `tree` in place.
41
+ */
42
+ export declare function mountRefs(tree: unknown, segments: readonly string[], ownSlugs: ReadonlySet<string>): void;
43
+ /** Where `placeMountedNav` put the API's section. */
44
+ export type MountPlacement = "at-page" | "in-section" | "top-level";
45
+ /**
46
+ * A mounted source's menu, placed in the menu of the source it is mounted
47
+ * beside (same version, locale and name):
48
+ *
49
+ * 1. The menu has an entry for the mount page: the API's sections become
50
+ * that entry's children, after any it has.
51
+ * 2. Otherwise, at the end of the deepest section holding the mount's parent
52
+ * folder (`reference/` for `reference/rest-api`), the first in menu order
53
+ * when several are as deep: an entry labelled `label`, linking to the
54
+ * mount, holding the API's sections. A section holds the folder when it
55
+ * is the folder's own page (`reference`) or has an entry DIRECTLY in it
56
+ * (`reference/cli`, not `reference/cli/datastore/migrate`: a section of
57
+ * sub-folder pages is the sub-folder's, and was chosen as the deepest,
58
+ * the playground's Calico 3.33). When no section holds it that way (a
59
+ * category with no page whose sections are all sub-folders), the
60
+ * shallowest section with pages under the folder.
61
+ * 3. Otherwise (a one-segment mount, or no such section), the same entry at
62
+ * the end of the menu.
63
+ *
64
+ * `mounted` is the source's own menu with its hrefs already mounted and
65
+ * prefixed; its first entry, when it links to the mount, is the root page's
66
+ * and is not repeated (the section links there). `mountHref` is the mount's
67
+ * full href (base path, unit prefix, mount); `mount` the mount path itself
68
+ * (`reference/rest-api`), which decides whether there is a parent folder: the
69
+ * base path and the version are not one. Returns a new menu; the inputs are
70
+ * not changed.
71
+ */
72
+ export declare function placeMountedNav<T extends PrefixableNavItem & {
73
+ label?: string;
74
+ }>(host: readonly T[], mounted: readonly T[], mountHref: string, label: string, mount: string): {
75
+ nav: T[];
76
+ placement: MountPlacement;
77
+ };
78
+ /** The note a build prints when a content page stands as a mounted source's root. */
79
+ export declare function mountRootNote(mount: string, slug: string): string;
package/dist/mounts.js ADDED
@@ -0,0 +1,185 @@
1
+ import { rewriteEndpointMarkdown } from "./markdown-links.js";
2
+ /** A mount path's segments, or why it cannot be one. */
3
+ export function parseMount(mount) {
4
+ if (typeof mount !== "string")
5
+ return { error: "mount must be a string" };
6
+ const trimmed = mount.trim().replace(/^\/+|\/+$/g, "");
7
+ if (!trimmed)
8
+ return { error: "mount must name a path, like reference/rest-api" };
9
+ const segments = trimmed.split("/");
10
+ if (segments.length > 8)
11
+ return { error: `mount "${mount}" has more than 8 segments` };
12
+ for (const s of segments) {
13
+ if (!/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(s) || s.length > 100) {
14
+ return {
15
+ error: `mount "${mount}": "${s}" is not a path segment ` +
16
+ "(letters, digits, `.`, `_` and `-`, starting with a letter or digit)",
17
+ };
18
+ }
19
+ }
20
+ return { segments };
21
+ }
22
+ /**
23
+ * A mounted source's page slug: its root page (`index` or `""`) is the mount
24
+ * itself, every other page goes under it. `(["reference","rest-api"], "pets")`
25
+ * → `reference/rest-api/pets`.
26
+ */
27
+ export function mountSlug(segments, slug) {
28
+ const base = segments.join("/");
29
+ return slug === "" || slug === "index" ? base : `${base}/${slug}`;
30
+ }
31
+ /** Whether `slug` is a mounted source's root page (before mounting). */
32
+ export function isMountRoot(slug) {
33
+ return slug === "" || slug === "index";
34
+ }
35
+ /**
36
+ * A mounted source's links to its OWN pages, moved under the mount:
37
+ * `/pets/list-pets` → `/reference/rest-api/pets/list-pets` when `pets/list-pets`
38
+ * is one of `ownSlugs` (the source's slugs before mounting; `index` or `""`
39
+ * is the root, linked as `/`). Every other ref is left for the source's
40
+ * prefix as usual: an image (`/_assets/x.png`) is the site's, and a link to a
41
+ * site page (`/guide/x`) stays one. Covers `href` fields, `href="…"` in raw
42
+ * HTML and links in an endpoint's Markdown descriptions. Changes `tree` in place.
43
+ */
44
+ export function mountRefs(tree, segments, ownSlugs) {
45
+ const base = segments.join("/");
46
+ const move = (u) => {
47
+ if (!u.startsWith("/") || u.startsWith("//"))
48
+ return u;
49
+ const cut = u.search(/[?#]/);
50
+ const path = cut === -1 ? u : u.slice(0, cut);
51
+ const rest = cut === -1 ? "" : u.slice(cut);
52
+ const slug = path.replace(/^\/+|\/+$/g, "");
53
+ const own = slug === "" ? ownSlugs.has("index") || ownSlugs.has("") : ownSlugs.has(slug);
54
+ if (!own)
55
+ return u;
56
+ return `/${slug === "" ? base : `${base}/${slug}`}${path.endsWith("/") && slug !== "" ? "/" : ""}${rest}`;
57
+ };
58
+ const walk = (node) => {
59
+ if (Array.isArray(node)) {
60
+ for (const item of node)
61
+ walk(item);
62
+ return;
63
+ }
64
+ if (!node || typeof node !== "object")
65
+ return;
66
+ const obj = node;
67
+ if (typeof obj.href === "string")
68
+ obj.href = move(obj.href);
69
+ if (typeof obj.html === "string") {
70
+ obj.html = obj.html.replace(/\bhref=("|')(.*?)\1/gi, (_m, q, val) => `href=${q}${move(val)}${q}`);
71
+ }
72
+ // An operation's descriptions are Markdown text, rendered later
73
+ // (and its props are the API's data otherwise: an example's `href` is not a link of the site's)
74
+ if (obj.type === "endpoint") {
75
+ rewriteEndpointMarkdown(obj.props, move);
76
+ return;
77
+ }
78
+ for (const key of Object.keys(obj)) {
79
+ const val = obj[key];
80
+ if (val && typeof val === "object")
81
+ walk(val);
82
+ }
83
+ };
84
+ walk(tree);
85
+ }
86
+ /** A nav href for comparing: no trailing slash, no fragment or query. */
87
+ function hrefKey(href) {
88
+ if (href === undefined)
89
+ return undefined;
90
+ const bare = href.split(/[#?]/)[0];
91
+ return bare.length > 1 ? bare.replace(/\/+$/, "") : bare;
92
+ }
93
+ /**
94
+ * A mounted source's menu, placed in the menu of the source it is mounted
95
+ * beside (same version, locale and name):
96
+ *
97
+ * 1. The menu has an entry for the mount page: the API's sections become
98
+ * that entry's children, after any it has.
99
+ * 2. Otherwise, at the end of the deepest section holding the mount's parent
100
+ * folder (`reference/` for `reference/rest-api`), the first in menu order
101
+ * when several are as deep: an entry labelled `label`, linking to the
102
+ * mount, holding the API's sections. A section holds the folder when it
103
+ * is the folder's own page (`reference`) or has an entry DIRECTLY in it
104
+ * (`reference/cli`, not `reference/cli/datastore/migrate`: a section of
105
+ * sub-folder pages is the sub-folder's, and was chosen as the deepest,
106
+ * the playground's Calico 3.33). When no section holds it that way (a
107
+ * category with no page whose sections are all sub-folders), the
108
+ * shallowest section with pages under the folder.
109
+ * 3. Otherwise (a one-segment mount, or no such section), the same entry at
110
+ * the end of the menu.
111
+ *
112
+ * `mounted` is the source's own menu with its hrefs already mounted and
113
+ * prefixed; its first entry, when it links to the mount, is the root page's
114
+ * and is not repeated (the section links there). `mountHref` is the mount's
115
+ * full href (base path, unit prefix, mount); `mount` the mount path itself
116
+ * (`reference/rest-api`), which decides whether there is a parent folder: the
117
+ * base path and the version are not one. Returns a new menu; the inputs are
118
+ * not changed.
119
+ */
120
+ export function placeMountedNav(host, mounted, mountHref, label, mount) {
121
+ const mountKey = hrefKey(mountHref);
122
+ const sections = hrefKey(mounted[0]?.href) === mountKey ? mounted.slice(1) : mounted.slice();
123
+ const clone = (items) => items.map((i) => ({ ...i, ...(i.children ? { children: clone(i.children) } : {}) }));
124
+ const nav = clone(host);
125
+ // 1. An entry for the mount page.
126
+ const atPage = (items) => {
127
+ for (const item of items) {
128
+ if (hrefKey(item.href) === mountKey)
129
+ return item;
130
+ const found = item.children ? atPage(item.children) : undefined;
131
+ if (found)
132
+ return found;
133
+ }
134
+ return undefined;
135
+ };
136
+ const page = atPage(nav);
137
+ if (page) {
138
+ page.children = [...(page.children ?? []), ...sections];
139
+ return { nav, placement: "at-page" };
140
+ }
141
+ const entry = { label, href: mountHref, children: sections };
142
+ // 2. The deepest section holding the parent folder (its page, or an entry
143
+ // directly in it, not in a sub-folder): only a
144
+ // mount of two segments or more has one (`/3.32/rest-api`'s `/3.32` is the
145
+ // version, not a folder of the mount's).
146
+ const cut = mountKey.lastIndexOf("/");
147
+ const parent = cut > 0 ? mountKey.slice(0, cut) : "";
148
+ if (parent && mount.split("/").filter(Boolean).length > 1) {
149
+ let best;
150
+ // A folder with no page of its own whose sections are all sub-folders
151
+ // (a Docusaurus category): the shallowest section with pages under it
152
+ let outer;
153
+ const under = (items) => items.some((c) => hrefKey(c.href)?.startsWith(`${parent}/`) || (c.children ? under(c.children) : false));
154
+ const visit = (items, depth) => {
155
+ for (const item of items) {
156
+ const children = item.children;
157
+ if (!children || children.length === 0)
158
+ continue;
159
+ const holds = hrefKey(item.href) === parent ||
160
+ children.some((c) => {
161
+ const k = hrefKey(c.href);
162
+ return k !== undefined && (k === parent || (k.startsWith(`${parent}/`) && !k.slice(parent.length + 1).includes("/")));
163
+ });
164
+ if (holds && (!best || depth > best.depth))
165
+ best = { items: children, depth };
166
+ if (!holds && (!outer || depth < outer.depth) && under(children))
167
+ outer = { items: children, depth };
168
+ visit(children, depth + 1);
169
+ }
170
+ };
171
+ visit(nav, 0);
172
+ best ??= outer;
173
+ if (best) {
174
+ best.items.push(entry);
175
+ return { nav, placement: "in-section" };
176
+ }
177
+ }
178
+ // 3. The end of the menu.
179
+ nav.push(entry);
180
+ return { nav, placement: "top-level" };
181
+ }
182
+ /** The note a build prints when a content page stands as a mounted source's root. */
183
+ export function mountRootNote(mount, slug) {
184
+ return `${slug}: the content page is the API root of the source mounted at "${mount}"; the generated root page is skipped`;
185
+ }
@@ -64,7 +64,8 @@ export declare function namespaceNavGroup<T extends PrefixableNavItem>(ns: strin
64
64
  * links and images resolve under the same `/<segs>/...` prefix as the
65
65
  * pages themselves. Covers page links (`href`) and asset refs (`src`),
66
66
  * in both markdown nodes (`src`/`href` fields) and raw-HTML nodes
67
- * (`href="..."`/`src="..."` inside an `html` string).
67
+ * (`href="..."`/`src="..."` inside an `html` string), and links in an OpenAPI
68
+ * endpoint's Markdown descriptions (markdown-links.ts).
68
69
  *
69
70
  * Refs at this pipeline stage are ROOT-RELATIVE and carry NO basePath
70
71
  * (importers resolve to `/foo`; basePath is composed downstream), so the
@@ -11,6 +11,7 @@
11
11
  * Naming one source never moves another's URLs: an unnamed source stays flat
12
12
  * beside named siblings. A single source, named or not, gets no segment.
13
13
  */
14
+ import { rewriteEndpointMarkdown } from "./markdown-links.js";
14
15
  /** A source's namespace: its `name:`, or undefined (flat URLs). */
15
16
  export function sourceNamespace(source) {
16
17
  return source.name;
@@ -94,7 +95,8 @@ export function namespaceNavGroup(ns, nav) {
94
95
  * links and images resolve under the same `/<segs>/...` prefix as the
95
96
  * pages themselves. Covers page links (`href`) and asset refs (`src`),
96
97
  * in both markdown nodes (`src`/`href` fields) and raw-HTML nodes
97
- * (`href="..."`/`src="..."` inside an `html` string).
98
+ * (`href="..."`/`src="..."` inside an `html` string), and links in an OpenAPI
99
+ * endpoint's Markdown descriptions (markdown-links.ts).
98
100
  *
99
101
  * Refs at this pipeline stage are ROOT-RELATIVE and carry NO basePath
100
102
  * (importers resolve to `/foo`; basePath is composed downstream), so the
@@ -154,6 +156,12 @@ export function rewriteContentRefs(tree, prefixSegs, globalPrefixes) {
154
156
  obj.href = prefix(obj.href);
155
157
  if (typeof obj.html === "string")
156
158
  obj.html = rewriteHtml(obj.html);
159
+ // An operation's descriptions are Markdown text, rendered later
160
+ // (and its props are the API's data otherwise: an example's `href` is not a link of the site's)
161
+ if (obj.type === "endpoint") {
162
+ rewriteEndpointMarkdown(obj.props, prefix);
163
+ return;
164
+ }
157
165
  // `::child-links{folder=…}` is a site path too: on a versioned or
158
166
  // localized site it names a folder in THIS source's namespace.
159
167
  if (obj.type === "child-links" && obj.props && typeof obj.props.folder === "string") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dogsbay/site-files",
3
- "version": "0.2.0-beta.141",
3
+ "version": "0.2.0-beta.143",
4
4
  "description": "robots.txt, _headers, llms.txt, sitemaps, redirects and JSON-LD for docs sites; shared by the dogsbay Astro pipeline and dogsbay-ssg, Worker-safe",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",