@dooc-dev/dooc 0.0.4 → 0.0.5

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.
Files changed (95) hide show
  1. package/dist/cli.js +41 -3
  2. package/dist/compiler/asset-references.d.ts +4 -0
  3. package/dist/compiler/asset-references.js +117 -0
  4. package/dist/compiler/bundle-urls.d.ts +1 -1
  5. package/dist/compiler/bundle-urls.js +15 -5
  6. package/dist/compiler/check.js +8 -5
  7. package/dist/compiler/code-languages.js +7 -2
  8. package/dist/compiler/compile.d.ts +5 -0
  9. package/dist/compiler/compile.js +105 -10
  10. package/dist/compiler/config.js +2 -1
  11. package/dist/compiler/export.d.ts +4 -0
  12. package/dist/compiler/export.js +140 -0
  13. package/dist/compiler/figures.js +4 -0
  14. package/dist/compiler/files.js +80 -41
  15. package/dist/compiler/fonts.js +4 -1
  16. package/dist/compiler/icons.d.ts +1 -1
  17. package/dist/compiler/icons.js +11 -2
  18. package/dist/compiler/ignored-files.d.ts +3 -0
  19. package/dist/compiler/ignored-files.js +68 -0
  20. package/dist/compiler/locales.js +13 -8
  21. package/dist/compiler/ops.d.ts +6 -0
  22. package/dist/compiler/ops.js +98 -7
  23. package/dist/compiler/subformats.d.ts +24 -0
  24. package/dist/compiler/subformats.js +299 -0
  25. package/dist/compiler/textfile.js +3 -0
  26. package/dist/compiler/theme-variants.js +5 -2
  27. package/dist/core/content-metadata.d.ts +15 -6
  28. package/dist/core/content-metadata.js +278 -17
  29. package/dist/core/content-types.d.ts +3 -1
  30. package/dist/core/figure-frame.js +19 -1
  31. package/dist/core/files.d.ts +2 -1
  32. package/dist/core/files.js +6 -8
  33. package/dist/core/flow-base-css.generated.js +1 -1
  34. package/dist/core/html.js +3 -3
  35. package/dist/core/icons.d.ts +3 -0
  36. package/dist/core/icons.js +3 -0
  37. package/dist/core/json-tools.d.ts +1 -0
  38. package/dist/core/json-tools.js +12 -0
  39. package/dist/core/routing.d.ts +5 -2
  40. package/dist/core/routing.js +17 -5
  41. package/dist/core/subformat-record.d.ts +3 -0
  42. package/dist/core/subformat-record.js +131 -0
  43. package/dist/core/subformats.d.ts +43 -0
  44. package/dist/core/subformats.js +81 -0
  45. package/dist/core/toc-ui.js +25 -23
  46. package/dist/edit.global.js +322 -95
  47. package/dist/mcp.js +50 -9
  48. package/dist/plugins/index.d.ts +1 -0
  49. package/dist/plugins/transport.d.ts +22 -0
  50. package/dist/plugins/transport.js +1 -0
  51. package/dist/plugins.global.js +128 -0
  52. package/dist/subformats.global.js +127 -0
  53. package/dist/ui.global.js +91 -38
  54. package/dist/viewer/build-plugins.d.ts +7 -0
  55. package/dist/viewer/build-plugins.js +70 -0
  56. package/dist/viewer/build.d.ts +9 -0
  57. package/dist/viewer/build.js +32 -5
  58. package/dist/viewer/editor-tools.d.ts +7 -7
  59. package/dist/viewer/editor-tools.js +36 -5
  60. package/dist/viewer/font-picker.js +5 -1
  61. package/dist/viewer/git-diff.d.ts +3 -0
  62. package/dist/viewer/git-diff.js +47 -0
  63. package/dist/viewer/hmr.js +4 -1
  64. package/dist/viewer/i18n.js +7 -5
  65. package/dist/viewer/language-picker.d.ts +2 -2
  66. package/dist/viewer/language-picker.js +26 -9
  67. package/dist/viewer/lazy-graph.d.ts +2 -0
  68. package/dist/viewer/lazy-graph.js +30 -0
  69. package/dist/viewer/locales/eng.json +72 -10
  70. package/dist/viewer/locales/jpn.json +73 -11
  71. package/dist/viewer/locales/zho.json +73 -11
  72. package/dist/viewer/nav-focus.js +8 -1
  73. package/dist/viewer/nav-update.d.ts +2 -0
  74. package/dist/viewer/nav-update.js +117 -0
  75. package/dist/viewer/plugin-style.d.ts +1 -0
  76. package/dist/viewer/plugin-style.js +82 -0
  77. package/dist/viewer/resize.d.ts +0 -2
  78. package/dist/viewer/resize.js +2 -98
  79. package/dist/viewer/resource-library.d.ts +10 -8
  80. package/dist/viewer/resource-library.js +179 -30
  81. package/dist/viewer/search.d.ts +4 -2
  82. package/dist/viewer/search.js +252 -53
  83. package/dist/viewer/serve.d.ts +10 -5
  84. package/dist/viewer/serve.js +789 -278
  85. package/dist/viewer/site-icon.js +13 -6
  86. package/dist/viewer/site-title.js +15 -2
  87. package/dist/viewer/textfile.d.ts +3 -0
  88. package/dist/viewer/textfile.js +19 -2
  89. package/dist/viewer/theme-picker.d.ts +2 -0
  90. package/dist/viewer/theme-picker.js +24 -8
  91. package/dist/viewer/workspace.d.ts +2 -0
  92. package/dist/viewer/workspace.js +46 -1
  93. package/package.json +24 -9
  94. package/dist/compiler/bundle.d.ts +0 -2
  95. package/dist/compiler/bundle.js +0 -100
