sourcey 3.6.0 → 3.6.1
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/README.md +5 -2
- package/dist/adapters/index.d.ts +3 -2
- package/dist/adapters/index.d.ts.map +1 -1
- package/dist/adapters/index.js +35 -3
- package/dist/adapters/types.d.ts +8 -2
- package/dist/adapters/types.d.ts.map +1 -1
- package/dist/cli.js +28 -34
- package/dist/client/search.js +181 -119
- package/dist/client/tabs.js +23 -0
- package/dist/components/layout/Head.js +2 -2
- package/dist/components/openapi/Introduction.d.ts.map +1 -1
- package/dist/components/openapi/Introduction.js +16 -1
- package/dist/components/openapi/Security.d.ts.map +1 -1
- package/dist/components/openapi/Security.js +18 -2
- package/dist/config.d.ts +63 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +21 -7
- package/dist/core/api-rendering.d.ts +47 -0
- package/dist/core/api-rendering.d.ts.map +1 -0
- package/dist/core/api-rendering.js +76 -0
- package/dist/core/doxygen-loader.d.ts.map +1 -1
- package/dist/core/doxygen-loader.js +35 -18
- package/dist/core/godoc-loader.d.ts.map +1 -1
- package/dist/core/godoc-loader.js +17 -6
- package/dist/core/markdown-loader.d.ts.map +1 -1
- package/dist/core/markdown-loader.js +8 -5
- package/dist/core/mcp-normalizer.d.ts.map +1 -1
- package/dist/core/mcp-normalizer.js +48 -34
- package/dist/core/parser.d.ts.map +1 -1
- package/dist/core/parser.js +75 -4
- package/dist/core/rustdoc-introspector.d.ts +29 -0
- package/dist/core/rustdoc-introspector.d.ts.map +1 -0
- package/dist/core/rustdoc-introspector.js +236 -0
- package/dist/core/rustdoc-loader.d.ts +25 -0
- package/dist/core/rustdoc-loader.d.ts.map +1 -0
- package/dist/core/rustdoc-loader.js +469 -0
- package/dist/core/rustdoc-render.d.ts +76 -0
- package/dist/core/rustdoc-render.d.ts.map +1 -0
- package/dist/core/rustdoc-render.js +785 -0
- package/dist/core/rustdoc-types.d.ts +314 -0
- package/dist/core/rustdoc-types.d.ts.map +1 -0
- package/dist/core/rustdoc-types.js +18 -0
- package/dist/core/search-indexer.js +1 -1
- package/dist/core/sourcey-rustdoc/Cargo.lock +705 -0
- package/dist/core/sourcey-rustdoc/Cargo.toml +38 -0
- package/dist/core/sourcey-rustdoc/README.md +59 -0
- package/dist/core/sourcey-rustdoc/src/diagnostics.rs +42 -0
- package/dist/core/sourcey-rustdoc/src/doctest.rs +268 -0
- package/dist/core/sourcey-rustdoc/src/extract.rs +492 -0
- package/dist/core/sourcey-rustdoc/src/lib.rs +58 -0
- package/dist/core/sourcey-rustdoc/src/links.rs +126 -0
- package/dist/core/sourcey-rustdoc/src/main.rs +256 -0
- package/dist/core/sourcey-rustdoc/src/signature.rs +415 -0
- package/dist/core/sourcey-rustdoc/src/spec.rs +390 -0
- package/dist/core/sourcey-rustdoc/tests/format_version.rs +45 -0
- package/dist/dev-server.d.ts.map +1 -1
- package/dist/dev-server.js +49 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -13
- package/dist/init.js +2 -2
- package/dist/renderer/changelog-feed.d.ts.map +1 -1
- package/dist/renderer/changelog-feed.js +27 -19
- package/dist/renderer/html-builder.d.ts.map +1 -1
- package/dist/renderer/html-builder.js +4 -3
- package/dist/renderer/llms.js +57 -2
- package/dist/site-assembly.d.ts +5 -0
- package/dist/site-assembly.d.ts.map +1 -1
- package/dist/site-assembly.js +55 -1
- package/dist/themes/default/sourcey.css +300 -0
- package/dist/utils/code-samples.d.ts +1 -0
- package/dist/utils/code-samples.d.ts.map +1 -1
- package/dist/utils/code-samples.js +30 -22
- package/dist/utils/html.d.ts +10 -0
- package/dist/utils/html.d.ts.map +1 -0
- package/dist/utils/html.js +152 -0
- package/dist/utils/http.d.ts +0 -2
- package/dist/utils/http.d.ts.map +1 -1
- package/dist/utils/http.js +19 -34
- package/dist/utils/markdown.d.ts.map +1 -1
- package/dist/utils/markdown.js +102 -37
- package/package.json +9 -4
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
import { renderMarkdownInline } from "../utils/markdown.js";
|
|
1
2
|
export function generateChangelogFeeds(page, options) {
|
|
2
3
|
const buildDate = options.buildDate ?? new Date();
|
|
3
|
-
const
|
|
4
|
-
.map((version) => version.date ? new Date(`${version.date}T00:00:00Z`) :
|
|
5
|
-
.
|
|
4
|
+
const datedVersions = page.changelog.versions
|
|
5
|
+
.map((version) => (version.date ? new Date(`${version.date}T00:00:00Z`).getTime() : NaN))
|
|
6
|
+
.filter(Number.isFinite);
|
|
7
|
+
const updated = datedVersions.length ? new Date(Math.max(...datedVersions)) : buildDate;
|
|
6
8
|
const title = options.title ?? [options.siteName, page.title].filter(Boolean).join(" ").trim();
|
|
7
9
|
const description = options.description ?? page.description ?? `${page.title} feed`;
|
|
8
10
|
const feedId = toFeedId(options.atomPath);
|
|
9
|
-
const atomEntries = page.changelog.versions
|
|
11
|
+
const atomEntries = page.changelog.versions
|
|
12
|
+
.map((version) => {
|
|
10
13
|
const href = options.versionHref(version);
|
|
11
14
|
const content = renderVersionHtml(version);
|
|
12
15
|
const updatedAt = version.date ? new Date(`${version.date}T00:00:00Z`) : updated;
|
|
@@ -20,25 +23,28 @@ export function generateChangelogFeeds(page, options) {
|
|
|
20
23
|
` <content type="html">${escapeXml(content)}</content>`,
|
|
21
24
|
" </entry>",
|
|
22
25
|
].join("\n");
|
|
23
|
-
})
|
|
26
|
+
})
|
|
27
|
+
.join("\n");
|
|
24
28
|
const atom = [
|
|
25
29
|
`<?xml version="1.0" encoding="UTF-8"?>`,
|
|
26
30
|
`<feed xmlns="http://www.w3.org/2005/Atom">`,
|
|
27
31
|
` <title>${escapeXml(title)}</title>`,
|
|
28
32
|
` <id>${escapeXml(feedId)}</id>`,
|
|
29
33
|
` <updated>${updated.toISOString()}</updated>`,
|
|
34
|
+
` <author><name>${escapeXml(options.siteName || title)}</name></author>`,
|
|
30
35
|
` <subtitle>${escapeXml(description)}</subtitle>`,
|
|
31
36
|
` <link rel="self" href="${escapeXml(options.atomPath)}" />`,
|
|
32
37
|
` <link href="${escapeXml(options.pagePath)}" />`,
|
|
33
38
|
page.changelog.versions.length ? atomEntries : "",
|
|
34
39
|
`</feed>`,
|
|
35
|
-
]
|
|
36
|
-
|
|
40
|
+
]
|
|
41
|
+
.filter(Boolean)
|
|
42
|
+
.join("\n");
|
|
43
|
+
const rssItems = page.changelog.versions
|
|
44
|
+
.map((version) => {
|
|
37
45
|
const href = options.versionHref(version);
|
|
38
46
|
const label = version.version ?? "Unreleased";
|
|
39
|
-
const pubDate = version.date
|
|
40
|
-
? new Date(`${version.date}T00:00:00Z`)
|
|
41
|
-
: updated;
|
|
47
|
+
const pubDate = version.date ? new Date(`${version.date}T00:00:00Z`) : updated;
|
|
42
48
|
return [
|
|
43
49
|
" <item>",
|
|
44
50
|
` <title>${escapeXml(label)}</title>`,
|
|
@@ -48,7 +54,8 @@ export function generateChangelogFeeds(page, options) {
|
|
|
48
54
|
` <description>${escapeXml(renderVersionHtml(version))}</description>`,
|
|
49
55
|
" </item>",
|
|
50
56
|
].join("\n");
|
|
51
|
-
})
|
|
57
|
+
})
|
|
58
|
+
.join("\n");
|
|
52
59
|
const rss = [
|
|
53
60
|
`<?xml version="1.0" encoding="UTF-8"?>`,
|
|
54
61
|
`<rss version="2.0">`,
|
|
@@ -59,15 +66,19 @@ export function generateChangelogFeeds(page, options) {
|
|
|
59
66
|
page.changelog.versions.length ? rssItems : "",
|
|
60
67
|
` </channel>`,
|
|
61
68
|
`</rss>`,
|
|
62
|
-
]
|
|
69
|
+
]
|
|
70
|
+
.filter(Boolean)
|
|
71
|
+
.join("\n");
|
|
63
72
|
return { atom, rss };
|
|
64
73
|
}
|
|
65
74
|
function renderVersionHtml(version) {
|
|
66
|
-
const summary = version.summary ? `<p>${
|
|
67
|
-
const sections = version.sections
|
|
75
|
+
const summary = version.summary ? `<p>${renderMarkdownInline(version.summary)}</p>` : "";
|
|
76
|
+
const sections = version.sections
|
|
77
|
+
.map((section) => {
|
|
68
78
|
const items = section.entries.map((entry) => `<li>${entry.html}</li>`).join("");
|
|
69
79
|
return `<section><h3>${escapeHtml(section.label)}</h3><ul>${items}</ul></section>`;
|
|
70
|
-
})
|
|
80
|
+
})
|
|
81
|
+
.join("");
|
|
71
82
|
return `<article><h2>${escapeHtml(version.version ?? "Unreleased")}</h2>${summary}${sections}</article>`;
|
|
72
83
|
}
|
|
73
84
|
function escapeXml(value) {
|
|
@@ -79,10 +90,7 @@ function escapeXml(value) {
|
|
|
79
90
|
.replace(/'/g, "'");
|
|
80
91
|
}
|
|
81
92
|
function escapeHtml(value) {
|
|
82
|
-
return value
|
|
83
|
-
.replace(/&/g, "&")
|
|
84
|
-
.replace(/</g, "<")
|
|
85
|
-
.replace(/>/g, ">");
|
|
93
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
86
94
|
}
|
|
87
95
|
function toFeedId(value) {
|
|
88
96
|
if (value.startsWith("http://") || value.startsWith("https://"))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-builder.d.ts","sourceRoot":"","sources":["../../src/renderer/html-builder.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"html-builder.d.ts","sourceRoot":"","sources":["../../src/renderer/html-builder.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAiC5D,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,QAAQ;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,WAAW,CAAC;IACzB,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,iEAAiE;IACjE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,aAAa,EAAE,CAAC;CAClC;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,QAAQ,EACd,IAAI,EAAE,UAAU,EAChB,OAAO,CAAC,EAAE;IACR,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GACA,aAAa,CAcf;AAED;;GAEG;AACH,wBAAsB,SAAS,CAC7B,KAAK,EAAE,QAAQ,EAAE,EACjB,UAAU,EAAE,cAAc,EAC1B,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,UAAU,EAChB,OAAO,CAAC,EAAE;IACR,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,UAAU,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;CAC3C,GACA,OAAO,CAAC,WAAW,CAAC,CA8EtB"}
|
|
@@ -7,6 +7,7 @@ import preact from "@preact/preset-vite";
|
|
|
7
7
|
import { renderPage } from "./static-renderer.js";
|
|
8
8
|
import { withActivePage } from "../core/navigation.js";
|
|
9
9
|
import { isAbsoluteHttpUrl, toAbsoluteUrl, toPublicPath } from "../site-url.js";
|
|
10
|
+
import { escapeHtml as escapeXml } from "../utils/html.js";
|
|
10
11
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
11
12
|
const projectRoot = resolve(__dirname, "../..");
|
|
12
13
|
async function exists(path) {
|
|
@@ -27,8 +28,8 @@ async function resolveAssetPaths() {
|
|
|
27
28
|
const distClient = resolve(projectRoot, "dist/client/index.js");
|
|
28
29
|
const srcCss = resolve(projectRoot, "src/themes/default/sourcey.css");
|
|
29
30
|
const distCss = resolve(projectRoot, "dist/themes/default/sourcey.css");
|
|
30
|
-
const clientEntry = await exists(srcClient) ? srcClient : distClient;
|
|
31
|
-
const sourceyCssPath = await exists(srcCss) ? srcCss : distCss;
|
|
31
|
+
const clientEntry = (await exists(srcClient)) ? srcClient : distClient;
|
|
32
|
+
const sourceyCssPath = (await exists(srcCss)) ? srcCss : distCss;
|
|
32
33
|
return { clientEntry, sourceyCssPath };
|
|
33
34
|
}
|
|
34
35
|
export function createRenderOptions(page, site, options) {
|
|
@@ -88,7 +89,7 @@ export async function buildSite(pages, navigation, outputDir, site, options) {
|
|
|
88
89
|
const urls = pages.map((page) => {
|
|
89
90
|
const publicPath = toPublicPath(page.outputPath, site.baseUrl, site.prettyUrls);
|
|
90
91
|
const loc = site.siteUrl ? toAbsoluteUrl(publicPath, site.siteUrl) : publicPath;
|
|
91
|
-
return ` <url><loc>${loc}</loc></url>`;
|
|
92
|
+
return ` <url><loc>${escapeXml(loc)}</loc></url>`;
|
|
92
93
|
});
|
|
93
94
|
const sitemap = [
|
|
94
95
|
`<?xml version="1.0" encoding="UTF-8"?>`,
|
package/dist/renderer/llms.js
CHANGED
|
@@ -41,7 +41,7 @@ export function generateLlmsTxt(pages, navigation, site) {
|
|
|
41
41
|
if (op.hidden)
|
|
42
42
|
continue;
|
|
43
43
|
const opLabel = op.summary ?? operationDisplayName(op);
|
|
44
|
-
const opSummary = [operationKind(op), firstLine(op.description)].filter(Boolean).join("
|
|
44
|
+
const opSummary = [operationKind(op), firstLine(op.description)].filter(Boolean).join(" - ");
|
|
45
45
|
lines.push(`- [${opLabel}](${href(page)}#${operationAnchor(op)})${opSummary ? `: ${opSummary}` : ""}`);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -92,6 +92,15 @@ function appendMarkdownPage(lines, page, site) {
|
|
|
92
92
|
lines.push(doc.description);
|
|
93
93
|
lines.push("");
|
|
94
94
|
}
|
|
95
|
+
const isRustdoc = doc.sourcePath?.startsWith("rustdoc/");
|
|
96
|
+
if (isRustdoc) {
|
|
97
|
+
const body = stripHtmlPreservingRustDoctests(doc.html);
|
|
98
|
+
if (body) {
|
|
99
|
+
lines.push(body);
|
|
100
|
+
lines.push("");
|
|
101
|
+
}
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
95
104
|
const body = stripHtml(doc.html);
|
|
96
105
|
if (body) {
|
|
97
106
|
lines.push(body);
|
|
@@ -207,7 +216,7 @@ function appendOperation(lines, op) {
|
|
|
207
216
|
const type = param.schema
|
|
208
217
|
? formatSchemaType(param.schema)
|
|
209
218
|
: firstContentSchemaType(param.content);
|
|
210
|
-
const desc = param.description ? `
|
|
219
|
+
const desc = param.description ? ` - ${firstLine(param.description)}` : "";
|
|
211
220
|
lines.push(`- \`${param.name}\` (${param.in}, ${type}, ${req})${desc}`);
|
|
212
221
|
}
|
|
213
222
|
lines.push("");
|
|
@@ -337,6 +346,52 @@ function stripHtml(html) {
|
|
|
337
346
|
.replace(/\s+/g, " ")
|
|
338
347
|
.trim();
|
|
339
348
|
}
|
|
349
|
+
/**
|
|
350
|
+
* Like stripHtml but preserves rustdoc doctest <pre><code> blocks as
|
|
351
|
+
* fenced ```rust ... ``` so they remain useful as runnable examples in
|
|
352
|
+
* llms-full.txt. Section headings and item names are also kept.
|
|
353
|
+
*/
|
|
354
|
+
function stripHtmlPreservingRustDoctests(html) {
|
|
355
|
+
const tokens = [];
|
|
356
|
+
const sectionRe = /<section class="rust-item rust-([a-z_]+) api-item"[^>]*>([\s\S]*?)<\/section>/g;
|
|
357
|
+
let lastIndex = 0;
|
|
358
|
+
let prose = "";
|
|
359
|
+
for (const match of html.matchAll(sectionRe)) {
|
|
360
|
+
prose += html.slice(lastIndex, match.index ?? 0);
|
|
361
|
+
lastIndex = (match.index ?? 0) + match[0].length;
|
|
362
|
+
tokens.push(formatRustItemForLlms(match[2], match[1]));
|
|
363
|
+
}
|
|
364
|
+
prose += html.slice(lastIndex);
|
|
365
|
+
const proseText = stripHtml(prose);
|
|
366
|
+
const parts = [];
|
|
367
|
+
if (proseText)
|
|
368
|
+
parts.push(proseText);
|
|
369
|
+
if (tokens.length > 0)
|
|
370
|
+
parts.push(tokens.join("\n\n"));
|
|
371
|
+
return parts.join("\n\n").trim();
|
|
372
|
+
}
|
|
373
|
+
function formatRustItemForLlms(inner, kind) {
|
|
374
|
+
const titleMatch = inner.match(/<h4[^>]*class="[^"]*code-header[^"]*"[^>]*>([\s\S]*?)<\/h4>/);
|
|
375
|
+
const title = titleMatch ? stripHtml(titleMatch[1]) : "";
|
|
376
|
+
const docMatch = inner.match(/<div class="docblock[^"]*"[^>]*>([\s\S]*?)<\/div>/);
|
|
377
|
+
const docText = docMatch ? stripHtml(docMatch[1]) : "";
|
|
378
|
+
// The visible doctest renders through the shared Shiki code block. Match the
|
|
379
|
+
// `rust-doctest-code` wrapper (exact class, so the hidden `-full` variant is
|
|
380
|
+
// skipped), pull the inner Shiki <code>, then strip span tags while keeping
|
|
381
|
+
// line breaks so the extracted code stays readable.
|
|
382
|
+
const doctests = Array.from(inner.matchAll(/<div class="rust-doctest-code" id="[^"]*">[\s\S]*?<pre class="shiki[^"]*"[^>]*><code[^>]*>([\s\S]*?)<\/code><\/pre>/g)).map((m) => decodeEntities(m[1].replace(/<[^>]+>/g, "")).replace(/\n{3,}/g, "\n\n").trimEnd());
|
|
383
|
+
const out = [];
|
|
384
|
+
if (title)
|
|
385
|
+
out.push(`#### ${kind}: ${title}`);
|
|
386
|
+
if (docText)
|
|
387
|
+
out.push(docText);
|
|
388
|
+
for (const code of doctests) {
|
|
389
|
+
out.push("```rust");
|
|
390
|
+
out.push(code);
|
|
391
|
+
out.push("```");
|
|
392
|
+
}
|
|
393
|
+
return out.join("\n");
|
|
394
|
+
}
|
|
340
395
|
function decodeEntities(text) {
|
|
341
396
|
return text
|
|
342
397
|
.replace(/ /g, " ")
|
package/dist/site-assembly.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type GodocLoaderDiagnostic } from "./core/godoc-loader.js";
|
|
2
|
+
import { type RustdocLoaderDiagnostic } from "./core/rustdoc-loader.js";
|
|
2
3
|
import type { PrettyUrls, ResolvedConfig, ResolvedTab } from "./config.js";
|
|
3
4
|
import type { DocsPage } from "./core/markdown-loader.js";
|
|
4
5
|
import type { SiteTab } from "./core/navigation.js";
|
|
@@ -12,10 +13,14 @@ export interface SiteAssembly {
|
|
|
12
13
|
pageMap: Map<string, SitePage>;
|
|
13
14
|
changelogDiagnostics: ChangelogDiagnostic[];
|
|
14
15
|
godocDiagnostics: GodocLoaderDiagnostic[];
|
|
16
|
+
rustdocDiagnostics: RustdocLoaderDiagnostic[];
|
|
15
17
|
extraFiles: Map<string, string | Buffer>;
|
|
16
18
|
}
|
|
17
19
|
export declare function assembleSite(config: ResolvedConfig): Promise<SiteAssembly>;
|
|
18
20
|
export declare function formatGodocDiagnostic(diag: GodocLoaderDiagnostic): string;
|
|
21
|
+
export declare function enforceGodocDiagnostics(diagnostics: GodocLoaderDiagnostic[]): void;
|
|
22
|
+
export declare function enforceRustdocDiagnostics(diagnostics: RustdocLoaderDiagnostic[]): void;
|
|
23
|
+
export declare function formatRustdocDiagnostic(diagnostic: RustdocLoaderDiagnostic): string;
|
|
19
24
|
export declare function collectDocsPagesByTab(pageMap: Map<string, SitePage>, tabs: ResolvedTab[]): Map<string, DocsPage[]>;
|
|
20
25
|
export declare function rebuildMarkdownTabNavigation(pageMap: Map<string, SitePage>, siteTabs: SiteTab[], tabs: ResolvedTab[], tabSlug: string, prettyUrls: PrettyUrls): void;
|
|
21
26
|
export declare function enforceChangelogDiagnostics(diagnostics: ChangelogDiagnostic[], strictChangelog?: boolean): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"site-assembly.d.ts","sourceRoot":"","sources":["../src/site-assembly.ts"],"names":[],"mappings":"AASA,OAAO,EAAgB,KAAK,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"site-assembly.d.ts","sourceRoot":"","sources":["../src/site-assembly.ts"],"names":[],"mappings":"AASA,OAAO,EAAgB,KAAK,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAkB,KAAK,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAIxF,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,KAAK,EAAiB,QAAQ,EAAgB,MAAM,2BAA2B,CAAC;AAEvF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EACV,mBAAmB,EAEnB,cAAc,EACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGxD,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,WAAW,EAAE,cAAc,CAAC;IAC5B,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACzC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC/B,oBAAoB,EAAE,mBAAmB,EAAE,CAAC;IAC5C,gBAAgB,EAAE,qBAAqB,EAAE,CAAC;IAC1C,kBAAkB,EAAE,uBAAuB,EAAE,CAAC;IAC9C,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;CAC1C;AAED,wBAAsB,YAAY,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC,CAiKhF;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,qBAAqB,GAAG,MAAM,CAKzE;AAED,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,qBAAqB,EAAE,GAAG,IAAI,CAGlF;AAED,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,uBAAuB,EAAE,GAAG,IAAI,CAGtF;AAUD,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,uBAAuB,GAAG,MAAM,CAMnF;AAUD,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,EAC9B,IAAI,EAAE,WAAW,EAAE,GAClB,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,CAoBzB;AAED,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,EAC9B,QAAQ,EAAE,OAAO,EAAE,EACnB,IAAI,EAAE,WAAW,EAAE,EACnB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,UAAU,GACrB,IAAI,CAsBN;AAaD,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,mBAAmB,EAAE,EAClC,eAAe,UAAQ,GACtB,IAAI,CAYN;AAED,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,mBAAmB,GAAG,MAAM,CAIjF;AAED,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,mBAAmB,GAAG,MAAM,CAI9E;AAED,wBAAgB,0BAA0B,CAAC,WAAW,EAAE,mBAAmB,EAAE,GAAG,MAAM,EAAE,CAEvF;AAED,wBAAsB,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,CA4BjF;AAED,wBAAgB,iBAAiB,IAAI,cAAc,CAUlD;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,cAAc,GAAG,IAAI,CA6FpF"}
|
package/dist/site-assembly.js
CHANGED
|
@@ -8,6 +8,7 @@ import { normalizeMcpSpec } from "./core/mcp-normalizer.js";
|
|
|
8
8
|
import { loadDocsPage, slugFromPath } from "./core/markdown-loader.js";
|
|
9
9
|
import { loadDoxygenTab } from "./core/doxygen-loader.js";
|
|
10
10
|
import { loadGodocTab } from "./core/godoc-loader.js";
|
|
11
|
+
import { loadRustdocTab } from "./core/rustdoc-loader.js";
|
|
11
12
|
import { buildNavFromSpec, buildNavFromPages } from "./core/navigation.js";
|
|
12
13
|
import { generateChangelogFeeds } from "./renderer/changelog-feed.js";
|
|
13
14
|
import { pageOutputPath, tabIndexOutputPath, tabPath } from "./config.js";
|
|
@@ -19,6 +20,7 @@ export async function assembleSite(config) {
|
|
|
19
20
|
const siteTabs = [];
|
|
20
21
|
const changelogDiagnostics = [];
|
|
21
22
|
const godocDiagnostics = [];
|
|
23
|
+
const rustdocDiagnostics = [];
|
|
22
24
|
for (const tab of config.tabs) {
|
|
23
25
|
if (tab.source.kind === "openapi" || tab.source.kind === "mcp") {
|
|
24
26
|
const spec = specsBySlug.get(tab.slug);
|
|
@@ -70,6 +72,26 @@ export async function assembleSite(config) {
|
|
|
70
72
|
siteTabs.push(navTab);
|
|
71
73
|
continue;
|
|
72
74
|
}
|
|
75
|
+
if (tab.source.kind === "rustdoc") {
|
|
76
|
+
const { pages, navTab, diagnostics } = await loadRustdocTab(tab.source.config, tab.slug, tab.label, {
|
|
77
|
+
repo: config.repo,
|
|
78
|
+
editBranch: config.editBranch,
|
|
79
|
+
editBasePath: tab.source.config.sourceBasePath,
|
|
80
|
+
});
|
|
81
|
+
rustdocDiagnostics.push(...diagnostics);
|
|
82
|
+
for (const [slug, page] of pages) {
|
|
83
|
+
const outputPath = pageOutputPath(tab.slug, slug, config.prettyUrls);
|
|
84
|
+
pageMap.set(outputPath, {
|
|
85
|
+
outputPath,
|
|
86
|
+
currentPage: { kind: "markdown", markdown: page },
|
|
87
|
+
spec: primarySpec,
|
|
88
|
+
tabSlug: tab.slug,
|
|
89
|
+
pageSlug: slug,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
siteTabs.push(navTab);
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
73
95
|
if (tab.source.kind !== "markdown")
|
|
74
96
|
continue;
|
|
75
97
|
const pagesByPath = new Map();
|
|
@@ -121,6 +143,7 @@ export async function assembleSite(config) {
|
|
|
121
143
|
pageMap,
|
|
122
144
|
changelogDiagnostics,
|
|
123
145
|
godocDiagnostics,
|
|
146
|
+
rustdocDiagnostics,
|
|
124
147
|
extraFiles,
|
|
125
148
|
};
|
|
126
149
|
}
|
|
@@ -130,6 +153,37 @@ export function formatGodocDiagnostic(diag) {
|
|
|
130
153
|
const loc = diag.file ? ` ${diag.file}${diag.line ? `:${diag.line}` : ""}` : "";
|
|
131
154
|
return `[${sev}] ${diag.code}${where}${loc} ${diag.message}`;
|
|
132
155
|
}
|
|
156
|
+
export function enforceGodocDiagnostics(diagnostics) {
|
|
157
|
+
const error = diagnostics.find((diagnostic) => diagnostic.severity === "error");
|
|
158
|
+
if (error)
|
|
159
|
+
throw new Error(formatGodocFailure(error));
|
|
160
|
+
}
|
|
161
|
+
export function enforceRustdocDiagnostics(diagnostics) {
|
|
162
|
+
const error = diagnostics.find((diagnostic) => diagnostic.severity === "error");
|
|
163
|
+
if (error)
|
|
164
|
+
throw new Error(formatRustdocFailure(error));
|
|
165
|
+
}
|
|
166
|
+
function formatGodocFailure(diagnostic) {
|
|
167
|
+
const where = diagnostic.package ? ` (${diagnostic.package})` : "";
|
|
168
|
+
const loc = diagnostic.file
|
|
169
|
+
? ` ${diagnostic.file}${diagnostic.line ? `:${diagnostic.line}` : ""}`
|
|
170
|
+
: "";
|
|
171
|
+
return `[${diagnostic.code}]${where}${loc}: ${diagnostic.message}`;
|
|
172
|
+
}
|
|
173
|
+
export function formatRustdocDiagnostic(diagnostic) {
|
|
174
|
+
const location = diagnostic.file
|
|
175
|
+
? ` ${diagnostic.file}${diagnostic.line ? `:${diagnostic.line}` : ""}`
|
|
176
|
+
: "";
|
|
177
|
+
const cratePrefix = diagnostic.crate ? ` [${diagnostic.crate}]` : "";
|
|
178
|
+
return `[${diagnostic.severity.toUpperCase()}] ${diagnostic.code}${cratePrefix}${location} ${diagnostic.message}`;
|
|
179
|
+
}
|
|
180
|
+
function formatRustdocFailure(diagnostic) {
|
|
181
|
+
const location = diagnostic.file
|
|
182
|
+
? ` ${diagnostic.file}${diagnostic.line ? `:${diagnostic.line}` : ""}`
|
|
183
|
+
: "";
|
|
184
|
+
const cratePrefix = diagnostic.crate ? ` (${diagnostic.crate})` : "";
|
|
185
|
+
return `[${diagnostic.code}]${cratePrefix}${location}: ${diagnostic.message}`;
|
|
186
|
+
}
|
|
133
187
|
export function collectDocsPagesByTab(pageMap, tabs) {
|
|
134
188
|
const docsPagesByTab = new Map();
|
|
135
189
|
for (const tab of tabs) {
|
|
@@ -433,7 +487,7 @@ function isSearchableDocsSitePage(page) {
|
|
|
433
487
|
return page.currentPage.kind === "markdown" || isMainChangelogSitePage(page);
|
|
434
488
|
}
|
|
435
489
|
function isDocsSource(kind) {
|
|
436
|
-
return kind === "markdown" || kind === "doxygen" || kind === "godoc";
|
|
490
|
+
return kind === "markdown" || kind === "doxygen" || kind === "godoc" || kind === "rustdoc";
|
|
437
491
|
}
|
|
438
492
|
function createFeedLinks(atomPath, rssPath, title) {
|
|
439
493
|
return [
|
|
@@ -1893,3 +1893,303 @@ h1[id], h2[id], h3[id], h4[id], h5[id], h6[id] {
|
|
|
1893
1893
|
#sourcey .godoc-type .godoc-symbol {
|
|
1894
1894
|
word-break: break-word;
|
|
1895
1895
|
}
|
|
1896
|
+
|
|
1897
|
+
/* ── Rust API rendering (rustdoc adapter) ────────────────────────── */
|
|
1898
|
+
/* Shared API primitives (api-*) introduced for rustdoc and reusable
|
|
1899
|
+
by godoc/doxygen in a follow-on retrofit. Class names mirror
|
|
1900
|
+
rustdoc's DOM so deep-links from a rustdoc URL line up with
|
|
1901
|
+
sourcey output. */
|
|
1902
|
+
|
|
1903
|
+
#sourcey .rust-item {
|
|
1904
|
+
border-top: 1px solid rgb(var(--color-gray-200));
|
|
1905
|
+
padding-top: 1rem;
|
|
1906
|
+
margin-top: 1.25rem;
|
|
1907
|
+
}
|
|
1908
|
+
.dark #sourcey .rust-item {
|
|
1909
|
+
border-top-color: rgb(var(--color-gray-800));
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1912
|
+
#sourcey .code-header,
|
|
1913
|
+
#sourcey .rust-signature {
|
|
1914
|
+
font-family: ui-monospace, "SF Mono", "Cascadia Code", Consolas, "Liberation Mono", Menlo, monospace;
|
|
1915
|
+
font-size: 0.9375rem;
|
|
1916
|
+
color: rgb(var(--color-gray-900));
|
|
1917
|
+
white-space: pre-wrap;
|
|
1918
|
+
word-break: break-word;
|
|
1919
|
+
}
|
|
1920
|
+
.dark #sourcey .code-header,
|
|
1921
|
+
.dark #sourcey .rust-signature {
|
|
1922
|
+
color: rgb(var(--color-gray-100));
|
|
1923
|
+
}
|
|
1924
|
+
|
|
1925
|
+
#sourcey .rust-signature .kw {
|
|
1926
|
+
color: rgb(var(--color-rose-600));
|
|
1927
|
+
font-weight: 600;
|
|
1928
|
+
}
|
|
1929
|
+
.dark #sourcey .rust-signature .kw {
|
|
1930
|
+
color: rgb(var(--color-rose-300));
|
|
1931
|
+
}
|
|
1932
|
+
|
|
1933
|
+
#sourcey .rust-signature .ident {
|
|
1934
|
+
color: rgb(var(--color-indigo-600));
|
|
1935
|
+
}
|
|
1936
|
+
.dark #sourcey .rust-signature .ident {
|
|
1937
|
+
color: rgb(var(--color-indigo-300));
|
|
1938
|
+
}
|
|
1939
|
+
|
|
1940
|
+
#sourcey .rust-signature .lifetime {
|
|
1941
|
+
color: rgb(var(--color-amber-700));
|
|
1942
|
+
font-style: italic;
|
|
1943
|
+
}
|
|
1944
|
+
.dark #sourcey .rust-signature .lifetime {
|
|
1945
|
+
color: rgb(var(--color-amber-300));
|
|
1946
|
+
}
|
|
1947
|
+
|
|
1948
|
+
#sourcey .api-rightside,
|
|
1949
|
+
#sourcey .rightside {
|
|
1950
|
+
float: right;
|
|
1951
|
+
font-size: 0.8125rem;
|
|
1952
|
+
color: rgb(var(--color-gray-500));
|
|
1953
|
+
}
|
|
1954
|
+
|
|
1955
|
+
#sourcey .api-since,
|
|
1956
|
+
#sourcey .since {
|
|
1957
|
+
font-feature-settings: "tnum";
|
|
1958
|
+
}
|
|
1959
|
+
|
|
1960
|
+
#sourcey .api-srclink,
|
|
1961
|
+
#sourcey .srclink {
|
|
1962
|
+
color: rgb(var(--color-indigo-600));
|
|
1963
|
+
text-decoration: none;
|
|
1964
|
+
}
|
|
1965
|
+
#sourcey .api-srclink:hover,
|
|
1966
|
+
#sourcey .srclink:hover {
|
|
1967
|
+
text-decoration: underline;
|
|
1968
|
+
}
|
|
1969
|
+
.dark #sourcey .api-srclink,
|
|
1970
|
+
.dark #sourcey .srclink {
|
|
1971
|
+
color: rgb(var(--color-indigo-300));
|
|
1972
|
+
}
|
|
1973
|
+
|
|
1974
|
+
#sourcey .docblock,
|
|
1975
|
+
#sourcey .rust-doc {
|
|
1976
|
+
color: rgb(var(--color-gray-700));
|
|
1977
|
+
margin-top: 0.5rem;
|
|
1978
|
+
}
|
|
1979
|
+
.dark #sourcey .docblock,
|
|
1980
|
+
.dark #sourcey .rust-doc {
|
|
1981
|
+
color: rgb(var(--color-gray-300));
|
|
1982
|
+
}
|
|
1983
|
+
|
|
1984
|
+
#sourcey .stab,
|
|
1985
|
+
#sourcey .api-stab {
|
|
1986
|
+
display: block;
|
|
1987
|
+
margin: 0.5rem 0;
|
|
1988
|
+
padding: 0.5rem 0.75rem;
|
|
1989
|
+
border-radius: 0.375rem;
|
|
1990
|
+
font-size: 0.875rem;
|
|
1991
|
+
border: 1px solid transparent;
|
|
1992
|
+
}
|
|
1993
|
+
#sourcey .stab.unstable,
|
|
1994
|
+
#sourcey .api-stab-unstable {
|
|
1995
|
+
background-color: rgb(var(--color-amber-50));
|
|
1996
|
+
border-color: rgb(var(--color-amber-200));
|
|
1997
|
+
color: rgb(var(--color-amber-900));
|
|
1998
|
+
}
|
|
1999
|
+
#sourcey .stab.deprecated,
|
|
2000
|
+
#sourcey .api-stab-deprecated {
|
|
2001
|
+
background-color: rgb(var(--color-rose-50));
|
|
2002
|
+
border-color: rgb(var(--color-rose-200));
|
|
2003
|
+
color: rgb(var(--color-rose-900));
|
|
2004
|
+
}
|
|
2005
|
+
#sourcey .stab.portability,
|
|
2006
|
+
#sourcey .api-stab-portability {
|
|
2007
|
+
background-color: rgb(var(--color-emerald-50));
|
|
2008
|
+
border-color: rgb(var(--color-emerald-200));
|
|
2009
|
+
color: rgb(var(--color-emerald-900));
|
|
2010
|
+
}
|
|
2011
|
+
.dark #sourcey .stab.unstable,
|
|
2012
|
+
.dark #sourcey .api-stab-unstable {
|
|
2013
|
+
background-color: rgba(251, 191, 36, 0.08);
|
|
2014
|
+
border-color: rgba(251, 191, 36, 0.25);
|
|
2015
|
+
color: rgb(var(--color-amber-200));
|
|
2016
|
+
}
|
|
2017
|
+
.dark #sourcey .stab.deprecated,
|
|
2018
|
+
.dark #sourcey .api-stab-deprecated {
|
|
2019
|
+
background-color: rgba(244, 63, 94, 0.08);
|
|
2020
|
+
border-color: rgba(244, 63, 94, 0.25);
|
|
2021
|
+
color: rgb(var(--color-rose-200));
|
|
2022
|
+
}
|
|
2023
|
+
.dark #sourcey .stab.portability,
|
|
2024
|
+
.dark #sourcey .api-stab-portability {
|
|
2025
|
+
background-color: rgba(16, 185, 129, 0.08);
|
|
2026
|
+
border-color: rgba(16, 185, 129, 0.25);
|
|
2027
|
+
color: rgb(var(--color-emerald-200));
|
|
2028
|
+
}
|
|
2029
|
+
|
|
2030
|
+
/* Collapsible trait-impl block. Chevron pattern mirrors .godoc-example so the
|
|
2031
|
+
disclosure reads the same across adapters. */
|
|
2032
|
+
#sourcey .api-toggle {
|
|
2033
|
+
margin: 0.75rem 0;
|
|
2034
|
+
border: 1px solid rgb(var(--color-gray-200));
|
|
2035
|
+
border-radius: 6px;
|
|
2036
|
+
background: rgba(var(--color-gray-50), 0.4);
|
|
2037
|
+
}
|
|
2038
|
+
.dark #sourcey .api-toggle {
|
|
2039
|
+
border-color: rgb(var(--color-gray-800));
|
|
2040
|
+
}
|
|
2041
|
+
#sourcey .api-toggle > summary {
|
|
2042
|
+
cursor: pointer;
|
|
2043
|
+
padding: 0.5rem 0.875rem;
|
|
2044
|
+
list-style: none;
|
|
2045
|
+
font-family: var(--font-mono);
|
|
2046
|
+
font-size: 0.8125rem;
|
|
2047
|
+
color: rgb(var(--color-gray-700));
|
|
2048
|
+
}
|
|
2049
|
+
.dark #sourcey .api-toggle > summary {
|
|
2050
|
+
color: rgb(var(--color-gray-300));
|
|
2051
|
+
}
|
|
2052
|
+
#sourcey .api-toggle > summary::-webkit-details-marker {
|
|
2053
|
+
display: none;
|
|
2054
|
+
}
|
|
2055
|
+
#sourcey .api-toggle > summary::before {
|
|
2056
|
+
content: "▸ ";
|
|
2057
|
+
color: rgb(var(--color-gray-400));
|
|
2058
|
+
margin-right: 0.25rem;
|
|
2059
|
+
}
|
|
2060
|
+
#sourcey .api-toggle[open] > summary::before {
|
|
2061
|
+
content: "▾ ";
|
|
2062
|
+
}
|
|
2063
|
+
/* The impl header lives inside the summary; keep it inline with the chevron
|
|
2064
|
+
and strip heading margins. */
|
|
2065
|
+
#sourcey .api-toggle > summary .rust-impl-header {
|
|
2066
|
+
display: inline;
|
|
2067
|
+
margin: 0;
|
|
2068
|
+
font-size: inherit;
|
|
2069
|
+
}
|
|
2070
|
+
#sourcey .api-toggle-body {
|
|
2071
|
+
padding: 0.25rem 0.875rem 0.5rem;
|
|
2072
|
+
border-top: 1px solid rgb(var(--color-gray-200));
|
|
2073
|
+
}
|
|
2074
|
+
.dark #sourcey .api-toggle-body {
|
|
2075
|
+
border-top-color: rgb(var(--color-gray-800));
|
|
2076
|
+
}
|
|
2077
|
+
/* Marker / auto / blanket trait impls: a quiet list, not expandable boxes. */
|
|
2078
|
+
#sourcey .rust-impl-rows {
|
|
2079
|
+
margin: 0.5rem 0 0.75rem;
|
|
2080
|
+
}
|
|
2081
|
+
#sourcey .rust-impl-row {
|
|
2082
|
+
padding: 0.2rem 0;
|
|
2083
|
+
}
|
|
2084
|
+
#sourcey .rust-impl-row .rust-impl-header {
|
|
2085
|
+
display: inline;
|
|
2086
|
+
margin: 0;
|
|
2087
|
+
font-size: 0.8125rem;
|
|
2088
|
+
font-weight: 400;
|
|
2089
|
+
color: rgb(var(--color-gray-600));
|
|
2090
|
+
}
|
|
2091
|
+
.dark #sourcey .rust-impl-row .rust-impl-header {
|
|
2092
|
+
color: rgb(var(--color-gray-400));
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2095
|
+
#sourcey .anchor,
|
|
2096
|
+
#sourcey .api-anchor {
|
|
2097
|
+
margin-left: 0.4rem;
|
|
2098
|
+
color: rgb(var(--color-gray-400));
|
|
2099
|
+
text-decoration: none;
|
|
2100
|
+
opacity: 0;
|
|
2101
|
+
transition: opacity 0.1s ease;
|
|
2102
|
+
}
|
|
2103
|
+
#sourcey .section-header:hover .anchor,
|
|
2104
|
+
#sourcey .section-header:hover .api-anchor,
|
|
2105
|
+
#sourcey .code-header:hover .anchor,
|
|
2106
|
+
#sourcey .code-header:hover .api-anchor {
|
|
2107
|
+
opacity: 1;
|
|
2108
|
+
}
|
|
2109
|
+
|
|
2110
|
+
/* Inherent-impl methods and trait members render inline as their own sections.
|
|
2111
|
+
Code (signatures, doctests) flows through the shared Shiki code block, so no
|
|
2112
|
+
bespoke code styling lives here. */
|
|
2113
|
+
#sourcey .rust-member {
|
|
2114
|
+
margin: 0.75rem 0;
|
|
2115
|
+
}
|
|
2116
|
+
#sourcey .rust-method-header {
|
|
2117
|
+
margin: 0.5rem 0 0.25rem;
|
|
2118
|
+
}
|
|
2119
|
+
#sourcey .rust-doctest {
|
|
2120
|
+
margin: 0.75rem 0;
|
|
2121
|
+
}
|
|
2122
|
+
|
|
2123
|
+
#sourcey .rust-doctest-badges {
|
|
2124
|
+
display: flex;
|
|
2125
|
+
flex-wrap: wrap;
|
|
2126
|
+
gap: 0.25rem;
|
|
2127
|
+
margin-bottom: 0.25rem;
|
|
2128
|
+
}
|
|
2129
|
+
#sourcey .rust-doctest-badge {
|
|
2130
|
+
display: inline-block;
|
|
2131
|
+
padding: 0.05rem 0.4rem;
|
|
2132
|
+
font-size: 0.6875rem;
|
|
2133
|
+
font-weight: 600;
|
|
2134
|
+
border-radius: 0.25rem;
|
|
2135
|
+
background-color: rgb(var(--color-gray-100));
|
|
2136
|
+
color: rgb(var(--color-gray-700));
|
|
2137
|
+
text-transform: lowercase;
|
|
2138
|
+
letter-spacing: 0.02em;
|
|
2139
|
+
}
|
|
2140
|
+
.dark #sourcey .rust-doctest-badge {
|
|
2141
|
+
background-color: rgb(var(--color-gray-800));
|
|
2142
|
+
color: rgb(var(--color-gray-300));
|
|
2143
|
+
}
|
|
2144
|
+
#sourcey .rust-doctest-badge-should_panic,
|
|
2145
|
+
#sourcey .rust-doctest-badge-compile_fail {
|
|
2146
|
+
background-color: rgb(var(--color-rose-100));
|
|
2147
|
+
color: rgb(var(--color-rose-800));
|
|
2148
|
+
}
|
|
2149
|
+
#sourcey .rust-doctest-badge-no_run,
|
|
2150
|
+
#sourcey .rust-doctest-badge-ignore {
|
|
2151
|
+
background-color: rgb(var(--color-amber-100));
|
|
2152
|
+
color: rgb(var(--color-amber-800));
|
|
2153
|
+
}
|
|
2154
|
+
|
|
2155
|
+
#sourcey .rust-doctest-controls {
|
|
2156
|
+
display: flex;
|
|
2157
|
+
gap: 0.5rem;
|
|
2158
|
+
margin-top: 0.5rem;
|
|
2159
|
+
font-size: 0.8125rem;
|
|
2160
|
+
}
|
|
2161
|
+
#sourcey .rust-doctest-run,
|
|
2162
|
+
#sourcey .rust-doctest-toggle-hidden {
|
|
2163
|
+
cursor: pointer;
|
|
2164
|
+
padding: 0.2rem 0.6rem;
|
|
2165
|
+
border-radius: 0.375rem;
|
|
2166
|
+
border: 1px solid rgb(var(--color-gray-300));
|
|
2167
|
+
background-color: rgb(var(--color-white));
|
|
2168
|
+
color: rgb(var(--color-gray-800));
|
|
2169
|
+
text-decoration: none;
|
|
2170
|
+
line-height: 1;
|
|
2171
|
+
}
|
|
2172
|
+
#sourcey .rust-doctest-run:hover,
|
|
2173
|
+
#sourcey .rust-doctest-toggle-hidden:hover {
|
|
2174
|
+
background-color: rgb(var(--color-gray-50));
|
|
2175
|
+
}
|
|
2176
|
+
.dark #sourcey .rust-doctest-run,
|
|
2177
|
+
.dark #sourcey .rust-doctest-toggle-hidden {
|
|
2178
|
+
background-color: rgb(var(--color-gray-900));
|
|
2179
|
+
border-color: rgb(var(--color-gray-700));
|
|
2180
|
+
color: rgb(var(--color-gray-200));
|
|
2181
|
+
}
|
|
2182
|
+
|
|
2183
|
+
/* On the aggregated doctests page the code block already renders as a card, so
|
|
2184
|
+
the section itself stays borderless. Just space the entries and accent the
|
|
2185
|
+
heading so they don't read as cards within cards. */
|
|
2186
|
+
#sourcey .rust-doctests-index .rust-doctest {
|
|
2187
|
+
margin: 1.5rem 0;
|
|
2188
|
+
}
|
|
2189
|
+
#sourcey .rust-doctests-index .rust-doctest > h3 {
|
|
2190
|
+
padding-left: 0.625rem;
|
|
2191
|
+
border-left: 3px solid rgb(var(--color-emerald-500));
|
|
2192
|
+
}
|
|
2193
|
+
.dark #sourcey .rust-doctests-index .rust-doctest > h3 {
|
|
2194
|
+
border-left-color: rgb(var(--color-emerald-400));
|
|
2195
|
+
}
|
|
@@ -2,6 +2,7 @@ import type { NormalizedOperation } from "../core/types.js";
|
|
|
2
2
|
import type { CodeSample } from "../core/types.js";
|
|
3
3
|
/** Default languages when none configured. */
|
|
4
4
|
export declare const DEFAULT_CODE_SAMPLE_LANGS: string[];
|
|
5
|
+
export declare const SUPPORTED_CODE_SAMPLE_LANGS: readonly string[];
|
|
5
6
|
/**
|
|
6
7
|
* Generate code samples for an operation.
|
|
7
8
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-samples.d.ts","sourceRoot":"","sources":["../../src/utils/code-samples.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"code-samples.d.ts","sourceRoot":"","sources":["../../src/utils/code-samples.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAoNnD,8CAA8C;AAC9C,eAAO,MAAM,yBAAyB,UAAmC,CAAC;AAC1E,eAAO,MAAM,2BAA2B,mBAAyC,CAAC;AAMlF;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,EAAE,EAAE,mBAAmB,EACvB,SAAS,EAAE,MAAM,EACjB,KAAK,GAAE,MAAM,EAA8B,GAC1C,UAAU,EAAE,CAiBd"}
|