@vite-hub/docs 0.0.0-stage → 0.3.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/LICENSE +201 -0
- package/README.md +453 -2
- package/dist/agent-copy-BJp_Yf5d.js +33 -0
- package/dist/assistant-shared-CdtXowot.js +97 -0
- package/dist/assistant-shared-Dll_F_yy.d.ts +27 -0
- package/dist/assistant-worker.d.ts +11 -0
- package/dist/assistant-worker.js +16 -0
- package/dist/assistant.d.ts +14 -0
- package/dist/assistant.js +19 -0
- package/dist/content-9CINWiRf.js +171 -0
- package/dist/draft-DUBx--r9.js +45 -0
- package/dist/error-diagnostics-BoOsP6Y4.js +53 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +27 -0
- package/dist/link-checker-redirects.d.ts +13 -0
- package/dist/link-checker-redirects.js +25 -0
- package/dist/manifest-D66AEF8F.js +420 -0
- package/dist/manifest-Dzp5-_AJ.d.ts +74 -0
- package/dist/markdown-Cn9-4oVG.js +378 -0
- package/dist/navigation.d.ts +284 -0
- package/dist/navigation.js +520 -0
- package/dist/nuxt-B5LrERKc.d.ts +240 -0
- package/dist/nuxt.d.ts +3 -0
- package/dist/nuxt.js +1485 -0
- package/dist/page-BbmSfZO8.js +81 -0
- package/dist/page-Dx2JD3y1.d.ts +74 -0
- package/dist/primitive-rail.d.ts +110 -0
- package/dist/primitive-rail.js +284 -0
- package/dist/raw-C03EUJKw.js +851 -0
- package/dist/redirects-BrbWFSzW.js +62 -0
- package/dist/runtime/app/app.vue +11 -0
- package/dist/runtime/app/assistant/DocsAssistant.vue +81 -0
- package/dist/runtime/app/assistant/DocsAssistantOff.vue +8 -0
- package/dist/runtime/app/assistant/DocsAssistantPanel.vue +322 -0
- package/dist/runtime/app/components/AppHeader.vue +368 -0
- package/dist/runtime/app/components/AppSearch.vue +68 -0
- package/dist/runtime/app/components/DocsAppShell.vue +62 -0
- package/dist/runtime/app/components/DocsArticle.vue +184 -0
- package/dist/runtime/app/components/DocsAsideFooter.vue +94 -0
- package/dist/runtime/app/components/DocsAsideLeftBody.vue +584 -0
- package/dist/runtime/app/components/DocsAsideLeftTop.vue +132 -0
- package/dist/runtime/app/components/DocsBrandMark.vue +52 -0
- package/dist/runtime/app/components/DocsCatalogFooter.vue +129 -0
- package/dist/runtime/app/components/DocsCodePanel.vue +388 -0
- package/dist/runtime/app/components/DocsCodePre.vue +120 -0
- package/dist/runtime/app/components/DocsHeaderActions.vue +4 -0
- package/dist/runtime/app/components/DocsLanding.vue +83 -0
- package/dist/runtime/app/components/DocsMarkdown.vue +64 -0
- package/dist/runtime/app/components/DocsPage.vue +149 -0
- package/dist/runtime/app/components/DocsPageCredits.vue +41 -0
- package/dist/runtime/app/components/DocsPageHeaderLinks.vue +120 -0
- package/dist/runtime/app/components/DocsRail.vue +239 -0
- package/dist/runtime/app/components/DocsSidebarStrip.vue +81 -0
- package/dist/runtime/app/components/DocsSidebars.vue +63 -0
- package/dist/runtime/app/components/OgImage/DocsPage.takumi.vue +33 -0
- package/dist/runtime/app/components/content/AgentOnly.vue +9 -0
- package/dist/runtime/app/components/content/CodeTree.vue +203 -0
- package/dist/runtime/app/components/content/ComarkHtml.vue +31 -0
- package/dist/runtime/app/components/content/Correct.vue +17 -0
- package/dist/runtime/app/components/content/Example.vue +260 -0
- package/dist/runtime/app/components/content/ExamplePreview.vue +6 -0
- package/dist/runtime/app/components/content/Examples.vue +71 -0
- package/dist/runtime/app/components/content/Incorrect.vue +17 -0
- package/dist/runtime/app/components/content/PageList.vue +206 -0
- package/dist/runtime/app/components/content/ProductFeatureItem.vue +43 -0
- package/dist/runtime/app/components/content/ProductFeatures.vue +17 -0
- package/dist/runtime/app/components/content/TutorialStep.vue +39 -0
- package/dist/runtime/app/composables/docs-assistant-problem.ts +59 -0
- package/dist/runtime/app/composables/docs-theme.ts +15 -0
- package/dist/runtime/app/composables/docs.ts +83 -0
- package/dist/runtime/app/composables/headerActions.ts +6 -0
- package/dist/runtime/app/composables/icons.ts +14 -0
- package/dist/runtime/app/composables/seo.ts +64 -0
- package/dist/runtime/app/composables/tutorial.ts +40 -0
- package/dist/runtime/app/composables/useDocsAssistant.ts +17 -0
- package/dist/runtime/app/error.vue +88 -0
- package/dist/runtime/app/layouts/default.vue +7 -0
- package/dist/runtime/app/layouts/docs.vue +104 -0
- package/dist/runtime/app/middleware/docs-layout.ts +23 -0
- package/dist/runtime/app/pages/docs-page.vue +3 -0
- package/dist/runtime/app/plugins/comark-css.ts +14 -0
- package/dist/runtime/app/plugins/icon-stroke.ts +12 -0
- package/dist/runtime/app/plugins/theme-color.ts +18 -0
- package/dist/runtime/app/utils/docs-theme.ts +43 -0
- package/dist/runtime/app/utils/file-tree.ts +40 -0
- package/dist/runtime/server/llms.d.ts +6 -0
- package/dist/runtime/server/llms.js +7 -0
- package/dist/runtime/server/markdown.d.ts +10 -0
- package/dist/runtime/server/markdown.js +11 -0
- package/dist/runtime/server/mcp.d.ts +6 -0
- package/dist/runtime/server/mcp.js +7 -0
- package/dist/runtime/server/page.d.ts +7 -0
- package/dist/runtime/server/page.js +27 -0
- package/dist/runtime/server/raw.d.ts +10 -0
- package/dist/runtime/server/raw.js +23 -0
- package/dist/runtime/server/search.d.ts +6 -0
- package/dist/runtime/server/search.js +32 -0
- package/dist/runtime/server/sitemap.d.ts +6 -0
- package/dist/runtime/server/sitemap.js +52 -0
- package/dist/runtime/server/trailing-slash.d.ts +10 -0
- package/dist/runtime/server/trailing-slash.js +28 -0
- package/dist/runtime/theme/design.css +464 -0
- package/dist/schema-DwpXW0VZ.js +98 -0
- package/dist/server.d.ts +15 -0
- package/dist/server.js +5 -0
- package/dist/theme-BXyu4uFL.d.ts +32 -0
- package/dist/theme-DzC8LtMH.js +237 -0
- package/dist/theme.d.ts +2 -0
- package/dist/theme.js +2 -0
- package/dist/types-BhG6vGfG.d.ts +212 -0
- package/package.json +141 -3
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
import { t as docsErrorDiagnostics } from "./error-diagnostics-BoOsP6Y4.js";
|
|
2
|
+
import { defu } from "defu";
|
|
3
|
+
import { ELEMENT_NODE, parse, walkSync } from "ultrahtml";
|
|
4
|
+
import { contentSearchSections } from "@vite-hub/content";
|
|
5
|
+
import { createMarkdownParser, parseFrontmatter } from "comark/parse";
|
|
6
|
+
import { renderHtmlFromDocument } from "@comark/html";
|
|
7
|
+
import { textContent } from "comark/utils";
|
|
8
|
+
import alert from "comark/plugins/alert";
|
|
9
|
+
import attributes from "comark/plugins/attributes";
|
|
10
|
+
import components from "comark/plugins/components";
|
|
11
|
+
import shiki from "comark/plugins/shiki";
|
|
12
|
+
import taskList from "comark/plugins/task-list";
|
|
13
|
+
import toc from "comark/plugins/toc";
|
|
14
|
+
import comarkUiHtml from "comark-ui/html";
|
|
15
|
+
import comarkUi from "comark-ui/vue";
|
|
16
|
+
import css from "shiki/dist/langs/css.mjs";
|
|
17
|
+
import diff from "shiki/dist/langs/diff.mjs";
|
|
18
|
+
import html from "shiki/dist/langs/html.mjs";
|
|
19
|
+
import markdownLanguage from "shiki/dist/langs/markdown.mjs";
|
|
20
|
+
import mdc from "shiki/dist/langs/mdc.mjs";
|
|
21
|
+
import githubDark from "shiki/dist/themes/github-dark-default.mjs";
|
|
22
|
+
import githubLight from "shiki/dist/themes/github-light-default.mjs";
|
|
23
|
+
//#region src/markdown.ts
|
|
24
|
+
const languages = [
|
|
25
|
+
css,
|
|
26
|
+
diff,
|
|
27
|
+
html,
|
|
28
|
+
markdownLanguage,
|
|
29
|
+
mdc
|
|
30
|
+
];
|
|
31
|
+
const themes = {
|
|
32
|
+
light: githubLight,
|
|
33
|
+
dark: githubDark
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* The blocks of comark-ui: callouts, tabs, steps, code with its toolbar, zoomable images, charts, Mermaid diagrams,
|
|
37
|
+
* and the rest. The site's CSS styles the prose, so comark-ui's typeset is off. Chips are off too: they turn every web
|
|
38
|
+
* link into a chip and fetch its favicon. A site turns them on with `comarkUi: { chips: true }`. Kroki diagrams are
|
|
39
|
+
* off: they send each D2, PlantUML, or Graphviz fence to kroki.io while the page parses. Mermaid stays on, since
|
|
40
|
+
* comark-pele draws it in the process. Remove the Kroki override when comark-ui turns drawing off by default
|
|
41
|
+
* (https://github.com/onmax/comark-ui/issues/446).
|
|
42
|
+
*
|
|
43
|
+
* The plugins are the HTML preset's, so annotate, comments, diff, and quiz parse too, with the Vue preset's copy of
|
|
44
|
+
* every plugin the two share.
|
|
45
|
+
*/
|
|
46
|
+
function docsBlocks(options = {}) {
|
|
47
|
+
const merged = defu(options, {
|
|
48
|
+
typeset: false,
|
|
49
|
+
chips: false,
|
|
50
|
+
diagrams: false,
|
|
51
|
+
badge: { download: false }
|
|
52
|
+
});
|
|
53
|
+
if (merged.diagrams === false) merged.diagrams = { draw: false };
|
|
54
|
+
const vue = new Map(comarkUi(merged).plugins.map((plugin) => [plugin.name, plugin]));
|
|
55
|
+
return comarkUiHtml(merged).plugins.map((plugin) => vue.get(plugin.name) ?? plugin);
|
|
56
|
+
}
|
|
57
|
+
const htmlBlocks = comarkUiHtml().components;
|
|
58
|
+
const tagKey = (tag) => tag.replaceAll("-", "").toLowerCase();
|
|
59
|
+
const vueBlocks = comarkUi();
|
|
60
|
+
const vueTags = new Set([...Object.keys(vueBlocks.components), ...vueBlocks.tags].map(tagKey));
|
|
61
|
+
const htmlOnly = new Set(Object.keys(htmlBlocks).filter((tag) => !vueTags.has(tagKey(tag))));
|
|
62
|
+
const drawsAsHtml = (node) => htmlOnly.has(node[0]) || node[0] === "chart" && Array.isArray(node[1].marks) && node[1].marks.length > 0;
|
|
63
|
+
const isElement = (node) => Array.isArray(node) && typeof node[0] === "string";
|
|
64
|
+
const phrasing = /^(?:p|h[1-6]|a|span|em|strong|del|s|mark|sup|sub|small|label)$/;
|
|
65
|
+
/** Draw the page's HTML-only blocks in one context, so styles, fonts, and scripts are emitted once. */
|
|
66
|
+
async function renderHtmlBlocks(nodes) {
|
|
67
|
+
const blocks = /* @__PURE__ */ new Map();
|
|
68
|
+
const visit = (nodes, from = 0, parent) => {
|
|
69
|
+
for (let at = from; at < nodes.length; at++) {
|
|
70
|
+
const node = nodes[at];
|
|
71
|
+
if (!isElement(node)) continue;
|
|
72
|
+
const tag = node[0];
|
|
73
|
+
const html = drawsAsHtml(node);
|
|
74
|
+
visit(node, 2, tag);
|
|
75
|
+
if (html) {
|
|
76
|
+
const rendered = [
|
|
77
|
+
"comark-html",
|
|
78
|
+
{
|
|
79
|
+
block: tag,
|
|
80
|
+
blockProps: node[1],
|
|
81
|
+
...parent && phrasing.test(parent) ? { inline: true } : {}
|
|
82
|
+
},
|
|
83
|
+
...node.slice(2)
|
|
84
|
+
];
|
|
85
|
+
blocks.set(rendered, node);
|
|
86
|
+
nodes[at] = rendered;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
visit(nodes);
|
|
91
|
+
if (!blocks.size) return;
|
|
92
|
+
const source = (node) => {
|
|
93
|
+
if (!isElement(node)) return node;
|
|
94
|
+
const [tag, attributes, ...children] = blocks.get(node) ?? node;
|
|
95
|
+
return [
|
|
96
|
+
tag,
|
|
97
|
+
attributes,
|
|
98
|
+
...children.map(source)
|
|
99
|
+
];
|
|
100
|
+
};
|
|
101
|
+
let assets = "";
|
|
102
|
+
await renderHtmlFromDocument({ nodes: [...blocks.keys()].reverse() }, { components: {
|
|
103
|
+
...htmlBlocks,
|
|
104
|
+
"comark-html": async (node, state) => {
|
|
105
|
+
let html = (await state.render([source(node)])).trim();
|
|
106
|
+
const ranges = [];
|
|
107
|
+
walkSync(parse(html), (element) => {
|
|
108
|
+
if (element.type !== ELEMENT_NODE || !/^(style|script|link)$/.test(element.name)) return;
|
|
109
|
+
const start = element.loc[0].start;
|
|
110
|
+
const end = element.loc[1].end;
|
|
111
|
+
assets += html.slice(start, end);
|
|
112
|
+
ranges.push([start, end]);
|
|
113
|
+
});
|
|
114
|
+
for (const [start, end] of ranges.reverse()) html = html.slice(0, start) + html.slice(end);
|
|
115
|
+
node[1].html = html;
|
|
116
|
+
return html;
|
|
117
|
+
}
|
|
118
|
+
} });
|
|
119
|
+
if (assets) nodes.push(["comark-html", {
|
|
120
|
+
html: assets,
|
|
121
|
+
inline: true
|
|
122
|
+
}]);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* The Comark parser options of a docs page: components (`::name`), comark-ui's blocks, GitHub alerts, task lists,
|
|
126
|
+
* highlighted code, and a heading outline. The page route parses through Content with these options, and drafts,
|
|
127
|
+
* credits, and search parse with the same ones through `createDocsParser()`, so every path gives the same nodes.
|
|
128
|
+
*
|
|
129
|
+
* Pass them to `defineContent({ markdown })`. `preset: false` keeps Content's own comark-ui preset out, since these
|
|
130
|
+
* plugins already hold the docs configuration of comark-ui.
|
|
131
|
+
*/
|
|
132
|
+
function docsMarkdown(options = {}) {
|
|
133
|
+
const extra = options.plugins ?? [];
|
|
134
|
+
const configured = options.examples ?? {};
|
|
135
|
+
const isSources = (value) => Object.values(value).every((source) => typeof source === "string");
|
|
136
|
+
const settings = isSources(configured) ? {} : configured;
|
|
137
|
+
const examplePlugin = examples((markdown) => parseExample(markdown), {
|
|
138
|
+
...options.exampleSources,
|
|
139
|
+
...isSources(configured) ? configured : {}
|
|
140
|
+
}, settings);
|
|
141
|
+
const ordered = [
|
|
142
|
+
alert(),
|
|
143
|
+
taskList(),
|
|
144
|
+
components(),
|
|
145
|
+
attributes(),
|
|
146
|
+
...docsBlocks(options.comarkUi),
|
|
147
|
+
shiki({
|
|
148
|
+
languages,
|
|
149
|
+
themes,
|
|
150
|
+
registerDefaultThemes: false
|
|
151
|
+
}),
|
|
152
|
+
toc({
|
|
153
|
+
depth: 3,
|
|
154
|
+
searchDepth: 2
|
|
155
|
+
}),
|
|
156
|
+
examplePlugin,
|
|
157
|
+
...extra
|
|
158
|
+
];
|
|
159
|
+
const byName = new Map(ordered.map((plugin) => [plugin.name, plugin]));
|
|
160
|
+
const plugins = ordered.filter((plugin) => byName.get(plugin.name) === plugin && plugin !== examplePlugin);
|
|
161
|
+
if (byName.get(examplePlugin.name) === examplePlugin) plugins.push(examplePlugin);
|
|
162
|
+
const parseExample = createMarkdownParser({
|
|
163
|
+
autoClose: true,
|
|
164
|
+
plugins
|
|
165
|
+
});
|
|
166
|
+
return {
|
|
167
|
+
preset: false,
|
|
168
|
+
autoClose: true,
|
|
169
|
+
plugins: [...plugins, docsPageStep]
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
const pixels = (value) => {
|
|
173
|
+
const parsed = Number(value);
|
|
174
|
+
return parsed > 0 ? parsed : void 0;
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* Gives an image of the app's `public/` folder its `width` and `height`, so the browser keeps its room before the
|
|
178
|
+
* picture loads and the page does not move. comark-ui measures only data URIs and remote URLs, not a path on the site.
|
|
179
|
+
* An image with one side keeps it and gets the other at the picture's ratio. A side in other units, like `50%`, is the
|
|
180
|
+
* author's layout, so the image is left alone.
|
|
181
|
+
*/
|
|
182
|
+
function docsImageSizes(sizes) {
|
|
183
|
+
const visit = (nodes) => {
|
|
184
|
+
for (const node of nodes) {
|
|
185
|
+
if (!isElement(node)) continue;
|
|
186
|
+
const attrs = node[1];
|
|
187
|
+
const size = node[0] === "img" && typeof attrs.src === "string" ? sizes[attrs.src.split(/[?#]/)[0]] : void 0;
|
|
188
|
+
if (size && (attrs.width === void 0 || attrs.height === void 0)) {
|
|
189
|
+
const width = pixels(attrs.width);
|
|
190
|
+
const height = pixels(attrs.height);
|
|
191
|
+
if ((attrs.width === void 0 || width) && (attrs.height === void 0 || height)) {
|
|
192
|
+
const ratio = size[1] / size[0];
|
|
193
|
+
attrs.width = String(width ?? (height ? Math.round(height / ratio) : size[0]));
|
|
194
|
+
attrs.height = String(height ?? (width ? Math.round(width * ratio) : size[1]));
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
visit(node.slice(2));
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
return {
|
|
201
|
+
name: "docs-image-sizes",
|
|
202
|
+
post: (state) => visit(state.tree.nodes)
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
/** The last step of a page parse, after every plugin: list items without paragraphs, example anchors, and HTML-only blocks. */
|
|
206
|
+
const docsPageStep = {
|
|
207
|
+
name: "docs-page",
|
|
208
|
+
async post(state) {
|
|
209
|
+
const nodes = isolateExampleHeadings(unwrapListParagraphs(state.tree.nodes));
|
|
210
|
+
await renderHtmlBlocks(nodes);
|
|
211
|
+
state.tree.nodes = nodes;
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* Parse Markdown with the plugins of `docsMarkdown()`. The client renders the nodes with comark-ui's components.
|
|
216
|
+
*/
|
|
217
|
+
function createDocsParser(options = {}) {
|
|
218
|
+
const { autoClose, plugins } = docsMarkdown(options);
|
|
219
|
+
const parse = createMarkdownParser({
|
|
220
|
+
autoClose,
|
|
221
|
+
plugins
|
|
222
|
+
});
|
|
223
|
+
return async (markdown) => {
|
|
224
|
+
const document = await parse(markdown);
|
|
225
|
+
return {
|
|
226
|
+
nodes: document.nodes,
|
|
227
|
+
toc: tocOf(document)
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
/** The page of a document that Content parsed with `docsMarkdown()`. */
|
|
232
|
+
function docsDocumentOf(document) {
|
|
233
|
+
return {
|
|
234
|
+
nodes: document.nodes,
|
|
235
|
+
toc: tocOf(document)
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
const markdownLanguages = /* @__PURE__ */ new Set([
|
|
239
|
+
"md",
|
|
240
|
+
"markdown",
|
|
241
|
+
"mdc",
|
|
242
|
+
"comark"
|
|
243
|
+
]);
|
|
244
|
+
/** `::correct` and `::incorrect` are examples with a title. */
|
|
245
|
+
const defaultExampleTags = [
|
|
246
|
+
"example",
|
|
247
|
+
"correct",
|
|
248
|
+
"incorrect"
|
|
249
|
+
];
|
|
250
|
+
/**
|
|
251
|
+
* `::example` shows a preview and its source, a switch apart. Around a Markdown code block, the preview is that
|
|
252
|
+
* Markdown, parsed here with the page's own plugins. With `name`, it is the Vue file of that name in the examples
|
|
253
|
+
* folder, and its source becomes the code block. Either way the page reaches the browser as nodes.
|
|
254
|
+
*/
|
|
255
|
+
function examples(parse, sources, options) {
|
|
256
|
+
const exampleTags = new Set(options.tags ?? defaultExampleTags);
|
|
257
|
+
const visit = async (nodes) => {
|
|
258
|
+
for (const node of nodes) {
|
|
259
|
+
if (typeof node === "string" || node[0] === null) continue;
|
|
260
|
+
const children = node.slice(2);
|
|
261
|
+
if (!exampleTags.has(node[0])) {
|
|
262
|
+
await visit(children);
|
|
263
|
+
continue;
|
|
264
|
+
}
|
|
265
|
+
const name = typeof node[1].name === "string" ? node[1].name : void 0;
|
|
266
|
+
if (name) {
|
|
267
|
+
const source = sources[name];
|
|
268
|
+
if (source === void 0) throw docsErrorDiagnostics.DOCS_EXAMPLE_MISSING({ name });
|
|
269
|
+
const fence = "`".repeat(Math.max(3, ...[...source.matchAll(/`+/g)].map((run) => run[0].length + 1)));
|
|
270
|
+
const { nodes: code } = await parse(`${fence}vue\n${source.trim()}\n${fence}\n`);
|
|
271
|
+
node.splice(2, node.length, ...code);
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
274
|
+
if (children.some((child) => typeof child !== "string" && child[0] === "example-preview")) continue;
|
|
275
|
+
const pre = children.find((child) => typeof child !== "string" && child[0] === "pre");
|
|
276
|
+
const language = pre && typeof pre[1].language === "string" ? pre[1].language : "";
|
|
277
|
+
if (!pre || !markdownLanguages.has(language)) continue;
|
|
278
|
+
const markdown = typeof pre[1].code === "string" ? pre[1].code : textContent(pre);
|
|
279
|
+
const url = await options.play?.(markdown, node[0]);
|
|
280
|
+
if (url !== void 0) node[1].play = url;
|
|
281
|
+
try {
|
|
282
|
+
parseFrontmatter(markdown);
|
|
283
|
+
} catch {
|
|
284
|
+
continue;
|
|
285
|
+
}
|
|
286
|
+
const preview = await parse(markdown);
|
|
287
|
+
node.splice(2, 0, [
|
|
288
|
+
"example-preview",
|
|
289
|
+
{},
|
|
290
|
+
...preview.nodes
|
|
291
|
+
]);
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
return {
|
|
295
|
+
name: "docs-examples",
|
|
296
|
+
post: (state) => visit(state.tree.nodes)
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
/** Preview anchors belong to their own document, including links to headings in that preview. */
|
|
300
|
+
function isolateExampleHeadings(nodes) {
|
|
301
|
+
const used = /* @__PURE__ */ new Set();
|
|
302
|
+
const walk = (nodes, visit, skipPreviews = false) => {
|
|
303
|
+
for (const node of nodes) {
|
|
304
|
+
if (typeof node === "string" || node[0] === null || skipPreviews && node[0] === "example-preview") continue;
|
|
305
|
+
visit(node);
|
|
306
|
+
walk(node.slice(2), visit, skipPreviews);
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
walk(nodes, (node) => {
|
|
310
|
+
if (typeof node[1].id === "string") used.add(node[1].id);
|
|
311
|
+
});
|
|
312
|
+
let preview = 0;
|
|
313
|
+
const rewrite = (nodes, anchors = /* @__PURE__ */ new Map()) => nodes.map((node) => {
|
|
314
|
+
if (typeof node === "string" || node[0] === null) return node;
|
|
315
|
+
const [tag, props, ...children] = node;
|
|
316
|
+
const scope = tag === "example-preview" ? /* @__PURE__ */ new Map() : anchors;
|
|
317
|
+
if (tag === "example-preview") {
|
|
318
|
+
const prefix = `docs-example-${++preview}-`;
|
|
319
|
+
walk(children, ([heading, props]) => {
|
|
320
|
+
if (heading === null || !/^h[1-6]$/.test(heading) || typeof props.id !== "string") return;
|
|
321
|
+
let id = `${prefix}${props.id}`;
|
|
322
|
+
while (used.has(id)) id += "-preview";
|
|
323
|
+
used.add(id);
|
|
324
|
+
scope.set(props.id, id);
|
|
325
|
+
}, true);
|
|
326
|
+
}
|
|
327
|
+
const id = /^h[1-6]$/.test(tag) && typeof props.id === "string" ? scope.get(props.id) : void 0;
|
|
328
|
+
const href = tag === "a" && typeof props.href === "string" && props.href.startsWith("#") ? scope.get(props.href.slice(1)) : void 0;
|
|
329
|
+
return [
|
|
330
|
+
tag,
|
|
331
|
+
{
|
|
332
|
+
...props,
|
|
333
|
+
...id ? { id } : {},
|
|
334
|
+
...href ? { href: `#${href}` } : {}
|
|
335
|
+
},
|
|
336
|
+
...rewrite(children, scope)
|
|
337
|
+
];
|
|
338
|
+
});
|
|
339
|
+
return rewrite(nodes);
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* A list item holds its text directly, also in a loose list with blank lines between items. The prose theme spaces
|
|
343
|
+
* list items itself, and a paragraph margin inside each item doubled that space.
|
|
344
|
+
*/
|
|
345
|
+
function unwrapListParagraphs(nodes, inListItem = false) {
|
|
346
|
+
return nodes.flatMap((node) => {
|
|
347
|
+
if (typeof node === "string" || node[0] === null) return [node];
|
|
348
|
+
const [tag, props, ...children] = node;
|
|
349
|
+
const unwrapped = unwrapListParagraphs(children, tag === "li");
|
|
350
|
+
return inListItem && tag === "p" ? unwrapped : [[
|
|
351
|
+
tag,
|
|
352
|
+
props,
|
|
353
|
+
...unwrapped
|
|
354
|
+
]];
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
function tocOf(document) {
|
|
358
|
+
return Reflect.get(document.meta, "toc")?.links ?? [];
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Blocks that search skips: `::agent-only`, which the site does not render, an example's preview, which repeats its
|
|
362
|
+
* source, and the styles that comark-ui adds.
|
|
363
|
+
*/
|
|
364
|
+
const searchIgnore = [
|
|
365
|
+
"agent-only",
|
|
366
|
+
"example-preview",
|
|
367
|
+
"typeset-styles"
|
|
368
|
+
];
|
|
369
|
+
/** Split a page into one search entry per h2 and h3, like Nuxt UI's content search expects. */
|
|
370
|
+
function docsSearchSections(path, title, nodes) {
|
|
371
|
+
return contentSearchSections({
|
|
372
|
+
path,
|
|
373
|
+
title,
|
|
374
|
+
nodes
|
|
375
|
+
}, { ignore: searchIgnore });
|
|
376
|
+
}
|
|
377
|
+
//#endregion
|
|
378
|
+
export { docsSearchSections as a, docsMarkdown as i, docsDocumentOf as n, docsImageSizes as r, createDocsParser as t };
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import { a as DocsSection, i as DocsSearchSection, n as DocsManifest, r as DocsPage, t as DocsAppPage } from "./types-BhG6vGfG.js";
|
|
2
|
+
//#region src/navigation.d.ts
|
|
3
|
+
/** A link that the site options add to the shell, such as a tutorials page or a community chat. */
|
|
4
|
+
export interface DocsLink {
|
|
5
|
+
label: string;
|
|
6
|
+
to: string;
|
|
7
|
+
icon?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Icons of the navigation. Frontmatter and `.navigation.yml` icons pass through `aliases`, so a site can show one icon set
|
|
11
|
+
* in its sidebar while pages keep the icons that their authors chose.
|
|
12
|
+
*/
|
|
13
|
+
export interface DocsIcons {
|
|
14
|
+
/** Rail icon per section id: a `@vite-hub/docs/primitive-rail` icon name or an Iconify name. */
|
|
15
|
+
rail: Record<string, string>;
|
|
16
|
+
/** Sidebar icon per section id. It replaces the section's own icon. */
|
|
17
|
+
sections: Record<string, string>;
|
|
18
|
+
/** Sidebar icon per page path. It replaces the page's own icon. */
|
|
19
|
+
pages: Record<string, string>;
|
|
20
|
+
/** Replacement per icon name. */
|
|
21
|
+
aliases: Record<string, string>;
|
|
22
|
+
/**
|
|
23
|
+
* Icon prefix of the sidebar, such as `i-lucide-`, or several prefixes, such as `["i-lucide-", "i-vitehub-"]`. An icon
|
|
24
|
+
* outside them that `aliases` does not map shows the fallback icon, so the sidebar keeps one style. `""` or `[]` allows
|
|
25
|
+
* every icon.
|
|
26
|
+
*/
|
|
27
|
+
family: string | string[];
|
|
28
|
+
/** Icon of a page without one. */
|
|
29
|
+
page: string;
|
|
30
|
+
/** Icon of a section without one. */
|
|
31
|
+
section: string;
|
|
32
|
+
/**
|
|
33
|
+
* Stroke width of line icons that Iconify draws 2px wide, such as Lucide. The default `1.5` matches the ViteHub icon
|
|
34
|
+
* set. `false` keeps each icon as its set draws it.
|
|
35
|
+
*/
|
|
36
|
+
stroke: number | false;
|
|
37
|
+
}
|
|
38
|
+
/** One catalog row: the sections of one category, in rail order. */
|
|
39
|
+
export interface DocsCatalogGroup<Page extends DocsAppPage = DocsPage> {
|
|
40
|
+
category: string;
|
|
41
|
+
sections: DocsSection<Page>[];
|
|
42
|
+
}
|
|
43
|
+
/** One group of the sidebar page list. `label` is `null` for pages without a group. */
|
|
44
|
+
export interface DocsSidebarGroup<Page extends DocsAppPage = DocsPage> {
|
|
45
|
+
label: string | null;
|
|
46
|
+
pages: Page[];
|
|
47
|
+
/** Whether the group starts folded. Only a labeled group of a section with `fold: true` folds. */
|
|
48
|
+
fold: boolean;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* A rail entry that holds several sections, such as every component package of a library. The rail shows one item
|
|
52
|
+
* for the group, and its sidebar lists every section of the group.
|
|
53
|
+
*/
|
|
54
|
+
export interface DocsGroup {
|
|
55
|
+
/** Rail label, and the value of `group` in the `.navigation.yml` of a member section. */
|
|
56
|
+
title: string;
|
|
57
|
+
/** Rail icon. Without it, the rail shows the icon of the first section of the group. */
|
|
58
|
+
icon?: string;
|
|
59
|
+
/** Ids of member sections. A section also joins with `group: <title>` in its `.navigation.yml`. */
|
|
60
|
+
sections?: string[];
|
|
61
|
+
}
|
|
62
|
+
/** One rail item: a section alone, or the sections of a group, in rail order. */
|
|
63
|
+
export interface DocsRailEntry<Page extends DocsAppPage = DocsPage> {
|
|
64
|
+
title: string;
|
|
65
|
+
/** Icon of the group. `null` shows the rail icon of the first section. */
|
|
66
|
+
icon: string | null;
|
|
67
|
+
sections: DocsSection<Page>[];
|
|
68
|
+
}
|
|
69
|
+
/** A section in a sidebar that lists several sections: its home page, then its other listed pages by group. */
|
|
70
|
+
export interface DocsSidebarSection<Page extends DocsAppPage = DocsPage> {
|
|
71
|
+
section: DocsSection<Page>;
|
|
72
|
+
home: Page | null;
|
|
73
|
+
groups: DocsSidebarGroup<Page>[];
|
|
74
|
+
}
|
|
75
|
+
/** One block of a sidebar that lists several sections. `category` is `null` when all the sections share one category. */
|
|
76
|
+
export interface DocsSidebarSectionBlock<Page extends DocsAppPage = DocsPage> {
|
|
77
|
+
category: string | null;
|
|
78
|
+
sections: DocsSidebarSection<Page>[];
|
|
79
|
+
}
|
|
80
|
+
/** Every page of the manifest, root first. */
|
|
81
|
+
export declare function docsManifestPages<Page extends DocsAppPage = DocsPage>(manifest: DocsManifest<Page>): Page[];
|
|
82
|
+
/** A URL path without a trailing slash or `/index`, as the manifest stores it. */
|
|
83
|
+
export declare function normalizeDocsPath(path: string): string;
|
|
84
|
+
/** A browser URL for an app-relative route or asset. Router links keep their app-relative paths. */
|
|
85
|
+
export declare function docsAppPath(path: string, appBase?: string): string;
|
|
86
|
+
/**
|
|
87
|
+
* The one URL that search engines index for an app path: the site origin, the app base, and no trailing slash or
|
|
88
|
+
* `/index`. The home of the app keeps its slash, as `https://example.com/portal/`: Nitro serves an app below its base
|
|
89
|
+
* only. The canonical link, the sitemap, and the trailing-slash redirect all use it, so they name one URL per page.
|
|
90
|
+
*/
|
|
91
|
+
export declare function docsCanonicalUrl(siteUrl: string, path: string, appBase?: string): string;
|
|
92
|
+
/** A docs base with one leading slash and no trailing slash: `docs/` is `/docs`, and `/` stays `/`. */
|
|
93
|
+
export declare function normalizeDocsBase(base: string): string;
|
|
94
|
+
/** Whether a path is the docs base or a page under it. Every path is under a base of `/`. */
|
|
95
|
+
export declare function isDocsPath(path: string, base: string): boolean;
|
|
96
|
+
/** The page at a URL. A trailing slash and `/index` resolve to the same page. */
|
|
97
|
+
export declare function findDocsPage<Page extends DocsAppPage = DocsPage>(manifest: DocsManifest<Page>, path: string): {
|
|
98
|
+
page: Page;
|
|
99
|
+
section: DocsSection<Page> | null;
|
|
100
|
+
} | null;
|
|
101
|
+
/** Loaders of the panels the app manifest leaves out, by the URL of each panel's Overview. */
|
|
102
|
+
export type DocsPanelLoaders = Record<string, () => Promise<{
|
|
103
|
+
default: DocsAppPage[];
|
|
104
|
+
}>>;
|
|
105
|
+
/**
|
|
106
|
+
* Adds the pages of every panel that holds `path` to the app manifest, so the panel's sidebar and its pages resolve.
|
|
107
|
+
* Pages that the manifest already has stay as they are, so loading twice, or a full manifest, changes nothing.
|
|
108
|
+
*/
|
|
109
|
+
export declare function loadDocsPanels(manifest: DocsManifest<DocsAppPage>, path: string, loaders: DocsPanelLoaders): Promise<void>;
|
|
110
|
+
/** The section that owns a path, such as `kv` for `/docs/kv/configure`. */
|
|
111
|
+
export declare function docsSectionForPath<Page extends DocsAppPage = DocsPage>(manifest: DocsManifest<Page>, path: string): DocsSection<Page> | null;
|
|
112
|
+
/** The page that a section link opens: its Overview, else its first listed page. A section without `index.md` has no page at its own path. */
|
|
113
|
+
export declare function docsSectionHome(section: DocsSection<DocsAppPage>): string;
|
|
114
|
+
/** The `start` option as the app reads it. Nuxt turns a `null` in runtime config into "", which reads as no start. */
|
|
115
|
+
export type DocsStart = {
|
|
116
|
+
section: string;
|
|
117
|
+
links?: Pick<DocsLink, "to">[];
|
|
118
|
+
} | "";
|
|
119
|
+
/**
|
|
120
|
+
* The first start link that opens a docs page outside the docs base, such as an Introduction outside every section.
|
|
121
|
+
* It leads the start section, so the links that open it begin there. `null` when no start link is a docs page.
|
|
122
|
+
*/
|
|
123
|
+
export declare function docsStartPage(manifest: DocsManifest<DocsAppPage>, start?: DocsStart): string | null;
|
|
124
|
+
/**
|
|
125
|
+
* The page that a "Docs" link opens: the docs base page, unless it is a `home` landing page, else the first start link
|
|
126
|
+
* that is a docs page, else the start section, else the first section. `null` when the site has no docs pages.
|
|
127
|
+
*/
|
|
128
|
+
export declare function docsHomePath(manifest: DocsManifest<DocsAppPage>, start?: DocsStart): string | null;
|
|
129
|
+
/**
|
|
130
|
+
* Whether the site shows the section rail. A rail of three or fewer items, or of sections without their own icons,
|
|
131
|
+
* shows the same fallback icon several times and carries no information, so the sidebar lists every section instead.
|
|
132
|
+
* The sections of one group count as one item. Only items placed in the rail count.
|
|
133
|
+
*/
|
|
134
|
+
export declare function docsHasRail(manifest: DocsManifest<DocsAppPage>, icons: Pick<DocsIcons, "rail" | "sections">, groups?: readonly DocsGroup[], options?: {
|
|
135
|
+
categories: readonly string[];
|
|
136
|
+
railExclude: readonly string[];
|
|
137
|
+
}): boolean;
|
|
138
|
+
/** Title of the group of a section: the `groups` entry that lists it, else the `group` of its `.navigation.yml`. */
|
|
139
|
+
export declare function docsSectionGroup(section: Pick<DocsSection<DocsAppPage>, "id" | "group">, groups: readonly DocsGroup[]): string | null;
|
|
140
|
+
/**
|
|
141
|
+
* The sections that share a section's sidebar under the rail, or `null` when it lists its own pages. A group lists all
|
|
142
|
+
* its sections. A section whose only listed page is its home would list that one link, so it lists its category.
|
|
143
|
+
*/
|
|
144
|
+
export declare function docsSidebarGroup<Page extends DocsAppPage = DocsPage>(manifest: DocsManifest<Page>, section: DocsSection<Page>, groups: readonly DocsGroup[]): {
|
|
145
|
+
title: string;
|
|
146
|
+
sections: DocsSection<Page>[];
|
|
147
|
+
} | null;
|
|
148
|
+
/** Sections grouped by category, in the order of `categories`. Sections of other categories are left out. */
|
|
149
|
+
export declare function docsCatalog<Page extends DocsAppPage = DocsPage>(manifest: DocsManifest<Page>, categories: readonly string[]): DocsCatalogGroup<Page>[];
|
|
150
|
+
/**
|
|
151
|
+
* Rail groups: one per catalog category except `railExclude`, then the sections without a known category.
|
|
152
|
+
* Excluded topics stay reachable from the catalog and the start section.
|
|
153
|
+
*/
|
|
154
|
+
export declare function docsRailGroups<Page extends DocsAppPage = DocsPage>(manifest: DocsManifest<Page>, categories: readonly string[], railExclude: readonly string[]): DocsSection<Page>[][];
|
|
155
|
+
/**
|
|
156
|
+
* Rail items in rail groups: `docsRailGroups()`, with the sections of one group in one item. The item takes the place
|
|
157
|
+
* of the first section of its group that the rail shows. It holds every section of the group in manifest order, also
|
|
158
|
+
* one whose category `railExclude` leaves out of the rail.
|
|
159
|
+
*/
|
|
160
|
+
export declare function docsRailEntries<Page extends DocsAppPage = DocsPage>(manifest: DocsManifest<Page>, options: {
|
|
161
|
+
categories: readonly string[];
|
|
162
|
+
railExclude: readonly string[];
|
|
163
|
+
groups: readonly DocsGroup[];
|
|
164
|
+
}): DocsRailEntry<Page>[][];
|
|
165
|
+
/** The rail item of a section, or `null` for a section outside every group that the rail leaves out. */
|
|
166
|
+
export declare function docsRailEntry<Page extends DocsAppPage = DocsPage>(manifest: DocsManifest<Page>, options: {
|
|
167
|
+
categories: readonly string[];
|
|
168
|
+
railExclude: readonly string[];
|
|
169
|
+
groups: readonly DocsGroup[];
|
|
170
|
+
}, section: DocsSection<Page>): DocsRailEntry<Page> | null;
|
|
171
|
+
/**
|
|
172
|
+
* Blocks of a sidebar that lists several sections, such as a group or a site without a rail. Each section shows its
|
|
173
|
+
* home page, then its other listed pages. When the sections span several categories, each run of one category is a
|
|
174
|
+
* block with that category as its heading.
|
|
175
|
+
*/
|
|
176
|
+
export declare function docsSidebarSections<Page extends DocsAppPage = DocsPage>(sections: readonly DocsSection<Page>[]): DocsSidebarSectionBlock<Page>[];
|
|
177
|
+
/**
|
|
178
|
+
* Sidebar rows of a section: listed pages in order, grouped by `navigation.group` in order of first appearance. Pages
|
|
179
|
+
* inside a panel are left out: the section sidebar links to each panel once, with `docsSectionPanels()`.
|
|
180
|
+
*/
|
|
181
|
+
export declare function docsSidebarGroups<Page extends DocsAppPage = DocsPage>(section: Pick<DocsSection<Page>, "pages" | "fold">): DocsSidebarGroup<Page>[];
|
|
182
|
+
/**
|
|
183
|
+
* How many links of a panel group the sidebar renders around the current page. A panel of a thousand codes would
|
|
184
|
+
* otherwise put every code in the HTML of each of its pages, which made each page about 240 KB larger.
|
|
185
|
+
*/
|
|
186
|
+
export declare const docsPanelWindow = 60;
|
|
187
|
+
/**
|
|
188
|
+
* The pages of a panel group that the sidebar renders before the reader asks for more: up to {@link docsPanelWindow}
|
|
189
|
+
* pages around the current one, or none in a group that does not hold it, because that group starts folded.
|
|
190
|
+
*/
|
|
191
|
+
export declare function docsPanelGroupWindow<Page extends Pick<DocsAppPage, "path">>(pages: readonly Page[], currentPath: string, size?: number): Page[];
|
|
192
|
+
/** Sidebar rows of a panel: its listed pages without its Overview, grouped like a section. Panels hold long lists, so their groups fold. */
|
|
193
|
+
export declare function docsPanelSidebarGroups<Page extends DocsAppPage = DocsPage>(section: Pick<DocsSection<Page>, "pages">, panel: DocsAppPage): DocsSidebarGroup<Page>[];
|
|
194
|
+
/**
|
|
195
|
+
* The panel that holds a page: the Overview of the nearest folder with `navigation.panel: true`, or `null` for a page
|
|
196
|
+
* outside every panel. A panel's Overview is inside its own panel.
|
|
197
|
+
*/
|
|
198
|
+
export declare function docsPanelOf<Page extends DocsAppPage = DocsPage>(section: Pick<DocsSection<Page>, "pages">, page: Pick<DocsAppPage, "id">): Page | null;
|
|
199
|
+
/** The pages of one panel, or with `null` the pages of the section outside every panel. */
|
|
200
|
+
export declare function docsPanelPages<Page extends DocsAppPage = DocsPage>(section: Pick<DocsSection<Page>, "pages">, panel: Pick<DocsAppPage, "id"> | null): Page[];
|
|
201
|
+
/** The listed panels of a section, each with the number of listed pages inside it. The section sidebar links to each one. */
|
|
202
|
+
export declare function docsSectionPanels<Page extends DocsAppPage = DocsPage>(section: Pick<DocsSection<Page>, "pages">): {
|
|
203
|
+
page: Page;
|
|
204
|
+
count: number;
|
|
205
|
+
}[];
|
|
206
|
+
/**
|
|
207
|
+
* The page that a rail item opens. Inside a panel, the rail keeps the reader in it: a section with a panel of the same
|
|
208
|
+
* folder name opens that panel. Any other section opens its home page.
|
|
209
|
+
*/
|
|
210
|
+
export declare function docsRailTarget(section: DocsSection<DocsAppPage>, panel: Pick<DocsAppPage, "id"> | null): string;
|
|
211
|
+
/** Whether search engines may index a page. `seo.index: false` keeps it out of the sitemap, llms.txt, and the prerender, and search lists only its title. */
|
|
212
|
+
export declare function docsPageIndexed(page: Pick<DocsPage, "seo">): boolean;
|
|
213
|
+
/** Every page that search engines may index, root first. */
|
|
214
|
+
export declare function docsIndexedPages(manifest: DocsManifest): DocsPage[];
|
|
215
|
+
/**
|
|
216
|
+
* One search record for each page that search engines skip: its title and description, without its headings. The record
|
|
217
|
+
* ranks as a heading under its section, so a long tail of generated pages, such as error codes, stays below the real pages.
|
|
218
|
+
*/
|
|
219
|
+
export declare function docsUnindexedSearchSections(manifest: DocsManifest): DocsSearchSection[];
|
|
220
|
+
/** Sections listed under Related, in the order that `.navigation.yml` declares them. */
|
|
221
|
+
export declare function docsRelatedSections<Page extends DocsAppPage = DocsPage>(manifest: DocsManifest<Page>, section: DocsSection<Page>): DocsSection<Page>[];
|
|
222
|
+
/** Sidebar icon of a page. */
|
|
223
|
+
export declare function docsPageIcon(icons: DocsIcons, page: Pick<DocsAppPage, "path" | "icon">): string;
|
|
224
|
+
/** Sidebar and catalog icon of a section. */
|
|
225
|
+
export declare function docsSectionIcon(icons: DocsIcons, section: Pick<DocsSection<DocsAppPage>, "id" | "icon">): string;
|
|
226
|
+
/** Rail icon of a section. Without a rail entry the rail shows the sidebar icon. */
|
|
227
|
+
export declare function docsRailIcon(icons: DocsIcons, section: Pick<DocsSection<DocsAppPage>, "id" | "icon">): string;
|
|
228
|
+
/**
|
|
229
|
+
* Draws a 2px line icon with `stroke` instead. @nuxt/icon passes only the icon body in its CSS mode, so the icon is
|
|
230
|
+
* recognized by its body: Lucide draws `stroke-width="2"` with round joins. Filled icons, such as brand logos, have no
|
|
231
|
+
* stroke and stay as they are. Not reported upstream yet (fix branch:
|
|
232
|
+
* https://github.com/onmax/icon/tree/fix/customize-name-css-mode).
|
|
233
|
+
*/
|
|
234
|
+
export declare function docsIconStroke(body: string, stroke: number): string;
|
|
235
|
+
/** URL of the raw Markdown twin of a page path, such as `/raw/docs/kv.md`. `/` has `/raw/index.md`. */
|
|
236
|
+
export declare function docsRawPath(path: string): string;
|
|
237
|
+
/** File of the raw Markdown twin in the build's raw folder, such as `docs/kv.md`. */
|
|
238
|
+
export declare function docsRawFile(path: string): string;
|
|
239
|
+
/** Identifies the generated footer even when runtime config overrides its build-time URLs. */
|
|
240
|
+
export declare const docsRawSectionLinksMarker = "\n<!-- vitehub-docs:section-links -->\n";
|
|
241
|
+
/**
|
|
242
|
+
* The end of a page's raw Markdown copy: the pages of its section in sidebar order, the next page, and the llms.txt
|
|
243
|
+
* index. An agent that reads one page finds the pages beside it without loading the index of the whole site. A sidebar
|
|
244
|
+
* group other than the page's own shows as one link to its first page, so a large section stays short.
|
|
245
|
+
* `siteUrl` is the public origin with the app base, such as `https://docs.example.com/portal`.
|
|
246
|
+
*/
|
|
247
|
+
export declare function docsRawSectionLinks(manifest: DocsManifest, path: string, siteUrl: string): string;
|
|
248
|
+
/**
|
|
249
|
+
* Cookie that keeps a collapsed sidebar open after the reader opens it, on every page that starts collapsed. A host
|
|
250
|
+
* that serves prerendered HTML reads it.
|
|
251
|
+
*/
|
|
252
|
+
export declare const docsTutorialNavigationCookie = "vh-tutorial-navigation";
|
|
253
|
+
/** Whether a docs page starts with its sidebar collapsed: `sidebar: "collapsed"`, or a code panel tutorial that keeps it. */
|
|
254
|
+
export declare function docsSidebarCollapses(page: Pick<DocsPage, "sidebar" | "codePanel">): boolean;
|
|
255
|
+
/** Links of the page actions: the Markdown twin and chat tools that read it. */
|
|
256
|
+
export interface DocsMarkdownLinks {
|
|
257
|
+
/** Raw Markdown path on the current origin. Local and preview hosts serve it too. */
|
|
258
|
+
markdownPath: string;
|
|
259
|
+
/** Canonical raw Markdown URL that external chat tools can fetch. */
|
|
260
|
+
markdownUrl: string;
|
|
261
|
+
prompt: string;
|
|
262
|
+
chatGptUrl: string;
|
|
263
|
+
claudeUrl: string;
|
|
264
|
+
}
|
|
265
|
+
/** Page action links of a docs page. `site.url` is the canonical origin. */
|
|
266
|
+
export declare function docsMarkdownLinks(site: {
|
|
267
|
+
name: string;
|
|
268
|
+
url: string;
|
|
269
|
+
}, path: string, appBase?: string): DocsMarkdownLinks;
|
|
270
|
+
/** Install deeplinks of an HTTP MCP server. The formats match the @nuxtjs/mcp-toolkit deeplink route. */
|
|
271
|
+
export declare function docsMcpInstallLinks(server: {
|
|
272
|
+
name: string;
|
|
273
|
+
url: string;
|
|
274
|
+
}): {
|
|
275
|
+
cursor: string;
|
|
276
|
+
vscode: string;
|
|
277
|
+
};
|
|
278
|
+
/**
|
|
279
|
+
* The search of the docs dialog. Every query word must match the record. Records whose titles or keywords match more
|
|
280
|
+
* query words come first, then the higher score: page titles over headings and keywords over text. Titles tolerate typos and prefixes, text
|
|
281
|
+
* matches whole words and prefixes. Ties keep the order of the index, which follows the navigation.
|
|
282
|
+
*/
|
|
283
|
+
export declare function createDocsSearch(records: readonly DocsSearchSection[]): (query: string, limit: number) => DocsSearchSection[];
|
|
284
|
+
//#endregion
|