@@ -1,15 +1,56 @@
1
+ import { basename, extname } from "node:path";
2
+ import { bundledLanguagesInfo } from "shiki/langs";
1
3
  import { visit } from "unist-util-visit";
4
+ import { readManifest } from "../compiler/manifest.js";
5
+ import { loadSubformat, parseSubformatRecord, validateSubformatRecord, } from "../compiler/subformats.js";
2
6
  import { parseTermSource } from "../compiler/terms.js";
3
- import { readTextfile } from "../compiler/textfile.js";
7
+ import { readTextfile, selectTextfileRange } from "../compiler/textfile.js";
8
+ import { parseFileEmbed } from "../core/file-embed.js";
9
+ import { fileExtension, localFile } from "../core/files.js";
4
10
  import { blocksHtml, escapeHtml } from "../core/html.js";
11
+ import { SEARCH_ICON_PATH } from "../core/icons.js";
5
12
  import { parseMdast } from "../core/markdown.js";
13
+ import { subformatChange } from "../core/subformats.js";
14
+ import { parseFileReference, parseTextfileRange } from "../core/textfile.js";
15
+ const codeFormat = (language) => /^(text|txt|plain|plaintext)$/.test(language)
16
+ ? "text"
17
+ : (bundledLanguagesInfo.find((entry) => entry.id === language || entry.aliases?.includes(language))?.id ?? language);
6
18
  /** Index authored content, including files not referenced by any document. */
