@hanzo/docs-core 16.4.3 → 16.5.3
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 +3 -3
- package/dist/{advanced-BRT5Ij43.js → advanced-BH0syJ-M.js} +3 -4
- package/dist/{algolia-CQPXCnjV.js → algolia-C7Crg8-5.js} +2 -3
- package/dist/breadcrumb.d.ts +2 -3
- package/dist/breadcrumb.js +3 -4
- package/dist/{chunk-B-ezknvj.js → chunk-CaR5F9JI.js} +3 -3
- package/dist/content/github.d.ts +1 -2
- package/dist/content/github.js +1 -2
- package/dist/content/index.d.ts +3 -4
- package/dist/content/index.js +1 -2
- package/dist/content/mdx/preset-bundler.d.ts +9 -10
- package/dist/content/mdx/preset-bundler.js +2 -3
- package/dist/content/mdx/preset-runtime.d.ts +9 -10
- package/dist/content/mdx/preset-runtime.js +2 -3
- package/dist/content/toc.d.ts +1 -3
- package/dist/content/toc.js +4 -5
- package/dist/create-i18n-Cv3Cocbs.d.ts +51 -0
- package/dist/{definitions-DuxDer_c.d.ts → definitions-DSNTbAwC.d.ts} +1 -2
- package/dist/dynamic-link.d.ts +3 -4
- package/dist/dynamic-link.js +1 -3
- package/dist/{fetch-B5e9CFfN.js → fetch-HotVeLLF.js} +1 -2
- package/dist/framework/index.d.ts +5 -6
- package/dist/framework/index.js +18 -19
- package/dist/framework/next.d.ts +3 -4
- package/dist/framework/next.js +1 -2
- package/dist/framework/react-router.d.ts +1 -2
- package/dist/framework/react-router.js +1 -2
- package/dist/framework/tanstack.d.ts +4 -5
- package/dist/framework/tanstack.js +2 -3
- package/dist/framework/waku.d.ts +1 -2
- package/dist/framework/waku.js +1 -2
- package/dist/hast-utils-BmGqqmvo.js +15 -0
- package/dist/highlight/client.d.ts +2 -4
- package/dist/highlight/client.js +7 -13
- package/dist/highlight/config.d.ts +15 -0
- package/dist/highlight/config.js +18 -0
- package/dist/highlight/core/client.d.ts +31 -0
- package/dist/highlight/core/client.js +68 -0
- package/dist/highlight/core/index.d.ts +27 -0
- package/dist/highlight/core/index.js +69 -0
- package/dist/highlight/index.d.ts +34 -2
- package/dist/highlight/index.js +57 -2
- package/dist/i18n/index.d.ts +39 -1
- package/dist/i18n/index.js +1 -2
- package/dist/i18n/middleware.d.ts +2 -3
- package/dist/i18n/middleware.js +1 -2
- package/dist/{icon-BWwSDabM.js → icon-OtPFhyk1.js} +1 -2
- package/dist/link.d.ts +3 -4
- package/dist/link.js +1 -2
- package/dist/{mdast-utils-mc9-X-PK.js → mdast-utils-gJMY143g.js} +1 -2
- package/dist/mdx-plugins/codeblock-utils.d.ts +35 -1
- package/dist/mdx-plugins/codeblock-utils.js +2 -3
- package/dist/mdx-plugins/index.d.ts +18 -15
- package/dist/mdx-plugins/index.js +7 -5
- package/dist/mdx-plugins/rehype-code.core.d.ts +38 -0
- package/dist/mdx-plugins/rehype-code.core.js +104 -0
- package/dist/mdx-plugins/rehype-code.d.ts +18 -2
- package/dist/mdx-plugins/rehype-code.js +24 -3
- package/dist/mdx-plugins/rehype-toc.d.ts +16 -1
- package/dist/mdx-plugins/rehype-toc.js +127 -1
- package/dist/mdx-plugins/remark-admonition.d.ts +20 -1
- package/dist/mdx-plugins/remark-admonition.js +2 -3
- package/dist/mdx-plugins/remark-code-tab.d.ts +30 -1
- package/dist/mdx-plugins/remark-code-tab.js +4 -5
- package/dist/mdx-plugins/remark-directive-admonition.d.ts +34 -1
- package/dist/mdx-plugins/remark-directive-admonition.js +1 -2
- package/dist/mdx-plugins/remark-feedback-block.d.ts +51 -0
- package/dist/mdx-plugins/remark-feedback-block.js +47 -0
- package/dist/mdx-plugins/remark-gfm.d.ts +2 -2
- package/dist/mdx-plugins/remark-heading.d.ts +35 -1
- package/dist/mdx-plugins/remark-heading.js +2 -3
- package/dist/mdx-plugins/remark-image.d.ts +63 -1
- package/dist/mdx-plugins/remark-image.js +1 -2
- package/dist/mdx-plugins/remark-mdx-files.d.ts +55 -2
- package/dist/mdx-plugins/remark-mdx-files.js +103 -13
- package/dist/mdx-plugins/remark-mdx-mermaid.d.ts +15 -1
- package/dist/mdx-plugins/remark-mdx-mermaid.js +1 -2
- package/dist/mdx-plugins/remark-npm.d.ts +34 -1
- package/dist/mdx-plugins/remark-npm.js +1 -2
- package/dist/mdx-plugins/remark-steps.d.ts +26 -1
- package/dist/mdx-plugins/remark-steps.js +1 -2
- package/dist/mdx-plugins/remark-structure.d.ts +75 -1
- package/dist/mdx-plugins/remark-structure.js +7 -8
- package/dist/{mixedbread-DlByNYSd.js → mixedbread-Bx9drx9S.js} +6 -5
- package/dist/negotiation/index.d.ts +1 -2
- package/dist/negotiation/index.js +1 -2
- package/dist/{normalize-url-DP9-1I-S.js → normalize-url-DUHbcuVM.js} +2 -3
- package/dist/{orama-cloud-DH3g37zc.js → orama-cloud-ByznDyOk.js} +6 -7
- package/dist/orama-cloud-legacy-BbgJnf5f.js +81 -0
- package/dist/page-tree/index.d.ts +3 -45
- package/dist/page-tree/index.js +1 -1
- package/dist/{index-2U6Tl4--.d.ts → path-B77y3W0_.d.ts} +111 -98
- package/dist/{path-DHIjrDBP.js → path-D0Bwm6Fs.js} +2 -3
- package/dist/{remove-undefined-Cfs4o_mM.js → remove-undefined-CJm9cyrC.js} +1 -2
- package/dist/search/algolia.d.ts +66 -2
- package/dist/search/algolia.js +1 -2
- package/dist/search/client.d.ts +31 -8
- package/dist/search/client.js +27 -22
- package/dist/search/index.d.ts +1 -2
- package/dist/search/index.js +41 -1
- package/dist/search/orama-cloud-legacy.d.ts +77 -0
- package/dist/search/orama-cloud-legacy.js +49 -0
- package/dist/search/orama-cloud.d.ts +5 -9
- package/dist/search/orama-cloud.js +1 -2
- package/dist/search/server.d.ts +87 -4
- package/dist/search/server.js +7 -8
- package/dist/source/client/index.d.ts +13 -11
- package/dist/source/client/index.js +22 -13
- package/dist/source/index.d.ts +5 -3
- package/dist/source/index.js +428 -333
- package/dist/source/plugins/lucide-icons.d.ts +5 -4
- package/dist/source/plugins/lucide-icons.js +2 -3
- package/dist/source/plugins/slugs.d.ts +24 -2
- package/dist/source/plugins/slugs.js +2 -3
- package/dist/source/plugins/status-badges.d.ts +52 -0
- package/dist/source/plugins/status-badges.js +54 -0
- package/dist/source/schema.d.ts +1 -3
- package/dist/source/schema.js +1 -2
- package/dist/{static-Dq8pA8Ay.js → static-DTxK4eHk.js} +5 -6
- package/dist/toc.d.ts +5 -6
- package/dist/toc.js +1 -2
- package/dist/{rehype-code-CdiZ1Y6P.js → transformer-icon-BYedaeE8.js} +1 -96
- package/dist/transformer-icon-D7-6aFzt.d.ts +18 -0
- package/dist/types-BSnJn7kF.d.ts +6 -0
- package/dist/{util-CK2ykiif.d.ts → util-C60LmklF.d.ts} +1 -2
- package/dist/{util-s9piKHsk.js → util-De0ALHOx.js} +1 -2
- package/dist/utils/use-media-query.d.ts +1 -2
- package/dist/utils/use-media-query.js +1 -2
- package/dist/utils/use-on-change.d.ts +1 -2
- package/dist/utils/use-on-change.js +1 -2
- package/dist/{utils-DUvi2WkD.js → utils-Bc53B3CJ.js} +8 -7
- package/dist/utils-IgHyYnrz.d.ts +45 -0
- package/package.json +58 -28
- package/dist/advanced-BRT5Ij43.js.map +0 -1
- package/dist/algolia-CBBN8R6-.d.ts +0 -68
- package/dist/algolia-CBBN8R6-.d.ts.map +0 -1
- package/dist/algolia-CQPXCnjV.js.map +0 -1
- package/dist/breadcrumb.d.ts.map +0 -1
- package/dist/breadcrumb.js.map +0 -1
- package/dist/codeblock-utils-lld8UiQo.d.ts +0 -37
- package/dist/codeblock-utils-lld8UiQo.d.ts.map +0 -1
- package/dist/content/github.d.ts.map +0 -1
- package/dist/content/github.js.map +0 -1
- package/dist/content/index.d.ts.map +0 -1
- package/dist/content/index.js.map +0 -1
- package/dist/content/mdx/preset-bundler.d.ts.map +0 -1
- package/dist/content/mdx/preset-bundler.js.map +0 -1
- package/dist/content/mdx/preset-runtime.d.ts.map +0 -1
- package/dist/content/mdx/preset-runtime.js.map +0 -1
- package/dist/content/toc.d.ts.map +0 -1
- package/dist/content/toc.js.map +0 -1
- package/dist/definitions-DuxDer_c.d.ts.map +0 -1
- package/dist/dynamic-link.d.ts.map +0 -1
- package/dist/dynamic-link.js.map +0 -1
- package/dist/fetch-B5e9CFfN.js.map +0 -1
- package/dist/framework/index.d.ts.map +0 -1
- package/dist/framework/index.js.map +0 -1
- package/dist/framework/next.d.ts.map +0 -1
- package/dist/framework/next.js.map +0 -1
- package/dist/framework/react-router.d.ts.map +0 -1
- package/dist/framework/react-router.js.map +0 -1
- package/dist/framework/tanstack.d.ts.map +0 -1
- package/dist/framework/tanstack.js.map +0 -1
- package/dist/framework/waku.d.ts.map +0 -1
- package/dist/framework/waku.js.map +0 -1
- package/dist/highlight/client.d.ts.map +0 -1
- package/dist/highlight/client.js.map +0 -1
- package/dist/i18n/index.js.map +0 -1
- package/dist/i18n/middleware.d.ts.map +0 -1
- package/dist/i18n/middleware.js.map +0 -1
- package/dist/icon-BWwSDabM.js.map +0 -1
- package/dist/index-2U6Tl4--.d.ts.map +0 -1
- package/dist/index-Bw-DCOra.d.ts +0 -41
- package/dist/index-Bw-DCOra.d.ts.map +0 -1
- package/dist/link.d.ts.map +0 -1
- package/dist/link.js.map +0 -1
- package/dist/mdast-utils-mc9-X-PK.js.map +0 -1
- package/dist/mdx-plugins/codeblock-utils.js.map +0 -1
- package/dist/mdx-plugins/remark-admonition.js.map +0 -1
- package/dist/mdx-plugins/remark-code-tab.js.map +0 -1
- package/dist/mdx-plugins/remark-directive-admonition.js.map +0 -1
- package/dist/mdx-plugins/remark-heading.js.map +0 -1
- package/dist/mdx-plugins/remark-image.js.map +0 -1
- package/dist/mdx-plugins/remark-mdx-files.js.map +0 -1
- package/dist/mdx-plugins/remark-mdx-mermaid.js.map +0 -1
- package/dist/mdx-plugins/remark-npm.js.map +0 -1
- package/dist/mdx-plugins/remark-steps.js.map +0 -1
- package/dist/mdx-plugins/remark-structure.js.map +0 -1
- package/dist/mixedbread-DlByNYSd.js.map +0 -1
- package/dist/negotiation/index.d.ts.map +0 -1
- package/dist/negotiation/index.js.map +0 -1
- package/dist/normalize-url-DP9-1I-S.js.map +0 -1
- package/dist/orama-cloud-DH3g37zc.js.map +0 -1
- package/dist/page-tree/index.d.ts.map +0 -1
- package/dist/path-DHIjrDBP.js.map +0 -1
- package/dist/rehype-code-CdiZ1Y6P.js.map +0 -1
- package/dist/rehype-code-vVWG4-ej.d.ts +0 -58
- package/dist/rehype-code-vVWG4-ej.d.ts.map +0 -1
- package/dist/rehype-toc-DJvSyE0o.d.ts +0 -18
- package/dist/rehype-toc-DJvSyE0o.d.ts.map +0 -1
- package/dist/rehype-toc-DVwJcwvA.js +0 -143
- package/dist/rehype-toc-DVwJcwvA.js.map +0 -1
- package/dist/remark-admonition-DOwBWzsH.d.ts +0 -22
- package/dist/remark-admonition-DOwBWzsH.d.ts.map +0 -1
- package/dist/remark-code-tab-CXsYlims.d.ts +0 -32
- package/dist/remark-code-tab-CXsYlims.d.ts.map +0 -1
- package/dist/remark-directive-admonition-BCm_yiU9.d.ts +0 -36
- package/dist/remark-directive-admonition-BCm_yiU9.d.ts.map +0 -1
- package/dist/remark-gfm-CeWpMwyk.d.ts +0 -2
- package/dist/remark-heading-CXvCY0go.d.ts +0 -37
- package/dist/remark-heading-CXvCY0go.d.ts.map +0 -1
- package/dist/remark-image-CvUis4R1.d.ts +0 -65
- package/dist/remark-image-CvUis4R1.d.ts.map +0 -1
- package/dist/remark-mdx-files-DOYafA4x.d.ts +0 -42
- package/dist/remark-mdx-files-DOYafA4x.d.ts.map +0 -1
- package/dist/remark-mdx-mermaid-BdSUUiCG.d.ts +0 -17
- package/dist/remark-mdx-mermaid-BdSUUiCG.d.ts.map +0 -1
- package/dist/remark-npm-BIvIEKT2.d.ts +0 -36
- package/dist/remark-npm-BIvIEKT2.d.ts.map +0 -1
- package/dist/remark-steps-CHJN-rtm.d.ts +0 -28
- package/dist/remark-steps-CHJN-rtm.d.ts.map +0 -1
- package/dist/remark-structure-RZD2gGKp.d.ts +0 -77
- package/dist/remark-structure-RZD2gGKp.d.ts.map +0 -1
- package/dist/remove-undefined-Cfs4o_mM.js.map +0 -1
- package/dist/search/algolia.js.map +0 -1
- package/dist/search/client.d.ts.map +0 -1
- package/dist/search/client.js.map +0 -1
- package/dist/search/index.d.ts.map +0 -1
- package/dist/search/orama-cloud.d.ts.map +0 -1
- package/dist/search/orama-cloud.js.map +0 -1
- package/dist/search/server.js.map +0 -1
- package/dist/search-D6ChCLhY.js +0 -44
- package/dist/search-D6ChCLhY.js.map +0 -1
- package/dist/server-CPR_fgkH.d.ts +0 -133
- package/dist/server-CPR_fgkH.d.ts.map +0 -1
- package/dist/shiki-4oMYwHED.js +0 -80
- package/dist/shiki-4oMYwHED.js.map +0 -1
- package/dist/shiki-CIBQys54.d.ts +0 -33
- package/dist/shiki-CIBQys54.d.ts.map +0 -1
- package/dist/source/client/index.d.ts.map +0 -1
- package/dist/source/client/index.js.map +0 -1
- package/dist/source/index.js.map +0 -1
- package/dist/source/plugins/lucide-icons.d.ts.map +0 -1
- package/dist/source/plugins/lucide-icons.js.map +0 -1
- package/dist/source/plugins/slugs.js.map +0 -1
- package/dist/source/schema.d.ts.map +0 -1
- package/dist/source/schema.js.map +0 -1
- package/dist/static-Dq8pA8Ay.js.map +0 -1
- package/dist/toc.d.ts.map +0 -1
- package/dist/toc.js.map +0 -1
- package/dist/util-CK2ykiif.d.ts.map +0 -1
- package/dist/util-s9piKHsk.js.map +0 -1
- package/dist/utils/use-effect-event.d.ts +0 -11
- package/dist/utils/use-effect-event.d.ts.map +0 -1
- package/dist/utils/use-effect-event.js +0 -19
- package/dist/utils/use-effect-event.js.map +0 -1
- package/dist/utils/use-media-query.d.ts.map +0 -1
- package/dist/utils/use-media-query.js.map +0 -1
- package/dist/utils/use-on-change.d.ts.map +0 -1
- package/dist/utils/use-on-change.js.map +0 -1
- package/dist/utils-DUvi2WkD.js.map +0 -1
|
@@ -1,2 +1,55 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { Transformer } from "unified";
|
|
2
|
+
import { Root } from "mdast";
|
|
3
|
+
import { MdxJsxFlowElement } from "mdast-util-mdx-jsx";
|
|
4
|
+
|
|
5
|
+
//#region src/mdx-plugins/remark-mdx-files.d.ts
|
|
6
|
+
interface FileNode {
|
|
7
|
+
depth: number;
|
|
8
|
+
type: 'file';
|
|
9
|
+
name: string;
|
|
10
|
+
}
|
|
11
|
+
interface FolderNode {
|
|
12
|
+
depth: number;
|
|
13
|
+
type: 'folder';
|
|
14
|
+
name: string;
|
|
15
|
+
children: Node[];
|
|
16
|
+
}
|
|
17
|
+
interface ToMdxOptions {
|
|
18
|
+
defaultOpenAll: boolean;
|
|
19
|
+
}
|
|
20
|
+
type Node = FileNode | FolderNode;
|
|
21
|
+
interface RemarkMdxFilesOptions {
|
|
22
|
+
/**
|
|
23
|
+
* @defaultValue files
|
|
24
|
+
*/
|
|
25
|
+
lang?: string;
|
|
26
|
+
toMdx?: (node: Node, options: ToMdxOptions) => MdxJsxFlowElement;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* **Files CodeBlock:**
|
|
31
|
+
*
|
|
32
|
+
* Convert codeblocks with `files` as lang, like:
|
|
33
|
+
*
|
|
34
|
+
* ```files
|
|
35
|
+
* project
|
|
36
|
+
* ├── src
|
|
37
|
+
* │ ├── index.js
|
|
38
|
+
* │ └── utils
|
|
39
|
+
* │ └── helper.js
|
|
40
|
+
* ├── package.json
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* into MDX `<Files />` component.
|
|
44
|
+
*
|
|
45
|
+
* **Auto Files:**
|
|
46
|
+
*
|
|
47
|
+
* Generates MDX `<Files />` component from file system.
|
|
48
|
+
*
|
|
49
|
+
* ```mdx
|
|
50
|
+
* <auto-files dir="scripts" pattern="my-dir/*" defaultOpenAll />
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
declare function remarkMdxFiles(options?: RemarkMdxFilesOptions): Transformer<Root, Root>;
|
|
54
|
+
//#endregion
|
|
55
|
+
export { FileNode, FolderNode, RemarkMdxFilesOptions, ToMdxOptions, remarkMdxFiles };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { visit } from "unist-util-visit";
|
|
2
|
+
import path from "node:path";
|
|
2
3
|
|
|
3
4
|
//#region src/mdx-plugins/remark-mdx-files.ts
|
|
4
5
|
function parseFileTree(code) {
|
|
@@ -35,12 +36,12 @@ function parseFileTree(code) {
|
|
|
35
36
|
}
|
|
36
37
|
return stack.get(0);
|
|
37
38
|
}
|
|
38
|
-
function defaultToMDX(node, depth = 0) {
|
|
39
|
+
function defaultToMDX(node, options, depth = 0) {
|
|
39
40
|
if (depth === 0) return {
|
|
40
41
|
type: "mdxJsxFlowElement",
|
|
41
42
|
name: "Files",
|
|
42
43
|
attributes: [],
|
|
43
|
-
children: [defaultToMDX(node, depth + 1)]
|
|
44
|
+
children: [defaultToMDX(node, options, depth + 1)]
|
|
44
45
|
};
|
|
45
46
|
const attributes = [{
|
|
46
47
|
type: "mdxJsxAttribute",
|
|
@@ -53,7 +54,7 @@ function defaultToMDX(node, depth = 0) {
|
|
|
53
54
|
children: [],
|
|
54
55
|
name: "File"
|
|
55
56
|
};
|
|
56
|
-
attributes.push({
|
|
57
|
+
if (options.defaultOpenAll) attributes.push({
|
|
57
58
|
type: "mdxJsxAttribute",
|
|
58
59
|
name: "defaultOpen",
|
|
59
60
|
value: null
|
|
@@ -62,10 +63,13 @@ function defaultToMDX(node, depth = 0) {
|
|
|
62
63
|
type: "mdxJsxFlowElement",
|
|
63
64
|
attributes,
|
|
64
65
|
name: "Folder",
|
|
65
|
-
children: node.children.map((item) => defaultToMDX(item, depth + 1))
|
|
66
|
+
children: node.children.map((item) => defaultToMDX(item, options, depth + 1))
|
|
66
67
|
};
|
|
67
68
|
}
|
|
68
69
|
/**
|
|
70
|
+
*
|
|
71
|
+
* **Files CodeBlock:**
|
|
72
|
+
*
|
|
69
73
|
* Convert codeblocks with `files` as lang, like:
|
|
70
74
|
*
|
|
71
75
|
* ```files
|
|
@@ -77,20 +81,106 @@ function defaultToMDX(node, depth = 0) {
|
|
|
77
81
|
* ├── package.json
|
|
78
82
|
* ```
|
|
79
83
|
*
|
|
80
|
-
* into MDX `<Files />` component
|
|
84
|
+
* into MDX `<Files />` component.
|
|
85
|
+
*
|
|
86
|
+
* **Auto Files:**
|
|
87
|
+
*
|
|
88
|
+
* Generates MDX `<Files />` component from file system.
|
|
89
|
+
*
|
|
90
|
+
* ```mdx
|
|
91
|
+
* <auto-files dir="scripts" pattern="my-dir/*" defaultOpenAll />
|
|
92
|
+
* ```
|
|
81
93
|
*/
|
|
82
94
|
function remarkMdxFiles(options = {}) {
|
|
83
95
|
const { lang = "files", toMdx = defaultToMDX } = options;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
96
|
+
async function autoFiles(file, node, { patterns, dir, defaultOpenAll = false }) {
|
|
97
|
+
const { glob } = await import("tinyglobby");
|
|
98
|
+
if (!patterns) file.fail("Missing `pattern` prop in <auto-files>", { place: node.position });
|
|
99
|
+
const baseDir = file.dirname ?? file.cwd;
|
|
100
|
+
const cwd = dir ? path.join(baseDir, dir) : baseDir;
|
|
101
|
+
const files = await glob(patterns, { cwd });
|
|
102
|
+
Object.assign(node, toMdx(buildFileTreeFromGlob(cwd, files), { defaultOpenAll }));
|
|
103
|
+
}
|
|
104
|
+
return async (tree, file) => {
|
|
105
|
+
const queue = [];
|
|
106
|
+
visit(tree, ["code", "mdxJsxFlowElement"], (node) => {
|
|
107
|
+
if (node.type === "code") {
|
|
108
|
+
if (node.lang !== lang || !node.value) return;
|
|
109
|
+
const fileTree = parseFileTree(node.value);
|
|
110
|
+
if (!fileTree) return;
|
|
111
|
+
Object.assign(node, toMdx(fileTree, { defaultOpenAll: true }));
|
|
112
|
+
return "skip";
|
|
113
|
+
}
|
|
114
|
+
if (node.type === "mdxJsxFlowElement") {
|
|
115
|
+
if (node.name !== "auto-files") return;
|
|
116
|
+
const parsed = {};
|
|
117
|
+
for (const attr of node.attributes) {
|
|
118
|
+
if (attr.type !== "mdxJsxAttribute") continue;
|
|
119
|
+
const { name, value } = attr;
|
|
120
|
+
switch (name) {
|
|
121
|
+
case "dir":
|
|
122
|
+
if (typeof value === "string") parsed.dir = value;
|
|
123
|
+
break;
|
|
124
|
+
case "pattern":
|
|
125
|
+
if (typeof value === "string") {
|
|
126
|
+
parsed.patterns ??= [];
|
|
127
|
+
parsed.patterns.push(value);
|
|
128
|
+
}
|
|
129
|
+
break;
|
|
130
|
+
case "defaultOpenAll":
|
|
131
|
+
parsed.defaultOpenAll = true;
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
queue.push(autoFiles(file, node, parsed));
|
|
136
|
+
return "skip";
|
|
137
|
+
}
|
|
90
138
|
});
|
|
139
|
+
await Promise.all(queue);
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
function buildFileTreeFromGlob(dir, files) {
|
|
143
|
+
const nodeMap = /* @__PURE__ */ new Map();
|
|
144
|
+
const root = {
|
|
145
|
+
depth: 0,
|
|
146
|
+
type: "folder",
|
|
147
|
+
name: path.basename(dir),
|
|
148
|
+
children: []
|
|
91
149
|
};
|
|
150
|
+
nodeMap.set("", root);
|
|
151
|
+
for (const file of files) {
|
|
152
|
+
const parts = path.normalize(file).split(path.sep).filter((part) => part.length > 0);
|
|
153
|
+
let currentPath = "";
|
|
154
|
+
let current = root;
|
|
155
|
+
for (let i = 0; i < parts.length; i++) {
|
|
156
|
+
const name = parts[i];
|
|
157
|
+
const nextPath = path.join(currentPath, name);
|
|
158
|
+
if (i === parts.length - 1) {
|
|
159
|
+
const fileNode = {
|
|
160
|
+
depth: i + 1,
|
|
161
|
+
type: "file",
|
|
162
|
+
name
|
|
163
|
+
};
|
|
164
|
+
current.children.push(fileNode);
|
|
165
|
+
} else {
|
|
166
|
+
let folder = nodeMap.get(nextPath);
|
|
167
|
+
if (!folder) {
|
|
168
|
+
folder = {
|
|
169
|
+
depth: i + 1,
|
|
170
|
+
type: "folder",
|
|
171
|
+
name,
|
|
172
|
+
children: []
|
|
173
|
+
};
|
|
174
|
+
nodeMap.set(nextPath, folder);
|
|
175
|
+
current.children.push(folder);
|
|
176
|
+
}
|
|
177
|
+
current = folder;
|
|
178
|
+
currentPath = nextPath;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return root;
|
|
92
183
|
}
|
|
93
184
|
|
|
94
185
|
//#endregion
|
|
95
|
-
export { remarkMdxFiles };
|
|
96
|
-
//# sourceMappingURL=remark-mdx-files.js.map
|
|
186
|
+
export { remarkMdxFiles };
|
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Transformer } from "unified";
|
|
2
|
+
import { Root } from "mdast";
|
|
3
|
+
|
|
4
|
+
//#region src/mdx-plugins/remark-mdx-mermaid.d.ts
|
|
5
|
+
interface RemarkMdxMermaidOptions {
|
|
6
|
+
/**
|
|
7
|
+
* @defaultValue mermaid
|
|
8
|
+
*/
|
|
9
|
+
lang?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Convert `mermaid` codeblocks into `<Mermaid />` MDX component
|
|
13
|
+
*/
|
|
14
|
+
declare function remarkMdxMermaid(options?: RemarkMdxMermaidOptions): Transformer<Root, Root>;
|
|
15
|
+
//#endregion
|
|
2
16
|
export { RemarkMdxMermaidOptions, remarkMdxMermaid };
|
|
@@ -1,2 +1,35 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Transformer } from "unified";
|
|
2
|
+
import { Root } from "mdast";
|
|
3
|
+
|
|
4
|
+
//#region src/mdx-plugins/remark-npm.d.ts
|
|
5
|
+
interface PackageManager {
|
|
6
|
+
name: string;
|
|
7
|
+
/**
|
|
8
|
+
* Default to `name`
|
|
9
|
+
*/
|
|
10
|
+
value?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Convert from npm to another package manager
|
|
13
|
+
*/
|
|
14
|
+
command: (command: string) => string | undefined;
|
|
15
|
+
}
|
|
16
|
+
interface RemarkNpmOptions {
|
|
17
|
+
/**
|
|
18
|
+
* Persist Tab value (Hanzo Docs UI only)
|
|
19
|
+
*
|
|
20
|
+
* @defaultValue false
|
|
21
|
+
*/
|
|
22
|
+
persist?: {
|
|
23
|
+
id: string;
|
|
24
|
+
} | false;
|
|
25
|
+
packageManagers?: PackageManager[];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* It generates multiple tabs of codeblocks for different package managers from a npm command codeblock.
|
|
29
|
+
*/
|
|
30
|
+
declare function remarkNpm({
|
|
31
|
+
persist,
|
|
32
|
+
packageManagers
|
|
33
|
+
}?: RemarkNpmOptions): Transformer<Root, Root>;
|
|
34
|
+
//#endregion
|
|
2
35
|
export { RemarkNpmOptions, remarkNpm };
|
|
@@ -1,2 +1,27 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Transformer } from "unified";
|
|
2
|
+
import { Root } from "mdast";
|
|
3
|
+
|
|
4
|
+
//#region src/mdx-plugins/remark-steps.d.ts
|
|
5
|
+
interface RemarkStepsOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Class name for steps container
|
|
8
|
+
*
|
|
9
|
+
* @defaultValue fd-steps
|
|
10
|
+
*/
|
|
11
|
+
steps?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Class name for step container
|
|
14
|
+
*
|
|
15
|
+
* @defaultValue fd-step
|
|
16
|
+
*/
|
|
17
|
+
step?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Convert headings in the format of `1. Hello World` into steps.
|
|
21
|
+
*/
|
|
22
|
+
declare function remarkSteps({
|
|
23
|
+
steps,
|
|
24
|
+
step
|
|
25
|
+
}?: RemarkStepsOptions): Transformer<Root, Root>;
|
|
26
|
+
//#endregion
|
|
2
27
|
export { RemarkStepsOptions, remarkSteps };
|
|
@@ -1,2 +1,76 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PluggableList, Transformer } from "unified";
|
|
2
|
+
import { Nodes, Root } from "mdast";
|
|
3
|
+
import { MdxJsxAttribute, MdxJsxExpressionAttribute, MdxJsxFlowElement } from "mdast-util-mdx-jsx";
|
|
4
|
+
|
|
5
|
+
//#region src/mdx-plugins/remark-structure.d.ts
|
|
6
|
+
interface Heading$1 {
|
|
7
|
+
id: string;
|
|
8
|
+
content: string;
|
|
9
|
+
}
|
|
10
|
+
interface Content {
|
|
11
|
+
heading: string | undefined;
|
|
12
|
+
content: string;
|
|
13
|
+
}
|
|
14
|
+
interface StructuredData {
|
|
15
|
+
headings: Heading$1[];
|
|
16
|
+
/**
|
|
17
|
+
* Refer to paragraphs, a heading may contain multiple contents as well
|
|
18
|
+
*/
|
|
19
|
+
contents: Content[];
|
|
20
|
+
}
|
|
21
|
+
interface StructureOptions {
|
|
22
|
+
/**
|
|
23
|
+
* Types to be scanned as content.
|
|
24
|
+
*
|
|
25
|
+
* @defaultValue ['heading', 'paragraph', 'blockquote', 'tableCell', 'mdxJsxFlowElement']
|
|
26
|
+
*/
|
|
27
|
+
types?: string[] | ((node: Nodes) => boolean);
|
|
28
|
+
/**
|
|
29
|
+
* A list of indexable MDX attributes, either:
|
|
30
|
+
*
|
|
31
|
+
* - an array of attribute names.
|
|
32
|
+
* - a function that determines if attribute should be indexed.
|
|
33
|
+
*/
|
|
34
|
+
allowedMdxAttributes?: string[] | ((node: MdxJsxFlowElement, attribute: MdxJsxAttribute | MdxJsxExpressionAttribute) => boolean);
|
|
35
|
+
/**
|
|
36
|
+
* export as `structuredData` or specified variable name.
|
|
37
|
+
*/
|
|
38
|
+
exportAs?: string | boolean;
|
|
39
|
+
}
|
|
40
|
+
declare module 'mdast' {
|
|
41
|
+
interface Data {
|
|
42
|
+
/**
|
|
43
|
+
* [Hanzo Docs] Get content of unserializable element, `remarkStructure` uses it to generate search index.
|
|
44
|
+
*/
|
|
45
|
+
_string?: string[];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
declare module 'vfile' {
|
|
49
|
+
interface DataMap {
|
|
50
|
+
/**
|
|
51
|
+
* [Hanzo Docs] injected by `remarkStructure`
|
|
52
|
+
*/
|
|
53
|
+
structuredData: StructuredData;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
declare const remarkStructureDefaultOptions: {
|
|
57
|
+
types: string[];
|
|
58
|
+
allowedMdxAttributes: (node: MdxJsxFlowElement) => boolean;
|
|
59
|
+
exportAs: false;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Extract content into structured data.
|
|
63
|
+
*
|
|
64
|
+
* By default, the output is stored into VFile (`vfile.data.structuredData`), you can specify `exportAs` to export it.
|
|
65
|
+
*/
|
|
66
|
+
declare function remarkStructure({
|
|
67
|
+
types,
|
|
68
|
+
allowedMdxAttributes,
|
|
69
|
+
exportAs
|
|
70
|
+
}?: StructureOptions): Transformer<Root, Root>;
|
|
71
|
+
/**
|
|
72
|
+
* Extract data from markdown/mdx content
|
|
73
|
+
*/
|
|
74
|
+
declare function structure(content: string, remarkPlugins?: PluggableList, options?: StructureOptions): StructuredData;
|
|
75
|
+
//#endregion
|
|
2
76
|
export { StructureOptions, StructuredData, remarkStructure, remarkStructureDefaultOptions, structure };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as toMdxExport, t as flattenNode } from "../mdast-utils-
|
|
1
|
+
import { n as toMdxExport, t as flattenNode } from "../mdast-utils-gJMY143g.js";
|
|
2
2
|
import { remark } from "remark";
|
|
3
3
|
import remarkGfm from "remark-gfm";
|
|
4
4
|
import Slugger from "github-slugger";
|
|
@@ -54,19 +54,19 @@ function remarkStructure({ types = remarkStructureDefaultOptions.types, allowedM
|
|
|
54
54
|
element.data ||= {};
|
|
55
55
|
element.data.hProperties ||= {};
|
|
56
56
|
const properties = element.data.hProperties;
|
|
57
|
-
const content
|
|
58
|
-
const id = properties.id ?? slugger.slug(content
|
|
57
|
+
const content = flattenNode(element).trim();
|
|
58
|
+
const id = properties.id ?? slugger.slug(content);
|
|
59
59
|
data.headings.push({
|
|
60
60
|
id,
|
|
61
|
-
content
|
|
61
|
+
content
|
|
62
62
|
});
|
|
63
63
|
lastHeading = id;
|
|
64
64
|
return "skip";
|
|
65
65
|
}
|
|
66
66
|
if (element.data?._string) {
|
|
67
|
-
for (const content
|
|
67
|
+
for (const content of element.data._string) data.contents.push({
|
|
68
68
|
heading: lastHeading,
|
|
69
|
-
content
|
|
69
|
+
content
|
|
70
70
|
});
|
|
71
71
|
return "skip";
|
|
72
72
|
}
|
|
@@ -102,5 +102,4 @@ function structure(content, remarkPlugins = [], options = {}) {
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
//#endregion
|
|
105
|
-
export { remarkStructure, remarkStructureDefaultOptions, structure };
|
|
106
|
-
//# sourceMappingURL=remark-structure.js.map
|
|
105
|
+
export { remarkStructure, remarkStructureDefaultOptions, structure };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { r as __toESM, t as __commonJSMin } from "./chunk-
|
|
1
|
+
import { r as __toESM, t as __commonJSMin } from "./chunk-CaR5F9JI.js";
|
|
2
2
|
import Slugger from "github-slugger";
|
|
3
3
|
|
|
4
|
-
//#region ../../node_modules/.pnpm/remove-markdown@0.6.
|
|
4
|
+
//#region ../../node_modules/.pnpm/remove-markdown@0.6.3/node_modules/remove-markdown/index.js
|
|
5
5
|
var require_remove_markdown = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
6
6
|
module.exports = function(md, options) {
|
|
7
7
|
options = options || {};
|
|
@@ -11,6 +11,7 @@ var require_remove_markdown = /* @__PURE__ */ __commonJSMin(((exports, module) =
|
|
|
11
11
|
options.useImgAltText = options.hasOwnProperty("useImgAltText") ? options.useImgAltText : true;
|
|
12
12
|
options.abbr = options.hasOwnProperty("abbr") ? options.abbr : false;
|
|
13
13
|
options.replaceLinksWithURL = options.hasOwnProperty("replaceLinksWithURL") ? options.replaceLinksWithURL : false;
|
|
14
|
+
options.separateLinksAndTexts = options.hasOwnProperty("separateLinksAndTexts") ? options.separateLinksAndTexts : null;
|
|
14
15
|
options.htmlTagsToSkip = options.hasOwnProperty("htmlTagsToSkip") ? options.htmlTagsToSkip : [];
|
|
15
16
|
options.throwError = options.hasOwnProperty("throwError") ? options.throwError : false;
|
|
16
17
|
var output = md || "";
|
|
@@ -25,6 +26,7 @@ var require_remove_markdown = /* @__PURE__ */ __commonJSMin(((exports, module) =
|
|
|
25
26
|
const joinedHtmlTagsToSkip = options.htmlTagsToSkip.join("|");
|
|
26
27
|
htmlReplaceRegex = new RegExp(`<(?!\/?(${joinedHtmlTagsToSkip})(?=>|\s[^>]*>))[^>]*>`, "g");
|
|
27
28
|
}
|
|
29
|
+
if (options.separateLinksAndTexts) output = output.replace(/\[([^\]]+)\]\(([^)]+)\)/g, "$1" + options.separateLinksAndTexts + "$2");
|
|
28
30
|
output = output.replace(htmlReplaceRegex, "").replace(/^[=\-]{2,}\s*$/g, "").replace(/\[\^.+?\](\: .*?$)?/g, "").replace(/\s{0,2}\[.*?\]: .*?$/g, "").replace(/\!\[(.*?)\][\[\(].*?[\]\)]/g, options.useImgAltText ? "$1" : "").replace(/\[([\s\S]*?)\]\s*[\(\[].*?[\)\]]/g, options.replaceLinksWithURL ? "$2" : "$1").replace(/^(\n)?\s{0,3}>\s?/gm, "$1").replace(/^\s{1,2}\[(.*?)\]: (\S+)( ".*?")?\s*$/g, "").replace(/^(\n)?\s{0,}#{1,6}\s*( (.+))? +#+$|^(\n)?\s{0,}#{1,6}\s*( (.+))?$/gm, "$1$3$4$6").replace(/([\*]+)(\S)(.*?\S)??\1/g, "$2$3").replace(/(^|\W)([_]+)(\S)(.*?\S)??\2($|\W)/g, "$1$3$4$5").replace(/(`{3,})(.*?)\1/gm, "$2").replace(/`(.+?)`/g, "$1").replace(/~(.*?)~/g, "$1");
|
|
29
31
|
} catch (e) {
|
|
30
32
|
if (options.throwError) throw e;
|
|
@@ -37,7 +39,7 @@ var require_remove_markdown = /* @__PURE__ */ __commonJSMin(((exports, module) =
|
|
|
37
39
|
|
|
38
40
|
//#endregion
|
|
39
41
|
//#region src/search/client/mixedbread.ts
|
|
40
|
-
var import_remove_markdown = /* @__PURE__ */ __toESM(require_remove_markdown());
|
|
42
|
+
var import_remove_markdown = /* @__PURE__ */ __toESM(require_remove_markdown(), 1);
|
|
41
43
|
const slugger = new Slugger();
|
|
42
44
|
function extractHeadingTitle(text) {
|
|
43
45
|
const trimmedText = text.trim();
|
|
@@ -84,5 +86,4 @@ async function search(query, options) {
|
|
|
84
86
|
}
|
|
85
87
|
|
|
86
88
|
//#endregion
|
|
87
|
-
export { search };
|
|
88
|
-
//# sourceMappingURL=mixedbread-DlByNYSd.js.map
|
|
89
|
+
export { search };
|
|
@@ -17,5 +17,4 @@ declare function isMarkdownPreferred(request: Request, options?: {
|
|
|
17
17
|
markdownMediaTypes?: string[];
|
|
18
18
|
}): boolean;
|
|
19
19
|
//#endregion
|
|
20
|
-
export { getNegotiator, isMarkdownPreferred, rewritePath };
|
|
21
|
-
//# sourceMappingURL=index.d.ts.map
|
|
20
|
+
export { getNegotiator, isMarkdownPreferred, rewritePath };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/utils/normalize-url.tsx
|
|
2
2
|
/**
|
|
3
|
-
* normalize URL into the
|
|
3
|
+
* normalize URL into the Hanzo Docs standard form (`/slug-1/slug-2`).
|
|
4
4
|
*
|
|
5
5
|
* This includes URLs with trailing slashes.
|
|
6
6
|
*/
|
|
@@ -12,5 +12,4 @@ function normalizeUrl(url) {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
//#endregion
|
|
15
|
-
export { normalizeUrl as t };
|
|
16
|
-
//# sourceMappingURL=normalize-url-DP9-1I-S.js.map
|
|
15
|
+
export { normalizeUrl as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as removeUndefined } from "./remove-undefined-
|
|
1
|
+
import { createContentHighlighter } from "./search/index.js";
|
|
2
|
+
import { t as removeUndefined } from "./remove-undefined-CJm9cyrC.js";
|
|
3
3
|
|
|
4
4
|
//#region src/search/client/orama-cloud.ts
|
|
5
5
|
async function searchDocs(query, options) {
|
|
@@ -7,7 +7,7 @@ async function searchDocs(query, options) {
|
|
|
7
7
|
const list = [];
|
|
8
8
|
const { index = "default", client, params: extraParams, tag } = options;
|
|
9
9
|
if (index === "crawler") {
|
|
10
|
-
const result
|
|
10
|
+
const result = await client.search({
|
|
11
11
|
datasources: [],
|
|
12
12
|
...extraParams,
|
|
13
13
|
term: query,
|
|
@@ -17,8 +17,8 @@ async function searchDocs(query, options) {
|
|
|
17
17
|
},
|
|
18
18
|
limit: 10
|
|
19
19
|
});
|
|
20
|
-
if (!result
|
|
21
|
-
for (const hit of result
|
|
20
|
+
if (!result) return list;
|
|
21
|
+
for (const hit of result.hits) {
|
|
22
22
|
const doc = hit.document;
|
|
23
23
|
list.push({
|
|
24
24
|
id: hit.id,
|
|
@@ -80,5 +80,4 @@ async function searchDocs(query, options) {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
//#endregion
|
|
83
|
-
export { searchDocs };
|
|
84
|
-
//# sourceMappingURL=orama-cloud-DH3g37zc.js.map
|
|
83
|
+
export { searchDocs };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { createContentHighlighter } from "./search/index.js";
|
|
2
|
+
import { t as removeUndefined } from "./remove-undefined-CJm9cyrC.js";
|
|
3
|
+
|
|
4
|
+
//#region src/search/client/orama-cloud-legacy.ts
|
|
5
|
+
async function searchDocs(query, options) {
|
|
6
|
+
const highlighter = createContentHighlighter(query);
|
|
7
|
+
const list = [];
|
|
8
|
+
const { index = "default", client, params: extraParams = {}, tag } = options;
|
|
9
|
+
if (index === "crawler") {
|
|
10
|
+
const result = await client.search({
|
|
11
|
+
...extraParams,
|
|
12
|
+
term: query,
|
|
13
|
+
where: {
|
|
14
|
+
category: tag ? { eq: tag.slice(0, 1).toUpperCase() + tag.slice(1) } : void 0,
|
|
15
|
+
...extraParams.where
|
|
16
|
+
},
|
|
17
|
+
limit: 10
|
|
18
|
+
});
|
|
19
|
+
if (!result) return list;
|
|
20
|
+
for (const hit of result.hits) {
|
|
21
|
+
const doc = hit.document;
|
|
22
|
+
list.push({
|
|
23
|
+
id: hit.id,
|
|
24
|
+
type: "page",
|
|
25
|
+
content: doc.title,
|
|
26
|
+
contentWithHighlights: highlighter.highlight(doc.title),
|
|
27
|
+
url: doc.path
|
|
28
|
+
}, {
|
|
29
|
+
id: "page" + hit.id,
|
|
30
|
+
type: "text",
|
|
31
|
+
content: doc.content,
|
|
32
|
+
contentWithHighlights: highlighter.highlight(doc.content),
|
|
33
|
+
url: doc.path
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return list;
|
|
37
|
+
}
|
|
38
|
+
const params = {
|
|
39
|
+
...extraParams,
|
|
40
|
+
term: query,
|
|
41
|
+
where: removeUndefined({
|
|
42
|
+
tag,
|
|
43
|
+
...extraParams.where
|
|
44
|
+
}),
|
|
45
|
+
groupBy: {
|
|
46
|
+
properties: ["page_id"],
|
|
47
|
+
maxResult: 7,
|
|
48
|
+
...extraParams.groupBy
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
const result = await client.search(params);
|
|
52
|
+
if (!result || !result.groups) return list;
|
|
53
|
+
for (const item of result.groups) {
|
|
54
|
+
let addedHead = false;
|
|
55
|
+
for (const hit of item.result) {
|
|
56
|
+
const doc = hit.document;
|
|
57
|
+
if (!addedHead) {
|
|
58
|
+
list.push({
|
|
59
|
+
id: doc.page_id,
|
|
60
|
+
type: "page",
|
|
61
|
+
content: doc.title,
|
|
62
|
+
breadcrumbs: doc.breadcrumbs,
|
|
63
|
+
contentWithHighlights: highlighter.highlight(doc.title),
|
|
64
|
+
url: doc.url
|
|
65
|
+
});
|
|
66
|
+
addedHead = true;
|
|
67
|
+
}
|
|
68
|
+
list.push({
|
|
69
|
+
id: doc.id,
|
|
70
|
+
content: doc.content,
|
|
71
|
+
contentWithHighlights: highlighter.highlight(doc.content),
|
|
72
|
+
type: doc.content === doc.section ? "heading" : "text",
|
|
73
|
+
url: doc.section_id ? `${doc.url}#${doc.section_id}` : doc.url
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return list;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
//#endregion
|
|
81
|
+
export { searchDocs };
|
|
@@ -1,45 +1,3 @@
|
|
|
1
|
-
import { a as Separator, i as Root, n as Item, r as Node, t as Folder } from "../definitions-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Flatten tree to an array of page nodes
|
|
7
|
-
*/
|
|
8
|
-
declare function flattenTree(nodes: Node[]): Item[];
|
|
9
|
-
/**
|
|
10
|
-
* Get neighbours of a page, useful for implementing "previous & next" buttons
|
|
11
|
-
*/
|
|
12
|
-
declare function findNeighbour(tree: Root, url: string, options?: {
|
|
13
|
-
separateRoot?: boolean;
|
|
14
|
-
}): {
|
|
15
|
-
previous?: Item;
|
|
16
|
-
next?: Item;
|
|
17
|
-
};
|
|
18
|
-
declare function getPageTreeRoots(pageTree: Root | Folder): (Root | Folder)[];
|
|
19
|
-
/**
|
|
20
|
-
* Get other item nodes that lives under the same parent.
|
|
21
|
-
*/
|
|
22
|
-
declare function getPageTreePeers(treeOrTrees: Root | Record<string, Root>, url: string): Item[];
|
|
23
|
-
/**
|
|
24
|
-
* Get other tree nodes that lives under the same parent.
|
|
25
|
-
*/
|
|
26
|
-
declare function findSiblings(treeOrTrees: Root | Record<string, Root>, url: string): Node[];
|
|
27
|
-
declare function findParent(from: Root | Folder, url: string): Root | Folder | undefined;
|
|
28
|
-
/**
|
|
29
|
-
* Search the path of a node in the tree matched by the matcher.
|
|
30
|
-
*
|
|
31
|
-
* @returns The path to the target node (from starting root), or null if the page doesn't exist
|
|
32
|
-
*/
|
|
33
|
-
declare function findPath(nodes: Node[], matcher: (node: Node) => boolean, options?: {
|
|
34
|
-
includeSeparator?: boolean;
|
|
35
|
-
}): Node[] | null;
|
|
36
|
-
/**
|
|
37
|
-
* Perform a depth-first search on page tree visiting every node.
|
|
38
|
-
*
|
|
39
|
-
* @param root - the root of page tree to visit.
|
|
40
|
-
* @param visitor - function to receive nodes, return `skip` to skip the children of current node, `break` to stop the search entirely.
|
|
41
|
-
*/
|
|
42
|
-
declare function visit<Root$1 extends Node | Root>(root: Root$1, visitor: <T extends Node | Root>(node: T, parent?: Root | Folder) => 'skip' | 'break' | T | void): Root$1;
|
|
43
|
-
//#endregion
|
|
44
|
-
export { Folder, Item, Node, Root, Separator, findNeighbour, findParent, findPath, findSiblings, flattenTree, getPageTreePeers, getPageTreeRoots, visit };
|
|
45
|
-
//# sourceMappingURL=index.d.ts.map
|
|
1
|
+
import { a as Separator, i as Root, n as Item, r as Node, t as Folder } from "../definitions-DSNTbAwC.js";
|
|
2
|
+
import { a as flattenTree, c as visit, i as findSiblings, n as findParent, o as getPageTreePeers, r as findPath, s as getPageTreeRoots, t as findNeighbour } from "../utils-IgHyYnrz.js";
|
|
3
|
+
export { Folder, Item, Node, Root, Separator, findNeighbour, findParent, findPath, findSiblings, flattenTree, getPageTreePeers, getPageTreeRoots, visit };
|