7
19
  export const resourceIndex = (root, files) => {
8
- const result = { terms: [], code: [], urls: [], errors: [] };
20
+ const result = {
21
+ codeblocks: [],
22
+ urls: [],
23
+ urlPreviews: [],
24
+ subformats: [],
25
+ errors: [],
26
+ };
27
+ const paths = new Set(files);
28
+ const manifest = readManifest(root);
29
+ result.errors.push(...manifest.errors);
30
+ const formats = new Map();
31
+ for (const config of manifest.subformats ?? []) {
32
+ try {
33
+ if (!paths.has(config.schema))
34
+ throw new Error("Schema is not available in the workspace");
35
+ const loaded = loadSubformat(root, config);
36
+ formats.set(config.ext, loaded);
37
+ result.subformats.push({
38
+ ...config,
39
+ fields: loaded.fields,
40
+ template: loaded.template,
41
+ defaultFolder: manifest.defaultSubformatFolder,
42
+ records: [],
43
+ });
44
+ }
45
+ catch (error) {
46
+ result.errors.push(`${config.schema}: ${error instanceof Error ? error.message : String(error)}`);
47
+ }
48
+ }
9
49
  const urls = new Map();
10
- const terms = (raw, source) => {
50
+ const urlPreviews = new Map();
51
+ const references = new Map();
52
+ const validateTerms = (raw, source) => {
11
53
  const parsed = parseTermSource(`${source.file}#L${source.line}`, raw);
12
- result.terms.push(...parsed.entries.map((entry) => ({ entry, source })));
13
54
  result.errors.push(...parsed.errors.map((error) => `${source.file}:L${source.line + error.line}: ${error.message}`));
14
55
  };
15
56
  const scan = (tree, file, offset = 0) => {
@@ -21,14 +62,15 @@ export const resourceIndex = (root, files) => {
21
62
  const source = { file, line: offset + (node.position?.start.line ?? 1) };
22
63
  if (node.type === "code") {
23
64
  const language = node.lang?.toLowerCase() || "text";
24
- result.code.push({
25
- language,
65
+ result.codeblocks.push({
66
+ language: formats.get(language)?.format ?? language,
67
+ format: formats.has(language) ? language : codeFormat(language),
26
68
  caption: node.meta ?? "",
27
69
  content: node.value,
28
70
  source,
29
71
  });
30
72
  if (language === "termth")
31
- terms(node.value, { ...source, line: source.line + 1 });
73
+ validateTerms(node.value, { ...source, line: source.line + 1 });
32
74
  if (language === "callouth")
33
75
  scan(parseMdast(node.value), file, source.line);
34
76
  return;
@@ -40,31 +82,104 @@ export const resourceIndex = (root, files) => {
40
82
  : undefined;
41
83
  if (!target)
42
84
  return;
85
+ if (!/^(?:[a-z][a-z\d+.-]*:|\/\/)/i.test(target)) {
86
+ try {
87
+ const file = parseFileReference(target).file.replace(/^(\.\/)+/, "");
88
+ if (localFile(file) && formats.has(fileExtension(file))) {
89
+ const sources = references.get(file) ?? [];
90
+ sources.push(source);
91
+ references.set(file, sources);
92
+ }
93
+ }
94
+ catch {
95
+ // Invalid references are reported by the compiler.
96
+ }
97
+ }
98
+ const preview = node.type === "image" || node.type === "imageReference";
99
+ if (preview && !/^(?:[a-z][a-z\d+.-]*:|\/\/)/i.test(target)) {
100
+ try {
101
+ const ref = parseFileEmbed(target);
102
+ if (ref.kind !== "textfile")
103
+ return;
104
+ const referencedFile = ref.file.replace(/^(\.\/)+/, "");
105
+ if (!paths.has(referencedFile))
106
+ throw new Error("File is not available in the workspace");
107
+ const language = (extname(referencedFile).slice(1) || basename(referencedFile)).toLowerCase();
108
+ result.codeblocks.push({
109
+ language: formats.get(language)?.format ?? language,
110
+ format: formats.has(language) ? language : codeFormat(language),
111
+ caption: node.alt ?? "",
112
+ content: selectTextfileRange(readTextfile(root, referencedFile), ref.range),
113
+ source,
114
+ reference: {
115
+ file: referencedFile,
116
+ line: ref.range ? parseTextfileRange(ref.range)[0] : 1,
117
+ ...(ref.range ? { range: ref.range } : {}),
118
+ },
119
+ });
120
+ }
121
+ catch (error) {
122
+ result.errors.push(`${file}:L${source.line}: ${target}: ${error instanceof Error ? error.message : String(error)}`);
123
+ }
124
+ return;
125
+ }
43
126
  try {
44
127
  const url = new URL(target);
45
128
  if (!["http:", "https:", "mailto:"].includes(url.protocol))
46
129
  return;
130
+ const entries = preview ? urlPreviews : urls;
47
131
  const key = url.href;
48
- const entry = urls.get(key) ?? {
132
+ const entry = entries.get(key) ?? {
49
133
  url: key,
50
134
  host: url.host || url.protocol,
51
135
  sources: [],
52
136
  };
53
137
  entry.sources.push(source);
54
- urls.set(key, entry);
138
+ entries.set(key, entry);
55
139
  }
56
140
  catch {
57
141
  // Local paths and anchors are not external URL resources.
58
142
  }
59
143
  });
60
144
  };
61
- for (const file of new Set(files)) {
145
+ for (const file of paths) {
146
+ const format = formats.get(fileExtension(file));
147
+ if (format && !(manifest.subformats ?? []).some((item) => item.schema === file)) {
148
+ try {
149
+ const content = readTextfile(root, file);
150
+ result.codeblocks.push({
151
+ language: format.format,
152
+ format: format.ext,
153
+ caption: file,
154
+ content,
155
+ source: { file, line: 1 },
156
+ });
157
+ const data = parseSubformatRecord(content, format.format);
158
+ validateSubformatRecord(format, data);
159
+ result.subformats
160
+ .find((item) => item.ext === format.ext)
161
+ ?.records.push({ file, content, data });
162
+ }
163
+ catch (error) {
164
+ result.errors.push(`${file}: ${error instanceof Error ? error.message : String(error)}`);
165
+ }
166
+ continue;
167
+ }
62
168
  if (!/\.(?:md|termth)$/i.test(file))
63
169
  continue;
64
170
  try {
65
171
  const raw = readTextfile(root, file);
66
- if (/\.termth$/i.test(file))
67
- terms(raw, { file, line: 1 });
172
+ if (/\.termth$/i.test(file)) {
173
+ const source = { file, line: 1 };
174
+ result.codeblocks.push({
175
+ language: "termth",
176
+ format: "termth",
177
+ caption: "",
178
+ content: raw,
179
+ source,
180
+ });
181
+ validateTerms(raw, source);
182
+ }
68
183
  else
69
184
  scan(parseMdast(raw), file);
70
185
  }
@@ -72,33 +187,67 @@ export const resourceIndex = (root, files) => {
72
187
  result.errors.push(`${file}: ${error instanceof Error ? error.message : String(error)}`);
73
188
  }
74
189
  }
75
- result.terms.sort((a, b) => a.entry.name.localeCompare(b.entry.name, undefined, { numeric: true }));
76
190
  result.urls = [...urls.values()].sort((a, b) => a.url.localeCompare(b.url));
191
+ result.urlPreviews = [...urlPreviews.values()].sort((a, b) => a.url.localeCompare(b.url));
192
+ for (const collection of result.subformats)
193
+ for (const record of collection.records)
194
+ record.references = references.get(record.file) ?? [];
77
195
  return result;
78
196
  };
79
197
  export const resourceTabs = (view) => view === "files"
80
198
  ? ""
81
199
  : `<nav class="resource-tabs" aria-label="Resource views" data-i18n-aria-label="Resource views">${[
82
- ["dictionary", "Dictionary"],
83
- ["code", "Code blocks"],
200
+ ["codeblocks", "Codeblocks"],
84
201
  ["urls", "URLs"],
202
+ ["url-previews", "URL previews"],
85
203
  ]
86
- .map(([key, label]) => `<a href="/_statics${key === "dictionary" ? "" : `/${key}`}"${view === key ? ' aria-current="page"' : ""} data-i18n="${label}">${label}</a>`)
204
+ .map(([key, label]) => `<a href="/_statics/${key}"${view === key ? ' aria-current="page"' : ""} data-i18n="${label}">${label}</a>`)
87
205
  .join("")}</nav>`;
88
206
  const sourceLink = ({ file, line }) => `<a class="resource-source" href="/_files/file/${encodeURIComponent(file)}#L${line}" data-resource-source="${escapeHtml(file)}" data-resource-line="${line}" title="${escapeHtml(file)}:L${line}"><span class="resource-source-file">${escapeHtml(file)}</span><span>L${line}</span></a>`;
89
- export const resourceLibraryHtml = (index, view) => {
90
- const groupLabel = view === "code" ? "Code language" : "Domain";
91
- const groups = view === "dictionary"
207
+ export const resourceLibraryHtml = (index, view, pageTitle) => {
208
+ const subformatsOnly = view === "subformats";
209
+ const groupLabel = subformatsOnly ? "Subformats" : view === "codeblocks" ? "Format" : "Domain";
210
+ const urls = view === "url-previews" ? index.urlPreviews : index.urls;
211
+ const groups = [
212
+ ...new Set(subformatsOnly
213
+ ? index.subformats.map((item) => item.ext)
214
+ : view === "codeblocks"
215
+ ? [
216
+ ...index.codeblocks.map((item) => item.format),
217
+ ...index.subformats.map((item) => item.ext),
218
+ ]
219
+ : urls.map((item) => item.host)),
220
+ ].sort();
221
+ const items = subformatsOnly
92
222
  ? []
93
- : [
94
- ...new Set(view === "code"
95
- ? index.code.map((item) => item.language)
96
- : index.urls.map((item) => item.host)),
97
- ].sort();
98
- const items = view === "dictionary"
99
- ? index.terms.map(({ entry, source }) => `<details class="resource-item resource-term" data-resource-item><summary><span class="resource-name" title="${escapeHtml(entry.name)}">${escapeHtml(entry.name)}</span>${sourceLink(source)}</summary><div class="resource-body"><p class="term-definition">${escapeHtml(entry.definition)}</p>${entry.description ? `<p class="resource-description">${escapeHtml(entry.description)}</p>` : ""}</div></details>`)
100
- : view === "code"
101
- ? index.code.map(({ language, caption, content, source }) => `<details class="resource-item resource-code" data-resource-item data-resource-group="${escapeHtml(language)}"><summary><span class="resource-badge">${escapeHtml(language)}</span>${caption ? `<span class="resource-name" title="${escapeHtml(caption)}">${escapeHtml(caption)}</span>` : ""}${sourceLink(source)}</summary><div class="resource-body">${blocksHtml([{ type: "code", lang: language === "mermaid" ? "text" : language, lines: content.split("\n") }])}</div></details>`)
102
- : index.urls.map(({ url, host, sources }) => `<details class="resource-item resource-url" data-resource-item data-resource-group="${escapeHtml(host)}"><summary><a class="resource-name" href="${escapeHtml(url)}" title="${escapeHtml(url)}" target="_blank" rel="noopener noreferrer">${escapeHtml(url)}</a><span class="resource-usage" title="references" data-i18n-title="references">${sources.length}</span></summary><div class="resource-body resource-sources">${sources.map(sourceLink).join("")}</div></details>`);
103
- return `<section class="resource-results" data-resource-results><div class="resource-toolbar"><span data-i18n="Name">Name</span><label class="resource-search"><svg width="13" height="13" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M14 14l4 4M15 9a6 6 0 1 1-12 0 6 6 0 0 1 12 0"/></svg><input type="search" data-resource-search placeholder="Search resources" aria-label="Search resources" data-i18n-placeholder="Search resources" data-i18n-aria-label="Search resources"></label>${groups.length ? `<select data-resource-filter aria-label="${groupLabel}" data-i18n-aria-label="${groupLabel}"><option value="" data-i18n="All">All</option>${groups.map((group) => `<option value="${escapeHtml(group)}">${escapeHtml(group)}</option>`).join("")}</select>` : ""}<span class="resource-count" data-resource-count role="status" aria-live="polite">${items.length}</span></div>${index.errors.length ? `<details class="resource-errors"><summary><span data-i18n="Files with errors">Files with errors</span> (${index.errors.length})</summary><ul>${index.errors.map((error) => `<li>${escapeHtml(error)}</li>`).join("")}</ul></details>` : ""}<div class="resource-items resource-${view}">${items.join("")}</div><p class="resource-empty" data-resource-empty${items.length ? " hidden" : ""} data-i18n="No matching resources">No matching resources</p></section>`;
223
+ : view === "codeblocks"
224
+ ? index.codeblocks.map(({ language, format, caption, content, source, reference }) => {
225
+ const name = caption || (reference ? reference.file + (reference.range ?? "") : "");
226
+ return `<details class="resource-item resource-code" data-resource-item data-resource-group="${escapeHtml(format)}"><summary><span class="resource-badge">${escapeHtml(format)}</span>${name ? `<span class="resource-name" title="${escapeHtml(name)}">${escapeHtml(name)}</span>` : ""}${sourceLink(source)}</summary><div class="resource-body">${reference ? `<div class="resource-sources">${sourceLink(reference)}</div>` : ""}${blocksHtml([{ type: "code", lang: language === "mermaid" ? "text" : language, lines: content.split("\n") }])}</div></details>`;
227
+ })
228
+ : urls.map(({ url, host, sources }) => `<details class="resource-item resource-url" data-resource-item data-resource-group="${escapeHtml(host)}"><summary><a class="resource-name" href="${escapeHtml(url)}" title="${escapeHtml(url)}" target="_blank" rel="noopener noreferrer">${escapeHtml(url)}</a><span class="resource-usage" title="references" data-i18n-title="references">${sources.length}</span></summary><div class="resource-body resource-sources">${sources.map(sourceLink).join("")}</div></details>`);
229
+ const filterGroups = subformatsOnly ? index.subformats.map((item) => item.ext) : groups;
230
+ const selector = filterGroups.length || subformatsOnly
231
+ ? `<select data-resource-filter${subformatsOnly ? " data-subformat-filter hidden" : ""} aria-label="${groupLabel}" data-i18n-aria-label="${groupLabel}">${subformatsOnly ? (filterGroups.length ? "" : '<option value="" data-i18n="Subformats">Subformats</option>') : '<option value="" data-i18n="All">All</option>'}${filterGroups
232
+ .map((group) => {
233
+ const collection = index.subformats.find((item) => item.ext === group);
234
+ const change = collection && subformatChange(collection);
235
+ return `<option value="${escapeHtml(group)}"${change ? ` data-subformat-change="${change}"` : ""}>${escapeHtml(group)}</option>`;
236
+ })
237
+ .join("")}</select>`
238
+ : "";
239
+ const selectedChange = index.subformats[0] && subformatChange(index.subformats[0]);
240
+ const filter = pageTitle !== undefined
241
+ ? `<h1 class="subformat-page-title">${escapeHtml(pageTitle)}</h1>`
242
+ : subformatsOnly
243
+ ? `<div class="subformat-picker">${selector}<button type="button" data-subformat-trigger aria-haspopup="menu" aria-expanded="false"${selectedChange ? ` data-subformat-change="${selectedChange}"` : ""}>${escapeHtml(filterGroups[0] ?? "Subformats")}</button><div class="subformat-picker-menu" data-subformat-options popover="auto" role="menu" aria-label="Subformats" data-i18n-aria-label="Subformats"></div></div>`
244
+ : selector;
245
+ const search = `<label class="resource-search"><svg width="13" height="13" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="${SEARCH_ICON_PATH}"/></svg><input type="search" data-resource-search placeholder="Search resources" aria-label="Search resources" data-i18n-placeholder="Search resources" data-i18n-aria-label="Search resources"></label>`;
246
+ const subformats = subformatsOnly || (view === "codeblocks" && index.subformats.length)
247
+ ? `<template data-subformats>${escapeHtml(JSON.stringify(index.subformats))}</template><div data-subformat-board role="region" hidden></div>`
248
+ : "";
249
+ const emptyMessage = subformatsOnly && !index.subformats.length
250
+ ? "No subformats configured. Add subformats to dooc.yaml."
251
+ : "No matching resources";
252
+ return `<section class="resource-results" data-resource-results${pageTitle !== undefined ? ` data-subformat-page="${escapeHtml(index.subformats[0]?.ext ?? "")}"` : ""}><div class="resource-toolbar">${subformatsOnly ? `<div class="resource-query">${filter}</div>` : `<span data-i18n="Name">Name</span>${search}${filter}`}${subformatsOnly ? "" : `<span class="resource-count" data-resource-count role="status" aria-live="polite">${items.length}</span>`}</div>${subformats}${index.errors.length ? `<details class="resource-errors"><summary><span data-i18n="Files with errors">Files with errors</span> (${index.errors.length})</summary><ul>${index.errors.map((error) => `<li>${escapeHtml(error)}</li>`).join("")}</ul></details>` : ""}<div class="resource-items resource-${view}">${items.join("")}</div><p class="resource-empty" data-resource-empty${items.length ? " hidden" : ""} data-i18n="${emptyMessage}">${emptyMessage}</p></section>`;
104
253
  };
@@ -1,14 +1,16 @@
1
1
  import type { Site } from "./serve.js";
2
2
  export interface SearchSection {
3
+ /** text: rendered document text; file: a file name; folder: a folder document's path. */
4
+ kind: "text" | "file" | "folder";
3
5
  path: string;
4
6
  file: string;
5
- folder: boolean;
6
7
  title: string;
7
8
  heading: string;
8
9
  anchor: string;
9
10
  text: string;
10
11
  }
11
- export declare const searchIndex: (site: Site) => SearchSection[];
12
+ /** `files` are workspace files that open at /_files/file/<path> (edit mode only). */
13
+ export declare const searchIndex: (site: Site, files?: readonly string[]) => SearchSection[];
12
14
  export declare const searchSections: (index: SearchSection[], query: string, currentPath?: string) => (SearchSection & {
13
15
  snippet: string;
14
16
  })[];