@hanzo/docs-core 16.4.2 → 16.5.0
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 +1 -1
- package/dist/{advanced-CEwMef7q.js → advanced-BRT5Ij43.js} +3 -3
- package/dist/{advanced-CEwMef7q.js.map → advanced-BRT5Ij43.js.map} +1 -1
- package/dist/{algolia-BrWPzYE_.js → algolia-CQPXCnjV.js} +2 -2
- package/dist/{algolia-BrWPzYE_.js.map → algolia-CQPXCnjV.js.map} +1 -1
- package/dist/{algolia-CBBN8R6-.d.ts → algolia-Cc1y6qWl.d.ts} +2 -2
- package/dist/{algolia-CBBN8R6-.d.ts.map → algolia-Cc1y6qWl.d.ts.map} +1 -1
- package/dist/breadcrumb.js +1 -1
- package/dist/{codeblock-utils-lld8UiQo.d.ts → codeblock-utils-DDnYb8gi.d.ts} +2 -2
- package/dist/{codeblock-utils-lld8UiQo.d.ts.map → codeblock-utils-DDnYb8gi.d.ts.map} +1 -1
- package/dist/content/github.d.ts +1 -1
- package/dist/content/github.js.map +1 -1
- package/dist/content/index.d.ts +2 -2
- package/dist/content/mdx/preset-bundler.d.ts +2 -2
- package/dist/content/mdx/preset-runtime.d.ts +2 -2
- package/dist/dynamic-link.d.ts +2 -2
- package/dist/framework/index.d.ts +4 -4
- package/dist/framework/react-router.d.ts +2 -2
- package/dist/framework/tanstack.d.ts +3 -3
- package/dist/framework/tanstack.js +1 -1
- package/dist/framework/tanstack.js.map +1 -1
- package/dist/framework/waku.d.ts +2 -2
- package/dist/highlight/client.d.ts +1 -1
- package/dist/highlight/client.js +1 -1
- package/dist/highlight/index.d.ts +1 -1
- package/dist/highlight/index.js +1 -1
- package/dist/{icon-Ds1OCIhh.js → icon-BWwSDabM.js} +2 -2
- package/dist/{icon-Ds1OCIhh.js.map → icon-BWwSDabM.js.map} +1 -1
- package/dist/link.d.ts +2 -2
- package/dist/mdx-plugins/codeblock-utils.d.ts +1 -1
- package/dist/mdx-plugins/codeblock-utils.js +1 -1
- package/dist/mdx-plugins/codeblock-utils.js.map +1 -1
- package/dist/mdx-plugins/index.d.ts +3 -3
- package/dist/mdx-plugins/index.js +3 -3
- package/dist/mdx-plugins/rehype-code.js +2 -2
- package/dist/mdx-plugins/rehype-toc.js +1 -1
- package/dist/mdx-plugins/remark-npm.d.ts +1 -1
- package/dist/mdx-plugins/remark-npm.js.map +1 -1
- package/dist/mdx-plugins/remark-structure.d.ts +1 -1
- package/dist/mdx-plugins/remark-structure.js.map +1 -1
- package/dist/{normalize-url-DP9-1I-S.js → normalize-url-ChLsV26G.js} +2 -2
- package/dist/normalize-url-ChLsV26G.js.map +1 -0
- package/dist/{orama-cloud-MyA-JBt1.js → orama-cloud-DH3g37zc.js} +3 -3
- package/dist/orama-cloud-DH3g37zc.js.map +1 -0
- package/dist/{path-DPJpqaLb.js → path-DHIjrDBP.js} +1 -1
- package/dist/{path-DPJpqaLb.js.map → path-DHIjrDBP.js.map} +1 -1
- package/dist/{rehype-code-CQDbiG8_.js → rehype-code-sM9Tq-r7.js} +3 -3
- package/dist/{rehype-code-CQDbiG8_.js.map → rehype-code-sM9Tq-r7.js.map} +1 -1
- package/dist/{rehype-toc-D-eLj90w.js → rehype-toc-DVwJcwvA.js} +1 -1
- package/dist/{rehype-toc-D-eLj90w.js.map → rehype-toc-DVwJcwvA.js.map} +1 -1
- package/dist/{remark-npm-BIvIEKT2.d.ts → remark-npm-Bo08HqcQ.d.ts} +2 -2
- package/dist/{remark-npm-BIvIEKT2.d.ts.map → remark-npm-Bo08HqcQ.d.ts.map} +1 -1
- package/dist/{remark-structure-RZD2gGKp.d.ts → remark-structure-DGuWR82i.d.ts} +3 -3
- package/dist/{remark-structure-RZD2gGKp.d.ts.map → remark-structure-DGuWR82i.d.ts.map} +1 -1
- package/dist/{remove-undefined-DgDIJk1A.js → remove-undefined-Cfs4o_mM.js} +1 -1
- package/dist/{remove-undefined-DgDIJk1A.js.map → remove-undefined-Cfs4o_mM.js.map} +1 -1
- package/dist/search/algolia.d.ts +2 -2
- package/dist/search/client.d.ts +4 -4
- package/dist/search/client.js +3 -3
- package/dist/search/index.js +1 -1
- package/dist/search/orama-cloud.d.ts +1 -1
- package/dist/search/server.d.ts +2 -2
- package/dist/search/server.js +3 -3
- package/dist/{search-GCBSTRxD.js → search-D6ChCLhY.js} +1 -1
- package/dist/{search-GCBSTRxD.js.map → search-D6ChCLhY.js.map} +1 -1
- package/dist/{server-CPR_fgkH.d.ts → server-DmY4lGBs.d.ts} +2 -2
- package/dist/{server-CPR_fgkH.d.ts.map → server-DmY4lGBs.d.ts.map} +1 -1
- package/dist/{shiki-4oMYwHED.js → shiki-B5wNmyIZ.js} +2 -2
- package/dist/shiki-B5wNmyIZ.js.map +1 -0
- package/dist/{shiki-CIBQys54.d.ts → shiki-Dq3XIYAT.d.ts} +2 -2
- package/dist/{shiki-CIBQys54.d.ts.map → shiki-Dq3XIYAT.d.ts.map} +1 -1
- package/dist/source/client/index.d.ts +2 -2
- package/dist/source/client/index.d.ts.map +1 -1
- package/dist/source/client/index.js +2 -2
- package/dist/source/client/index.js.map +1 -1
- package/dist/source/index.js +3 -3
- package/dist/source/plugins/lucide-icons.js +1 -1
- package/dist/source/plugins/slugs.js +2 -2
- package/dist/source/plugins/slugs.js.map +1 -1
- package/dist/source/schema.js.map +1 -1
- package/dist/{static-vTmR4-T2.js → static-Dq8pA8Ay.js} +2 -2
- package/dist/{static-vTmR4-T2.js.map → static-Dq8pA8Ay.js.map} +1 -1
- package/dist/toc.d.ts +4 -4
- package/package.json +15 -15
- package/LICENSE +0 -21
- package/dist/normalize-url-DP9-1I-S.js.map +0 -1
- package/dist/orama-cloud-MyA-JBt1.js.map +0 -1
- package/dist/shiki-4oMYwHED.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as createContentHighlighter } from "./search-
|
|
2
|
-
import { t as removeUndefined } from "./remove-undefined-
|
|
1
|
+
import { t as createContentHighlighter } from "./search-D6ChCLhY.js";
|
|
2
|
+
import { t as removeUndefined } from "./remove-undefined-Cfs4o_mM.js";
|
|
3
3
|
import { getByID, search } from "@orama/orama";
|
|
4
4
|
|
|
5
5
|
//#region src/search/orama/search/simple.ts
|
|
@@ -77,4 +77,4 @@ async function searchAdvanced(db, query, tag = [], { mode = "fulltext", ...overr
|
|
|
77
77
|
|
|
78
78
|
//#endregion
|
|
79
79
|
export { searchSimple as n, searchAdvanced as t };
|
|
80
|
-
//# sourceMappingURL=advanced-
|
|
80
|
+
//# sourceMappingURL=advanced-BRT5Ij43.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"advanced-
|
|
1
|
+
{"version":3,"file":"advanced-BRT5Ij43.js","names":["list: SortedResult[]"],"sources":["../src/search/orama/search/simple.ts","../src/search/orama/search/advanced.ts"],"sourcesContent":["import { type Orama, search, type SearchParams } from '@orama/orama';\nimport { type SimpleDocument, type simpleSchema } from '@/search/orama/create-db';\nimport { createContentHighlighter, type SortedResult } from '@/search';\n\nexport async function searchSimple(\n db: Orama<typeof simpleSchema>,\n query: string,\n params: Partial<SearchParams<Orama<typeof simpleSchema>, SimpleDocument>> = {},\n): Promise<SortedResult[]> {\n const highlighter = createContentHighlighter(query);\n const result = await search(db, {\n term: query,\n tolerance: 1,\n ...params,\n boost: {\n title: 2,\n ...('boost' in params ? params.boost : undefined),\n },\n });\n\n return result.hits.map<SortedResult>((hit) => ({\n type: 'page',\n content: hit.document.title,\n breadcrumbs: hit.document.breadcrumbs,\n contentWithHighlights: highlighter.highlight(hit.document.title),\n id: hit.document.url,\n url: hit.document.url,\n }));\n}\n","import { getByID, type Orama, search, type SearchParams } from '@orama/orama';\nimport { type AdvancedDocument, type advancedSchema } from '@/search/orama/create-db';\nimport { removeUndefined } from '@/utils/remove-undefined';\nimport { createContentHighlighter, type SortedResult } from '@/search';\n\nexport async function searchAdvanced(\n db: Orama<typeof advancedSchema>,\n query: string,\n tag: string | string[] = [],\n {\n mode = 'fulltext',\n ...override\n }: Partial<SearchParams<Orama<typeof advancedSchema>, AdvancedDocument>> = {},\n): Promise<SortedResult[]> {\n if (typeof tag === 'string') tag = [tag];\n\n let params = {\n ...override,\n mode,\n where: removeUndefined({\n tags:\n tag.length > 0\n ? {\n containsAll: tag,\n }\n : undefined,\n ...override.where,\n }),\n groupBy: {\n properties: ['page_id'],\n maxResult: 8,\n ...override.groupBy,\n },\n } as SearchParams<typeof db, AdvancedDocument>;\n\n if (query.length > 0) {\n params = {\n ...params,\n term: query,\n properties: mode === 'fulltext' ? ['content'] : ['content', 'embeddings'],\n } as SearchParams<typeof db, AdvancedDocument>;\n }\n\n const highlighter = createContentHighlighter(query);\n const result = await search(db, params);\n const list: SortedResult[] = [];\n for (const item of result.groups ?? []) {\n const pageId = item.values[0] as string;\n\n const page = getByID(db, pageId);\n if (!page) continue;\n\n list.push({\n id: pageId,\n type: 'page',\n content: page.content,\n breadcrumbs: page.breadcrumbs,\n contentWithHighlights: highlighter.highlight(page.content),\n url: page.url,\n });\n\n for (const hit of item.result) {\n if (hit.document.type === 'page') continue;\n\n list.push({\n id: hit.document.id.toString(),\n content: hit.document.content,\n breadcrumbs: hit.document.breadcrumbs,\n contentWithHighlights: highlighter.highlight(hit.document.content),\n type: hit.document.type as SortedResult['type'],\n url: hit.document.url,\n });\n }\n }\n return list;\n}\n"],"mappings":";;;;;AAIA,eAAsB,aACpB,IACA,OACA,SAA4E,EAAE,EACrD;CACzB,MAAM,cAAc,yBAAyB,MAAM;AAWnD,SAVe,MAAM,OAAO,IAAI;EAC9B,MAAM;EACN,WAAW;EACX,GAAG;EACH,OAAO;GACL,OAAO;GACP,GAAI,WAAW,SAAS,OAAO,QAAQ;GACxC;EACF,CAAC,EAEY,KAAK,KAAmB,SAAS;EAC7C,MAAM;EACN,SAAS,IAAI,SAAS;EACtB,aAAa,IAAI,SAAS;EAC1B,uBAAuB,YAAY,UAAU,IAAI,SAAS,MAAM;EAChE,IAAI,IAAI,SAAS;EACjB,KAAK,IAAI,SAAS;EACnB,EAAE;;;;;ACtBL,eAAsB,eACpB,IACA,OACA,MAAyB,EAAE,EAC3B,EACE,OAAO,YACP,GAAG,aACsE,EAAE,EACpD;AACzB,KAAI,OAAO,QAAQ,SAAU,OAAM,CAAC,IAAI;CAExC,IAAI,SAAS;EACX,GAAG;EACH;EACA,OAAO,gBAAgB;GACrB,MACE,IAAI,SAAS,IACT,EACE,aAAa,KACd,GACD;GACN,GAAG,SAAS;GACb,CAAC;EACF,SAAS;GACP,YAAY,CAAC,UAAU;GACvB,WAAW;GACX,GAAG,SAAS;GACb;EACF;AAED,KAAI,MAAM,SAAS,EACjB,UAAS;EACP,GAAG;EACH,MAAM;EACN,YAAY,SAAS,aAAa,CAAC,UAAU,GAAG,CAAC,WAAW,aAAa;EAC1E;CAGH,MAAM,cAAc,yBAAyB,MAAM;CACnD,MAAM,SAAS,MAAM,OAAO,IAAI,OAAO;CACvC,MAAMA,OAAuB,EAAE;AAC/B,MAAK,MAAM,QAAQ,OAAO,UAAU,EAAE,EAAE;EACtC,MAAM,SAAS,KAAK,OAAO;EAE3B,MAAM,OAAO,QAAQ,IAAI,OAAO;AAChC,MAAI,CAAC,KAAM;AAEX,OAAK,KAAK;GACR,IAAI;GACJ,MAAM;GACN,SAAS,KAAK;GACd,aAAa,KAAK;GAClB,uBAAuB,YAAY,UAAU,KAAK,QAAQ;GAC1D,KAAK,KAAK;GACX,CAAC;AAEF,OAAK,MAAM,OAAO,KAAK,QAAQ;AAC7B,OAAI,IAAI,SAAS,SAAS,OAAQ;AAElC,QAAK,KAAK;IACR,IAAI,IAAI,SAAS,GAAG,UAAU;IAC9B,SAAS,IAAI,SAAS;IACtB,aAAa,IAAI,SAAS;IAC1B,uBAAuB,YAAY,UAAU,IAAI,SAAS,QAAQ;IAClE,MAAM,IAAI,SAAS;IACnB,KAAK,IAAI,SAAS;IACnB,CAAC;;;AAGN,QAAO"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createContentHighlighter } from "./search-
|
|
1
|
+
import { t as createContentHighlighter } from "./search-D6ChCLhY.js";
|
|
2
2
|
|
|
3
3
|
//#region src/search/client/algolia.ts
|
|
4
4
|
function groupResults(hits) {
|
|
@@ -46,4 +46,4 @@ async function searchDocs(query, { indexName, onSearch, client, locale, tag }) {
|
|
|
46
46
|
|
|
47
47
|
//#endregion
|
|
48
48
|
export { searchDocs };
|
|
49
|
-
//# sourceMappingURL=algolia-
|
|
49
|
+
//# sourceMappingURL=algolia-CQPXCnjV.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"algolia-
|
|
1
|
+
{"version":3,"file":"algolia-CQPXCnjV.js","names":["grouped: SortedResult[]"],"sources":["../src/search/client/algolia.ts"],"sourcesContent":["import type { BaseIndex } from '@/search/algolia';\nimport type { Hit, LiteClient, SearchResponse } from 'algoliasearch/lite';\nimport { createContentHighlighter, type SortedResult } from '@/search';\n\nexport interface AlgoliaOptions {\n indexName: string;\n client: LiteClient;\n\n /**\n * Filter results with specific tag.\n */\n tag?: string;\n\n locale?: string;\n\n onSearch?: (\n query: string,\n tag?: string,\n locale?: string,\n ) => Promise<{\n results: SearchResponse<BaseIndex>[];\n }>;\n}\n\nexport function groupResults(hits: Hit<BaseIndex>[]): SortedResult[] {\n const grouped: SortedResult[] = [];\n const scannedUrls = new Set<string>();\n\n for (const hit of hits) {\n if (!scannedUrls.has(hit.url)) {\n scannedUrls.add(hit.url);\n\n grouped.push({\n id: hit.url,\n type: 'page',\n breadcrumbs: hit.breadcrumbs,\n url: hit.url,\n content: hit.title,\n });\n }\n\n grouped.push({\n id: hit.objectID,\n type: hit.content === hit.section ? 'heading' : 'text',\n url: hit.section_id ? `${hit.url}#${hit.section_id}` : hit.url,\n content: hit.content,\n });\n }\n\n return grouped;\n}\n\nexport async function searchDocs(\n query: string,\n { indexName, onSearch, client, locale, tag }: AlgoliaOptions,\n): Promise<SortedResult[]> {\n if (query.trim().length === 0) return [];\n\n const result = onSearch\n ? await onSearch(query, tag, locale)\n : await client.searchForHits<BaseIndex>({\n requests: [\n {\n type: 'default',\n indexName,\n query,\n distinct: 5,\n hitsPerPage: 10,\n filters: tag ? `tag:${tag}` : undefined,\n },\n ],\n });\n\n const highlighter = createContentHighlighter(query);\n return groupResults(result.results[0].hits).flatMap((hit) => {\n if (hit.type === 'page') {\n return {\n ...hit,\n contentWithHighlights: hit.contentWithHighlights ?? highlighter.highlight(hit.content),\n };\n }\n\n return [];\n });\n}\n"],"mappings":";;;AAwBA,SAAgB,aAAa,MAAwC;CACnE,MAAMA,UAA0B,EAAE;CAClC,MAAM,8BAAc,IAAI,KAAa;AAErC,MAAK,MAAM,OAAO,MAAM;AACtB,MAAI,CAAC,YAAY,IAAI,IAAI,IAAI,EAAE;AAC7B,eAAY,IAAI,IAAI,IAAI;AAExB,WAAQ,KAAK;IACX,IAAI,IAAI;IACR,MAAM;IACN,aAAa,IAAI;IACjB,KAAK,IAAI;IACT,SAAS,IAAI;IACd,CAAC;;AAGJ,UAAQ,KAAK;GACX,IAAI,IAAI;GACR,MAAM,IAAI,YAAY,IAAI,UAAU,YAAY;GAChD,KAAK,IAAI,aAAa,GAAG,IAAI,IAAI,GAAG,IAAI,eAAe,IAAI;GAC3D,SAAS,IAAI;GACd,CAAC;;AAGJ,QAAO;;AAGT,eAAsB,WACpB,OACA,EAAE,WAAW,UAAU,QAAQ,QAAQ,OACd;AACzB,KAAI,MAAM,MAAM,CAAC,WAAW,EAAG,QAAO,EAAE;CAExC,MAAM,SAAS,WACX,MAAM,SAAS,OAAO,KAAK,OAAO,GAClC,MAAM,OAAO,cAAyB,EACpC,UAAU,CACR;EACE,MAAM;EACN;EACA;EACA,UAAU;EACV,aAAa;EACb,SAAS,MAAM,OAAO,QAAQ;EAC/B,CACF,EACF,CAAC;CAEN,MAAM,cAAc,yBAAyB,MAAM;AACnD,QAAO,aAAa,OAAO,QAAQ,GAAG,KAAK,CAAC,SAAS,QAAQ;AAC3D,MAAI,IAAI,SAAS,OACf,QAAO;GACL,GAAG;GACH,uBAAuB,IAAI,yBAAyB,YAAY,UAAU,IAAI,QAAQ;GACvF;AAGH,SAAO,EAAE;GACT"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as StructuredData } from "./remark-structure-
|
|
1
|
+
import { n as StructuredData } from "./remark-structure-DGuWR82i.js";
|
|
2
2
|
import { Algoliasearch } from "algoliasearch";
|
|
3
3
|
|
|
4
4
|
//#region src/search/algolia.d.ts
|
|
@@ -65,4 +65,4 @@ interface BaseIndex {
|
|
|
65
65
|
}
|
|
66
66
|
//#endregion
|
|
67
67
|
export { sync as a, setIndexSettings as i, DocumentRecord as n, updateDocuments as o, SyncOptions as r, BaseIndex as t };
|
|
68
|
-
//# sourceMappingURL=algolia-
|
|
68
|
+
//# sourceMappingURL=algolia-Cc1y6qWl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"algolia-
|
|
1
|
+
{"version":3,"file":"algolia-Cc1y6qWl.d.ts","names":[],"sources":["../src/search/algolia.ts"],"sourcesContent":[],"mappings":";;;;UAGiB,cAAA;;AAAjB;AA2BA;EAkBsB,GAAA,EAAA,MAAI;EAAS,KAAA,EAAA,MAAA;EAAwB,WAAA,CAAA,EAAA,MAAA;EAAc,WAAA,CAAA,EAAA,MAAA,EAAA;EAAO;AAMhF;AAyDA;EACU,GAAA,EAAA,MAAA;EAEG,UAAA,EAjGC,cAiGD;EACV;;AASH;;;;;;;UA9FiB,WAAA;;;;;;;;aASJ;;;;;;;;iBASS,IAAA,SAAa,wBAAwB,cAAc;iBAMnD,gBAAA,SAAyB,mCAAmC;iBAyD5D,eAAA,SACZ,6CAEG,mBACV;UASc,SAAA"}
|
package/dist/breadcrumb.js
CHANGED
|
@@ -29,9 +29,9 @@ interface CodeBlockAttributes<Name extends string = string> {
|
|
|
29
29
|
rest: string;
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
|
-
* Parse
|
|
32
|
+
* Parse Hanzo Docs-style code block attributes from meta string, like `title="hello world"`
|
|
33
33
|
*/
|
|
34
34
|
declare function parseCodeBlockAttributes<Name extends string = string>(meta: string, allowedNames?: Name[]): CodeBlockAttributes<Name>;
|
|
35
35
|
//#endregion
|
|
36
36
|
export { parseCodeBlockAttributes as i, CodeBlockTabsOptions as n, generateCodeBlockTabs as r, CodeBlockAttributes as t };
|
|
37
|
-
//# sourceMappingURL=codeblock-utils-
|
|
37
|
+
//# sourceMappingURL=codeblock-utils-DDnYb8gi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codeblock-utils-
|
|
1
|
+
{"version":3,"file":"codeblock-utils-DDnYb8gi.d.ts","names":[],"sources":["../src/mdx-plugins/codeblock-utils.ts"],"sourcesContent":[],"mappings":";;;;UAGiB,oBAAA;eACF;EADE,YAAA,CAAA,EAAA,MAAA;EACF,OAAA,CAAA,EAAA;IASA,EAAA,EAAA,MAAA;EAAe,CAAA,GAAA,KAAA;EAIhB,QAAA,EAAA;IAAY,KAAA,EAAA,MAAA;IAIV,QAAA,EAAA,CARD,YAQsB,GARP,IAQO,CAAA,EAAA;EACnC,CAAA,EAAA;EACA,IAAA,EAAA;IACA,KAAA,EAAA,MAAA;IACA,QAAA,EARY,YAQZ,EAAA;EAEC,CAAA,EAAA;;AAAwC,iBAN3B,qBAAA,CAM2B;EAAA,OAAA;EAAA,YAAA;EAAA,QAAA;EAAA,IAAA;EAAA,GAAA;AAAA,CAAA,EAAxC,oBAAwC,CAAA,EAAjB,iBAAiB;AA6D1B,UAAA,mBAAmB,CAAA,aAAA,MAAA,GAAA,MAAA,CAAA,CAAA;EACP,UAAA,EAAf,OAAe,CAAP,MAAO,CAAA,IAAA,EAAA,MAAA,GAAA,IAAA,CAAA,CAAA;EAAP,IAAA,EAAA,MAAA;;;AAOtB;;AAGuB,iBAHP,wBAGO,CAAA,aAAA,MAAA,GAAA,MAAA,CAAA,CAAA,IAAA,EAAA,MAAA,EAAA,YAAA,CAAA,EADN,IACM,EAAA,CAAA,EAApB,mBAAoB,CAAA,IAAA,CAAA"}
|
package/dist/content/github.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github.js","names":[],"sources":["../../src/content/github.ts"],"sourcesContent":["type Response = {\n commit: {\n committer: {\n date: string;\n };\n };\n}[];\n\nexport interface GetGithubLastCommitOptions {\n /**\n * Repository name, like \"
|
|
1
|
+
{"version":3,"file":"github.js","names":[],"sources":["../../src/content/github.ts"],"sourcesContent":["type Response = {\n commit: {\n committer: {\n date: string;\n };\n };\n}[];\n\nexport interface GetGithubLastCommitOptions {\n /**\n * Repository name, like \"hanzo-docs\"\n */\n repo: string;\n\n /** Owner of repository */\n owner: string;\n\n /**\n * Path to file\n */\n path: string;\n\n /**\n * GitHub access token\n */\n token?: string;\n\n /**\n * SHA or ref (branch or tag) name.\n */\n sha?: string;\n\n /**\n * Base URL for GitHub API\n * @default \"https://api.github.com\"\n * @link https://docs.github.com/en/get-started/using-github-docs/about-versions-of-github-docs#determining-which-github-product-you-use\n */\n baseUrl?: string;\n\n /**\n * Custom query parameters\n */\n params?: Record<string, string>;\n\n options?: RequestInit;\n}\n\n/**\n * Get the last edit time of a file using GitHub API\n *\n * By default, this will cache the result forever.\n * Set `options.next.revalidate` to customise this.\n */\nexport async function getGithubLastEdit({\n repo,\n token,\n owner,\n path,\n sha,\n baseUrl = 'https://api.github.com',\n options = {},\n params: customParams = {},\n}: GetGithubLastCommitOptions): Promise<Date | null> {\n const headers = new Headers(options.headers);\n const params = new URLSearchParams();\n params.set('path', path);\n params.set('page', '1');\n params.set('per_page', '1');\n\n if (sha) params.set('sha', sha);\n\n for (const [key, value] of Object.entries(customParams)) {\n params.set(key, value);\n }\n\n if (token) {\n headers.append('authorization', token);\n }\n\n const res = await fetch(`${baseUrl}/repos/${owner}/${repo}/commits?${params.toString()}`, {\n cache: 'force-cache',\n ...options,\n headers,\n });\n\n if (!res.ok) throw new Error(`Failed to fetch last edit time from Git ${await res.text()}`);\n const data = (await res.json()) as Response;\n\n if (data.length === 0) return null;\n return new Date(data[0].commit.committer.date);\n}\n"],"mappings":";;;;;;;AAqDA,eAAsB,kBAAkB,EACtC,MACA,OACA,OACA,MACA,KACA,UAAU,0BACV,UAAU,EAAE,EACZ,QAAQ,eAAe,EAAE,IAC0B;CACnD,MAAM,UAAU,IAAI,QAAQ,QAAQ,QAAQ;CAC5C,MAAM,SAAS,IAAI,iBAAiB;AACpC,QAAO,IAAI,QAAQ,KAAK;AACxB,QAAO,IAAI,QAAQ,IAAI;AACvB,QAAO,IAAI,YAAY,IAAI;AAE3B,KAAI,IAAK,QAAO,IAAI,OAAO,IAAI;AAE/B,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,aAAa,CACrD,QAAO,IAAI,KAAK,MAAM;AAGxB,KAAI,MACF,SAAQ,OAAO,iBAAiB,MAAM;CAGxC,MAAM,MAAM,MAAM,MAAM,GAAG,QAAQ,SAAS,MAAM,GAAG,KAAK,WAAW,OAAO,UAAU,IAAI;EACxF,OAAO;EACP,GAAG;EACH;EACD,CAAC;AAEF,KAAI,CAAC,IAAI,GAAI,OAAM,IAAI,MAAM,2CAA2C,MAAM,IAAI,MAAM,GAAG;CAC3F,MAAM,OAAQ,MAAM,IAAI,MAAM;AAE9B,KAAI,KAAK,WAAW,EAAG,QAAO;AAC9B,QAAO,IAAI,KAAK,KAAK,GAAG,OAAO,UAAU,KAAK"}
|
package/dist/content/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react0 from "react";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
3
|
import { Components } from "hast-util-to-jsx-runtime";
|
|
4
4
|
import { Compatible } from "vfile";
|
|
@@ -17,7 +17,7 @@ declare function Markdown({
|
|
|
17
17
|
remarkPlugins?: PluggableList;
|
|
18
18
|
rehypePlugins?: PluggableList;
|
|
19
19
|
children: Compatible;
|
|
20
|
-
}): Promise<
|
|
20
|
+
}): Promise<react0.ReactElement<unknown, string | react0.JSXElementConstructor<any>> | Iterable<ReactNode> | (string | number | bigint | boolean | react0.ReactPortal | react0.ReactElement<unknown, string | react0.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined)>;
|
|
21
21
|
//#endregion
|
|
22
22
|
export { Markdown, MarkdownProps };
|
|
23
23
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import "../../remark-gfm-CeWpMwyk.js";
|
|
2
2
|
import { t as RehypeCodeOptions } from "../../rehype-code-vVWG4-ej.js";
|
|
3
3
|
import { t as RemarkImageOptions } from "../../remark-image-CvUis4R1.js";
|
|
4
|
-
import { t as StructureOptions } from "../../remark-structure-
|
|
4
|
+
import { t as StructureOptions } from "../../remark-structure-DGuWR82i.js";
|
|
5
5
|
import { t as RemarkHeadingOptions } from "../../remark-heading-CXvCY0go.js";
|
|
6
6
|
import { t as RemarkCodeTabOptions } from "../../remark-code-tab-CXsYlims.js";
|
|
7
|
-
import { t as RemarkNpmOptions } from "../../remark-npm-
|
|
7
|
+
import { t as RemarkNpmOptions } from "../../remark-npm-Bo08HqcQ.js";
|
|
8
8
|
import "../../mdx-plugins/index.js";
|
|
9
9
|
import { t as ResolvePlugins } from "../../util-CK2ykiif.js";
|
|
10
10
|
import { ProcessorOptions } from "@mdx-js/mdx";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import "../../remark-gfm-CeWpMwyk.js";
|
|
2
2
|
import { t as RehypeCodeOptions } from "../../rehype-code-vVWG4-ej.js";
|
|
3
3
|
import { t as RemarkImageOptions } from "../../remark-image-CvUis4R1.js";
|
|
4
|
-
import { t as StructureOptions } from "../../remark-structure-
|
|
4
|
+
import { t as StructureOptions } from "../../remark-structure-DGuWR82i.js";
|
|
5
5
|
import { t as RemarkHeadingOptions } from "../../remark-heading-CXvCY0go.js";
|
|
6
6
|
import { t as RemarkCodeTabOptions } from "../../remark-code-tab-CXsYlims.js";
|
|
7
|
-
import { t as RemarkNpmOptions } from "../../remark-npm-
|
|
7
|
+
import { t as RemarkNpmOptions } from "../../remark-npm-Bo08HqcQ.js";
|
|
8
8
|
import "../../mdx-plugins/index.js";
|
|
9
9
|
import { t as ResolvePlugins } from "../../util-CK2ykiif.js";
|
|
10
10
|
import { ProcessorOptions } from "@mdx-js/mdx";
|
package/dist/dynamic-link.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LinkProps } from "./link.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react6 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/dynamic-link.d.ts
|
|
5
5
|
type DynamicLinkProps = LinkProps;
|
|
@@ -8,7 +8,7 @@ type DynamicLinkProps = LinkProps;
|
|
|
8
8
|
*
|
|
9
9
|
* It supports dynamic hrefs, which means you can use `/[lang]/my-page` with `dynamicHrefs` enabled
|
|
10
10
|
*/
|
|
11
|
-
declare const DynamicLink:
|
|
11
|
+
declare const DynamicLink: react6.ForwardRefExoticComponent<LinkProps & react6.RefAttributes<HTMLAnchorElement>>;
|
|
12
12
|
//#endregion
|
|
13
13
|
export { DynamicLink, DynamicLink as default, DynamicLinkProps };
|
|
14
14
|
//# sourceMappingURL=dynamic-link.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentProps, FC, ReactNode } from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime2 from "react/jsx-runtime";
|
|
3
3
|
import { StaticImport } from "next/dist/shared/lib/get-img-props";
|
|
4
4
|
|
|
5
5
|
//#region src/framework/index.d.ts
|
|
@@ -39,12 +39,12 @@ declare function FrameworkProvider({
|
|
|
39
39
|
children
|
|
40
40
|
}: Framework & {
|
|
41
41
|
children: ReactNode;
|
|
42
|
-
}):
|
|
42
|
+
}): react_jsx_runtime2.JSX.Element;
|
|
43
43
|
declare function usePathname(): string;
|
|
44
44
|
declare function useRouter(): Router;
|
|
45
45
|
declare function useParams(): Record<string, string | string[]>;
|
|
46
|
-
declare function Image(props: ImageProps):
|
|
47
|
-
declare function Link(props: LinkProps):
|
|
46
|
+
declare function Image(props: ImageProps): react_jsx_runtime2.JSX.Element;
|
|
47
|
+
declare function Link(props: LinkProps): react_jsx_runtime2.JSX.Element;
|
|
48
48
|
//#endregion
|
|
49
49
|
export { Framework, FrameworkProvider, Image, ImageProps, Link, Router, useParams, usePathname, useRouter };
|
|
50
50
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Framework } from "./index.js";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react_jsx_runtime6 from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/framework/react-router.d.ts
|
|
6
6
|
declare function ReactRouterProvider({
|
|
@@ -11,7 +11,7 @@ declare function ReactRouterProvider({
|
|
|
11
11
|
children: ReactNode;
|
|
12
12
|
Link?: Framework['Link'];
|
|
13
13
|
Image?: Framework['Image'];
|
|
14
|
-
}):
|
|
14
|
+
}): react_jsx_runtime6.JSX.Element;
|
|
15
15
|
//#endregion
|
|
16
16
|
export { ReactRouterProvider };
|
|
17
17
|
//# sourceMappingURL=react-router.d.ts.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Framework } from "./index.js";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react_jsx_runtime8 from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/framework/tanstack.d.ts
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Hanzo Docs adapter for Tanstack Router/Start
|
|
8
8
|
*/
|
|
9
9
|
declare function TanstackProvider({
|
|
10
10
|
children,
|
|
@@ -14,7 +14,7 @@ declare function TanstackProvider({
|
|
|
14
14
|
children: ReactNode;
|
|
15
15
|
Link?: Framework['Link'];
|
|
16
16
|
Image?: Framework['Image'];
|
|
17
|
-
}):
|
|
17
|
+
}): react_jsx_runtime8.JSX.Element;
|
|
18
18
|
//#endregion
|
|
19
19
|
export { TanstackProvider };
|
|
20
20
|
//# sourceMappingURL=tanstack.d.ts.map
|
|
@@ -41,7 +41,7 @@ const framework = {
|
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
44
|
+
* Hanzo Docs adapter for Tanstack Router/Start
|
|
45
45
|
*/
|
|
46
46
|
function TanstackProvider({ children, Link: CustomLink, Image: CustomImage }) {
|
|
47
47
|
return /* @__PURE__ */ jsx(FrameworkProvider, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tanstack.js","names":["framework: Framework"],"sources":["../../src/framework/tanstack.tsx"],"sourcesContent":["import { type ReactNode, useRef, useMemo } from 'react';\nimport { type Framework, FrameworkProvider } from '@/framework/index';\nimport { useParams, Link, useRouter, useRouterState } from '@tanstack/react-router';\n\nconst framework: Framework = {\n Link({ href, prefetch = true, ...props }) {\n return (\n <Link to={href} preload={prefetch ? 'intent' : false} {...props}>\n {props.children}\n </Link>\n );\n },\n usePathname() {\n const { isLoading, pathname } = useRouterState({\n select: (state) => ({\n isLoading: state.isLoading,\n pathname: state.location.pathname,\n }),\n });\n\n const activePathname = useRef(pathname);\n return useMemo(() => {\n if (isLoading) {\n return activePathname.current;\n }\n\n activePathname.current = pathname;\n return pathname;\n }, [isLoading, pathname]);\n },\n useRouter() {\n const router = useRouter();\n\n return useMemo(\n () => ({\n push(url) {\n void router.navigate({\n href: url,\n });\n },\n refresh() {\n void router.invalidate();\n },\n }),\n [router],\n );\n },\n useParams() {\n return useParams({ strict: false });\n },\n};\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"tanstack.js","names":["framework: Framework"],"sources":["../../src/framework/tanstack.tsx"],"sourcesContent":["import { type ReactNode, useRef, useMemo } from 'react';\nimport { type Framework, FrameworkProvider } from '@/framework/index';\nimport { useParams, Link, useRouter, useRouterState } from '@tanstack/react-router';\n\nconst framework: Framework = {\n Link({ href, prefetch = true, ...props }) {\n return (\n <Link to={href} preload={prefetch ? 'intent' : false} {...props}>\n {props.children}\n </Link>\n );\n },\n usePathname() {\n const { isLoading, pathname } = useRouterState({\n select: (state) => ({\n isLoading: state.isLoading,\n pathname: state.location.pathname,\n }),\n });\n\n const activePathname = useRef(pathname);\n return useMemo(() => {\n if (isLoading) {\n return activePathname.current;\n }\n\n activePathname.current = pathname;\n return pathname;\n }, [isLoading, pathname]);\n },\n useRouter() {\n const router = useRouter();\n\n return useMemo(\n () => ({\n push(url) {\n void router.navigate({\n href: url,\n });\n },\n refresh() {\n void router.invalidate();\n },\n }),\n [router],\n );\n },\n useParams() {\n return useParams({ strict: false });\n },\n};\n\n/**\n * Hanzo Docs adapter for Tanstack Router/Start\n */\nexport function TanstackProvider({\n children,\n Link: CustomLink,\n Image: CustomImage,\n}: {\n children: ReactNode;\n Link?: Framework['Link'];\n Image?: Framework['Image'];\n}) {\n return (\n <FrameworkProvider\n {...framework}\n Link={CustomLink ?? framework.Link}\n Image={CustomImage ?? framework.Image}\n >\n {children}\n </FrameworkProvider>\n );\n}\n"],"mappings":";;;;;;AAIA,MAAMA,YAAuB;CAC3B,KAAK,EAAE,MAAM,WAAW,MAAM,GAAG,SAAS;AACxC,SACE,oBAAC;GAAK,IAAI;GAAM,SAAS,WAAW,WAAW;GAAO,GAAI;aACvD,MAAM;IACF;;CAGX,cAAc;EACZ,MAAM,EAAE,WAAW,aAAa,eAAe,EAC7C,SAAS,WAAW;GAClB,WAAW,MAAM;GACjB,UAAU,MAAM,SAAS;GAC1B,GACF,CAAC;EAEF,MAAM,iBAAiB,OAAO,SAAS;AACvC,SAAO,cAAc;AACnB,OAAI,UACF,QAAO,eAAe;AAGxB,kBAAe,UAAU;AACzB,UAAO;KACN,CAAC,WAAW,SAAS,CAAC;;CAE3B,YAAY;EACV,MAAM,SAAS,WAAW;AAE1B,SAAO,eACE;GACL,KAAK,KAAK;AACR,IAAK,OAAO,SAAS,EACnB,MAAM,KACP,CAAC;;GAEJ,UAAU;AACR,IAAK,OAAO,YAAY;;GAE3B,GACD,CAAC,OAAO,CACT;;CAEH,YAAY;AACV,SAAO,UAAU,EAAE,QAAQ,OAAO,CAAC;;CAEtC;;;;AAKD,SAAgB,iBAAiB,EAC/B,UACA,MAAM,YACN,OAAO,eAKN;AACD,QACE,oBAAC;EACC,GAAI;EACJ,MAAM,cAAc,UAAU;EAC9B,OAAO,eAAe,UAAU;EAE/B;GACiB"}
|
package/dist/framework/waku.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Framework } from "./index.js";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react_jsx_runtime7 from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/framework/waku.d.ts
|
|
6
6
|
declare function WakuProvider({
|
|
@@ -11,7 +11,7 @@ declare function WakuProvider({
|
|
|
11
11
|
children: ReactNode;
|
|
12
12
|
Link?: Framework['Link'];
|
|
13
13
|
Image?: Framework['Image'];
|
|
14
|
-
}):
|
|
14
|
+
}): react_jsx_runtime7.JSX.Element;
|
|
15
15
|
//#endregion
|
|
16
16
|
export { WakuProvider };
|
|
17
17
|
//# sourceMappingURL=waku.d.ts.map
|
package/dist/highlight/client.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as hastToJsx, i as getHighlighter, n as HighlightOptionsCommon, o as highlight, r as HighlightOptionsThemes, s as highlightHast, t as HighlightOptions } from "../shiki-
|
|
1
|
+
import { a as hastToJsx, i as getHighlighter, n as HighlightOptionsCommon, o as highlight, r as HighlightOptionsThemes, s as highlightHast, t as HighlightOptions } from "../shiki-Dq3XIYAT.js";
|
|
2
2
|
export { type HighlightOptions, type HighlightOptionsCommon, type HighlightOptionsThemes, getHighlighter, hastToJsx, highlight, highlightHast };
|
package/dist/highlight/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as highlightHast, i as highlight, n as getHighlighter, r as hastToJsx } from "../shiki-
|
|
1
|
+
import { a as highlightHast, i as highlight, n as getHighlighter, r as hastToJsx } from "../shiki-B5wNmyIZ.js";
|
|
2
2
|
|
|
3
3
|
export { getHighlighter, hastToJsx, highlight, highlightHast };
|
|
@@ -5,7 +5,7 @@ function iconPlugin(resolveIcon) {
|
|
|
5
5
|
return node;
|
|
6
6
|
}
|
|
7
7
|
return {
|
|
8
|
-
name: "
|
|
8
|
+
name: "hanzo-docs:icon",
|
|
9
9
|
transformPageTree: {
|
|
10
10
|
file: replaceIcon,
|
|
11
11
|
folder: replaceIcon,
|
|
@@ -16,4 +16,4 @@ function iconPlugin(resolveIcon) {
|
|
|
16
16
|
|
|
17
17
|
//#endregion
|
|
18
18
|
export { iconPlugin as t };
|
|
19
|
-
//# sourceMappingURL=icon-
|
|
19
|
+
//# sourceMappingURL=icon-BWwSDabM.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon-
|
|
1
|
+
{"version":3,"file":"icon-BWwSDabM.js","names":[],"sources":["../src/source/plugins/icon.ts"],"sourcesContent":["import type { LoaderPlugin } from '@/source';\nimport type { ReactNode } from 'react';\nimport type * as PageTree from '@/page-tree/definitions';\n\nexport type IconResolver = (icon: string | undefined) => ReactNode;\n\nexport function iconPlugin(resolveIcon: IconResolver): LoaderPlugin {\n function replaceIcon<T extends PageTree.Node>(node: T): T {\n if (node.icon === undefined || typeof node.icon === 'string')\n node.icon = resolveIcon(node.icon);\n\n return node;\n }\n\n return {\n name: 'hanzo-docs:icon',\n transformPageTree: {\n file: replaceIcon,\n folder: replaceIcon,\n separator: replaceIcon,\n },\n };\n}\n"],"mappings":";AAMA,SAAgB,WAAW,aAAyC;CAClE,SAAS,YAAqC,MAAY;AACxD,MAAI,KAAK,SAAS,UAAa,OAAO,KAAK,SAAS,SAClD,MAAK,OAAO,YAAY,KAAK,KAAK;AAEpC,SAAO;;AAGT,QAAO;EACL,MAAM;EACN,mBAAmB;GACjB,MAAM;GACN,QAAQ;GACR,WAAW;GACZ;EACF"}
|
package/dist/link.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react4 from "react";
|
|
2
2
|
import { AnchorHTMLAttributes } from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/link.d.ts
|
|
@@ -14,7 +14,7 @@ interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
|
14
14
|
*/
|
|
15
15
|
prefetch?: boolean;
|
|
16
16
|
}
|
|
17
|
-
declare const Link:
|
|
17
|
+
declare const Link: react4.ForwardRefExoticComponent<LinkProps & react4.RefAttributes<HTMLAnchorElement>>;
|
|
18
18
|
//#endregion
|
|
19
19
|
export { LinkProps, Link as default };
|
|
20
20
|
//# sourceMappingURL=link.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as parseCodeBlockAttributes, n as CodeBlockTabsOptions, r as generateCodeBlockTabs, t as CodeBlockAttributes } from "../codeblock-utils-
|
|
1
|
+
import { i as parseCodeBlockAttributes, n as CodeBlockTabsOptions, r as generateCodeBlockTabs, t as CodeBlockAttributes } from "../codeblock-utils-DDnYb8gi.js";
|
|
2
2
|
export { CodeBlockAttributes, CodeBlockTabsOptions, generateCodeBlockTabs, parseCodeBlockAttributes };
|
|
@@ -49,7 +49,7 @@ function generateCodeBlockTabs({ persist = false, defaultValue, triggers, tabs,
|
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
|
-
* Parse
|
|
52
|
+
* Parse Hanzo Docs-style code block attributes from meta string, like `title="hello world"`
|
|
53
53
|
*/
|
|
54
54
|
function parseCodeBlockAttributes(meta, allowedNames) {
|
|
55
55
|
let str = meta;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codeblock-utils.js","names":["attributes: MdxJsxAttribute[]","children: MdxJsxFlowElement[]","attributes: CodeBlockAttributes['attributes']"],"sources":["../../src/mdx-plugins/codeblock-utils.ts"],"sourcesContent":["import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx-jsx';\nimport type { BlockContent, Text } from 'mdast';\n\nexport interface CodeBlockTabsOptions {\n attributes?: MdxJsxAttribute[];\n defaultValue?: string;\n persist?:\n | {\n id: string;\n }\n | false;\n triggers: {\n value: string;\n children: (BlockContent | Text)[];\n }[];\n tabs: {\n value: string;\n children: BlockContent[];\n }[];\n}\n\nexport function generateCodeBlockTabs({\n persist = false,\n defaultValue,\n triggers,\n tabs,\n ...options\n}: CodeBlockTabsOptions): MdxJsxFlowElement {\n const attributes: MdxJsxAttribute[] = [];\n if (options.attributes) attributes.push(...options.attributes);\n\n if (defaultValue) {\n attributes.push({\n type: 'mdxJsxAttribute',\n name: 'defaultValue',\n value: defaultValue,\n });\n }\n\n if (typeof persist === 'object') {\n attributes.push(\n {\n type: 'mdxJsxAttribute',\n name: 'groupId',\n value: persist.id,\n },\n {\n type: 'mdxJsxAttribute',\n name: 'persist',\n value: null,\n },\n );\n }\n\n const children: MdxJsxFlowElement[] = [\n {\n type: 'mdxJsxFlowElement',\n name: 'CodeBlockTabsList',\n attributes: [],\n children: triggers.map(\n (trigger) =>\n ({\n type: 'mdxJsxFlowElement',\n attributes: [{ type: 'mdxJsxAttribute', name: 'value', value: trigger.value }],\n name: 'CodeBlockTabsTrigger',\n children: trigger.children,\n }) as MdxJsxFlowElement,\n ),\n },\n ];\n\n for (const tab of tabs) {\n children.push({\n type: 'mdxJsxFlowElement',\n name: 'CodeBlockTab',\n attributes: [{ type: 'mdxJsxAttribute', name: 'value', value: tab.value }],\n children: tab.children,\n });\n }\n\n return {\n type: 'mdxJsxFlowElement',\n name: 'CodeBlockTabs',\n attributes,\n children,\n };\n}\n\nexport interface CodeBlockAttributes<Name extends string = string> {\n attributes: Partial<Record<Name, string | null>>;\n rest: string;\n}\n\n/**\n * Parse
|
|
1
|
+
{"version":3,"file":"codeblock-utils.js","names":["attributes: MdxJsxAttribute[]","children: MdxJsxFlowElement[]","attributes: CodeBlockAttributes['attributes']"],"sources":["../../src/mdx-plugins/codeblock-utils.ts"],"sourcesContent":["import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx-jsx';\nimport type { BlockContent, Text } from 'mdast';\n\nexport interface CodeBlockTabsOptions {\n attributes?: MdxJsxAttribute[];\n defaultValue?: string;\n persist?:\n | {\n id: string;\n }\n | false;\n triggers: {\n value: string;\n children: (BlockContent | Text)[];\n }[];\n tabs: {\n value: string;\n children: BlockContent[];\n }[];\n}\n\nexport function generateCodeBlockTabs({\n persist = false,\n defaultValue,\n triggers,\n tabs,\n ...options\n}: CodeBlockTabsOptions): MdxJsxFlowElement {\n const attributes: MdxJsxAttribute[] = [];\n if (options.attributes) attributes.push(...options.attributes);\n\n if (defaultValue) {\n attributes.push({\n type: 'mdxJsxAttribute',\n name: 'defaultValue',\n value: defaultValue,\n });\n }\n\n if (typeof persist === 'object') {\n attributes.push(\n {\n type: 'mdxJsxAttribute',\n name: 'groupId',\n value: persist.id,\n },\n {\n type: 'mdxJsxAttribute',\n name: 'persist',\n value: null,\n },\n );\n }\n\n const children: MdxJsxFlowElement[] = [\n {\n type: 'mdxJsxFlowElement',\n name: 'CodeBlockTabsList',\n attributes: [],\n children: triggers.map(\n (trigger) =>\n ({\n type: 'mdxJsxFlowElement',\n attributes: [{ type: 'mdxJsxAttribute', name: 'value', value: trigger.value }],\n name: 'CodeBlockTabsTrigger',\n children: trigger.children,\n }) as MdxJsxFlowElement,\n ),\n },\n ];\n\n for (const tab of tabs) {\n children.push({\n type: 'mdxJsxFlowElement',\n name: 'CodeBlockTab',\n attributes: [{ type: 'mdxJsxAttribute', name: 'value', value: tab.value }],\n children: tab.children,\n });\n }\n\n return {\n type: 'mdxJsxFlowElement',\n name: 'CodeBlockTabs',\n attributes,\n children,\n };\n}\n\nexport interface CodeBlockAttributes<Name extends string = string> {\n attributes: Partial<Record<Name, string | null>>;\n rest: string;\n}\n\n/**\n * Parse Hanzo Docs-style code block attributes from meta string, like `title=\"hello world\"`\n */\nexport function parseCodeBlockAttributes<Name extends string = string>(\n meta: string,\n allowedNames?: Name[],\n): CodeBlockAttributes<Name> {\n let str = meta;\n const StringRegex = /(?<=^|\\s)(?<name>\\w+)(?:=(?:\"([^\"]*)\"|'([^']*)'))?/g;\n const attributes: CodeBlockAttributes['attributes'] = {};\n\n str = str.replaceAll(StringRegex, (match, name, value_1, value_2) => {\n if (allowedNames && !allowedNames.includes(name)) return match;\n\n attributes[name] = value_1 ?? value_2 ?? null;\n return '';\n });\n\n return {\n rest: str,\n attributes,\n };\n}\n"],"mappings":";AAqBA,SAAgB,sBAAsB,EACpC,UAAU,OACV,cACA,UACA,MACA,GAAG,WACuC;CAC1C,MAAMA,aAAgC,EAAE;AACxC,KAAI,QAAQ,WAAY,YAAW,KAAK,GAAG,QAAQ,WAAW;AAE9D,KAAI,aACF,YAAW,KAAK;EACd,MAAM;EACN,MAAM;EACN,OAAO;EACR,CAAC;AAGJ,KAAI,OAAO,YAAY,SACrB,YAAW,KACT;EACE,MAAM;EACN,MAAM;EACN,OAAO,QAAQ;EAChB,EACD;EACE,MAAM;EACN,MAAM;EACN,OAAO;EACR,CACF;CAGH,MAAMC,WAAgC,CACpC;EACE,MAAM;EACN,MAAM;EACN,YAAY,EAAE;EACd,UAAU,SAAS,KAChB,aACE;GACC,MAAM;GACN,YAAY,CAAC;IAAE,MAAM;IAAmB,MAAM;IAAS,OAAO,QAAQ;IAAO,CAAC;GAC9E,MAAM;GACN,UAAU,QAAQ;GACnB,EACJ;EACF,CACF;AAED,MAAK,MAAM,OAAO,KAChB,UAAS,KAAK;EACZ,MAAM;EACN,MAAM;EACN,YAAY,CAAC;GAAE,MAAM;GAAmB,MAAM;GAAS,OAAO,IAAI;GAAO,CAAC;EAC1E,UAAU,IAAI;EACf,CAAC;AAGJ,QAAO;EACL,MAAM;EACN,MAAM;EACN;EACA;EACD;;;;;AAWH,SAAgB,yBACd,MACA,cAC2B;CAC3B,IAAI,MAAM;CACV,MAAM,cAAc;CACpB,MAAMC,aAAgD,EAAE;AAExD,OAAM,IAAI,WAAW,cAAc,OAAO,MAAM,SAAS,YAAY;AACnE,MAAI,gBAAgB,CAAC,aAAa,SAAS,KAAK,CAAE,QAAO;AAEzD,aAAW,QAAQ,WAAW,WAAW;AACzC,SAAO;GACP;AAEF,QAAO;EACL,MAAM;EACN;EACD"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { n as remarkGfm, t as RemarkGfmOptions } from "../remark-gfm-CeWpMwyk.js";
|
|
2
2
|
import { a as CodeBlockIcon, i as transformerTab, n as rehypeCode, o as transformerIcon, r as rehypeCodeDefaultOptions, t as RehypeCodeOptions } from "../rehype-code-vVWG4-ej.js";
|
|
3
3
|
import { n as remarkImage, t as RemarkImageOptions } from "../remark-image-CvUis4R1.js";
|
|
4
|
-
import { a as structure, i as remarkStructureDefaultOptions, n as StructuredData, r as remarkStructure, t as StructureOptions } from "../remark-structure-
|
|
4
|
+
import { a as structure, i as remarkStructureDefaultOptions, n as StructuredData, r as remarkStructure, t as StructureOptions } from "../remark-structure-DGuWR82i.js";
|
|
5
5
|
import { n as remarkHeading, t as RemarkHeadingOptions } from "../remark-heading-CXvCY0go.js";
|
|
6
6
|
import { n as remarkAdmonition, t as RemarkAdmonitionOptions } from "../remark-admonition-DOwBWzsH.js";
|
|
7
7
|
import { n as remarkDirectiveAdmonition, t as RemarkDirectiveAdmonitionOptions } from "../remark-directive-admonition-BCm_yiU9.js";
|
|
8
8
|
import { n as rehypeToc, t as RehypeTocOptions } from "../rehype-toc-DJvSyE0o.js";
|
|
9
9
|
import { n as remarkCodeTab, t as RemarkCodeTabOptions } from "../remark-code-tab-CXsYlims.js";
|
|
10
10
|
import { n as remarkSteps, t as RemarkStepsOptions } from "../remark-steps-CHJN-rtm.js";
|
|
11
|
-
import { n as remarkNpm, t as RemarkNpmOptions } from "../remark-npm-
|
|
12
|
-
import { i as parseCodeBlockAttributes, n as CodeBlockTabsOptions, r as generateCodeBlockTabs, t as CodeBlockAttributes } from "../codeblock-utils-
|
|
11
|
+
import { n as remarkNpm, t as RemarkNpmOptions } from "../remark-npm-Bo08HqcQ.js";
|
|
12
|
+
import { i as parseCodeBlockAttributes, n as CodeBlockTabsOptions, r as generateCodeBlockTabs, t as CodeBlockAttributes } from "../codeblock-utils-DDnYb8gi.js";
|
|
13
13
|
import { n as remarkMdxFiles, t as RemarkMdxFilesOptions } from "../remark-mdx-files-DOYafA4x.js";
|
|
14
14
|
import { n as remarkMdxMermaid, t as RemarkMdxMermaidOptions } from "../remark-mdx-mermaid-BdSUUiCG.js";
|
|
15
15
|
export { CodeBlockAttributes, CodeBlockIcon, CodeBlockTabsOptions, RehypeCodeOptions, RehypeTocOptions, RemarkAdmonitionOptions, RemarkCodeTabOptions, RemarkDirectiveAdmonitionOptions, RemarkGfmOptions, RemarkHeadingOptions, RemarkImageOptions, RemarkMdxFilesOptions, RemarkMdxMermaidOptions, RemarkNpmOptions, RemarkStepsOptions, StructureOptions, StructuredData, generateCodeBlockTabs, parseCodeBlockAttributes, rehypeCode, rehypeCodeDefaultOptions, rehypeToc, remarkAdmonition, remarkCodeTab, remarkDirectiveAdmonition, remarkGfm, remarkHeading, remarkImage, remarkMdxFiles, remarkMdxMermaid, remarkNpm, remarkSteps, remarkStructure, remarkStructureDefaultOptions, structure, transformerIcon, transformerTab };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import "../mdast-utils-mc9-X-PK.js";
|
|
2
2
|
import { remarkHeading } from "./remark-heading.js";
|
|
3
|
-
import "../shiki-
|
|
3
|
+
import "../shiki-B5wNmyIZ.js";
|
|
4
4
|
import { generateCodeBlockTabs, parseCodeBlockAttributes } from "./codeblock-utils.js";
|
|
5
5
|
import { remarkGfm } from "./remark-gfm.js";
|
|
6
|
-
import { i as transformerIcon, n as rehypeCodeDefaultOptions, r as transformerTab, t as rehypeCode } from "../rehype-code-
|
|
6
|
+
import { i as transformerIcon, n as rehypeCodeDefaultOptions, r as transformerTab, t as rehypeCode } from "../rehype-code-sM9Tq-r7.js";
|
|
7
7
|
import { remarkImage } from "./remark-image.js";
|
|
8
8
|
import { remarkStructure, remarkStructureDefaultOptions, structure } from "./remark-structure.js";
|
|
9
9
|
import { remarkAdmonition } from "./remark-admonition.js";
|
|
10
10
|
import { remarkDirectiveAdmonition } from "./remark-directive-admonition.js";
|
|
11
|
-
import { t as rehypeToc } from "../rehype-toc-
|
|
11
|
+
import { t as rehypeToc } from "../rehype-toc-DVwJcwvA.js";
|
|
12
12
|
import { remarkCodeTab } from "./remark-code-tab.js";
|
|
13
13
|
import { remarkSteps } from "./remark-steps.js";
|
|
14
14
|
import { remarkNpm } from "./remark-npm.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../shiki-
|
|
1
|
+
import "../shiki-B5wNmyIZ.js";
|
|
2
2
|
import "./codeblock-utils.js";
|
|
3
|
-
import { i as transformerIcon, n as rehypeCodeDefaultOptions, r as transformerTab, t as rehypeCode } from "../rehype-code-
|
|
3
|
+
import { i as transformerIcon, n as rehypeCodeDefaultOptions, r as transformerTab, t as rehypeCode } from "../rehype-code-sM9Tq-r7.js";
|
|
4
4
|
|
|
5
5
|
export { rehypeCode, rehypeCodeDefaultOptions, transformerIcon, transformerTab };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as remarkNpm, t as RemarkNpmOptions } from "../remark-npm-
|
|
1
|
+
import { n as remarkNpm, t as RemarkNpmOptions } from "../remark-npm-Bo08HqcQ.js";
|
|
2
2
|
export { RemarkNpmOptions, remarkNpm };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remark-npm.js","names":["options: CodeBlockTabsOptions"],"sources":["../../src/mdx-plugins/remark-npm.ts"],"sourcesContent":["import type { Root } from 'mdast';\nimport type { Transformer } from 'unified';\nimport { visit } from 'unist-util-visit';\nimport convert from 'npm-to-yarn';\nimport { type CodeBlockTabsOptions, generateCodeBlockTabs } from '@/mdx-plugins/codeblock-utils';\n\ninterface PackageManager {\n name: string;\n\n /**\n * Default to `name`\n */\n value?: string;\n\n /**\n * Convert from npm to another package manager\n */\n command: (command: string) => string | undefined;\n}\n\nexport interface RemarkNpmOptions {\n /**\n * Persist Tab value (
|
|
1
|
+
{"version":3,"file":"remark-npm.js","names":["options: CodeBlockTabsOptions"],"sources":["../../src/mdx-plugins/remark-npm.ts"],"sourcesContent":["import type { Root } from 'mdast';\nimport type { Transformer } from 'unified';\nimport { visit } from 'unist-util-visit';\nimport convert from 'npm-to-yarn';\nimport { type CodeBlockTabsOptions, generateCodeBlockTabs } from '@/mdx-plugins/codeblock-utils';\n\ninterface PackageManager {\n name: string;\n\n /**\n * Default to `name`\n */\n value?: string;\n\n /**\n * Convert from npm to another package manager\n */\n command: (command: string) => string | undefined;\n}\n\nexport interface RemarkNpmOptions {\n /**\n * Persist Tab value (Hanzo Docs UI only)\n *\n * @defaultValue false\n */\n persist?:\n | {\n id: string;\n }\n | false;\n\n packageManagers?: PackageManager[];\n}\n\nconst aliases = ['npm', 'package-install'];\n\n/**\n * It generates multiple tabs of codeblocks for different package managers from a npm command codeblock.\n */\nexport function remarkNpm({\n persist = false,\n packageManagers = [\n { command: (cmd) => convert(cmd, 'npm'), name: 'npm' },\n { command: (cmd) => convert(cmd, 'pnpm'), name: 'pnpm' },\n { command: (cmd) => convert(cmd, 'yarn'), name: 'yarn' },\n { command: (cmd) => convert(cmd, 'bun'), name: 'bun' },\n ],\n}: RemarkNpmOptions = {}): Transformer<Root, Root> {\n return (tree) => {\n visit(tree, 'code', (node) => {\n if (!node.lang || !aliases.includes(node.lang)) return;\n let code = node.value;\n\n if (node.lang === 'package-install' && !code.startsWith('npm') && !code.startsWith('npx')) {\n code = `npm install ${code}`;\n }\n const options: CodeBlockTabsOptions = {\n persist,\n tabs: [],\n triggers: [],\n };\n\n for (const manager of packageManagers) {\n const value = manager.value ?? manager.name;\n const command = manager.command(code);\n if (!command || command.length === 0) continue;\n\n options.defaultValue ??= value;\n options.triggers.push({\n value,\n children: [{ type: 'text', value: manager.name }],\n });\n options.tabs.push({\n value,\n children: [\n {\n type: 'code',\n lang: 'bash',\n meta: node.meta,\n value: command,\n },\n ],\n });\n }\n\n Object.assign(node, generateCodeBlockTabs(options));\n return 'skip';\n });\n };\n}\n"],"mappings":";;;;;AAmCA,MAAM,UAAU,CAAC,OAAO,kBAAkB;;;;AAK1C,SAAgB,UAAU,EACxB,UAAU,OACV,kBAAkB;CAChB;EAAE,UAAU,QAAQ,QAAQ,KAAK,MAAM;EAAE,MAAM;EAAO;CACtD;EAAE,UAAU,QAAQ,QAAQ,KAAK,OAAO;EAAE,MAAM;EAAQ;CACxD;EAAE,UAAU,QAAQ,QAAQ,KAAK,OAAO;EAAE,MAAM;EAAQ;CACxD;EAAE,UAAU,QAAQ,QAAQ,KAAK,MAAM;EAAE,MAAM;EAAO;CACvD,KACmB,EAAE,EAA2B;AACjD,SAAQ,SAAS;AACf,QAAM,MAAM,SAAS,SAAS;AAC5B,OAAI,CAAC,KAAK,QAAQ,CAAC,QAAQ,SAAS,KAAK,KAAK,CAAE;GAChD,IAAI,OAAO,KAAK;AAEhB,OAAI,KAAK,SAAS,qBAAqB,CAAC,KAAK,WAAW,MAAM,IAAI,CAAC,KAAK,WAAW,MAAM,CACvF,QAAO,eAAe;GAExB,MAAMA,UAAgC;IACpC;IACA,MAAM,EAAE;IACR,UAAU,EAAE;IACb;AAED,QAAK,MAAM,WAAW,iBAAiB;IACrC,MAAM,QAAQ,QAAQ,SAAS,QAAQ;IACvC,MAAM,UAAU,QAAQ,QAAQ,KAAK;AACrC,QAAI,CAAC,WAAW,QAAQ,WAAW,EAAG;AAEtC,YAAQ,iBAAiB;AACzB,YAAQ,SAAS,KAAK;KACpB;KACA,UAAU,CAAC;MAAE,MAAM;MAAQ,OAAO,QAAQ;MAAM,CAAC;KAClD,CAAC;AACF,YAAQ,KAAK,KAAK;KAChB;KACA,UAAU,CACR;MACE,MAAM;MACN,MAAM;MACN,MAAM,KAAK;MACX,OAAO;MACR,CACF;KACF,CAAC;;AAGJ,UAAO,OAAO,MAAM,sBAAsB,QAAQ,CAAC;AACnD,UAAO;IACP"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as structure, i as remarkStructureDefaultOptions, n as StructuredData, r as remarkStructure, t as StructureOptions } from "../remark-structure-
|
|
1
|
+
import { a as structure, i as remarkStructureDefaultOptions, n as StructuredData, r as remarkStructure, t as StructureOptions } from "../remark-structure-DGuWR82i.js";
|
|
2
2
|
export { StructureOptions, StructuredData, remarkStructure, remarkStructureDefaultOptions, structure };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remark-structure.js","names":["data: StructuredData","lastHeading: string | undefined","content"],"sources":["../../src/mdx-plugins/remark-structure.ts"],"sourcesContent":["import Slugger from 'github-slugger';\nimport type { Nodes, Root } from 'mdast';\nimport { remark } from 'remark';\nimport remarkGfm from 'remark-gfm';\nimport type { PluggableList, Transformer } from 'unified';\nimport { visit } from 'unist-util-visit';\nimport { flattenNode, toMdxExport } from './mdast-utils';\nimport type {\n MdxJsxAttribute,\n MdxJsxExpressionAttribute,\n MdxJsxFlowElement,\n} from 'mdast-util-mdx-jsx';\n\ninterface Heading {\n id: string;\n content: string;\n}\n\ninterface Content {\n heading: string | undefined;\n content: string;\n}\n\nexport interface StructuredData {\n headings: Heading[];\n /**\n * Refer to paragraphs, a heading may contain multiple contents as well\n */\n contents: Content[];\n}\n\nexport interface StructureOptions {\n /**\n * Types to be scanned as content.\n *\n * @defaultValue ['heading', 'paragraph', 'blockquote', 'tableCell', 'mdxJsxFlowElement']\n */\n types?: string[] | ((node: Nodes) => boolean);\n\n /**\n * A list of indexable MDX attributes, either:\n *\n * - an array of attribute names.\n * - a function that determines if attribute should be indexed.\n */\n allowedMdxAttributes?:\n | string[]\n | ((\n node: MdxJsxFlowElement,\n attribute: MdxJsxAttribute | MdxJsxExpressionAttribute,\n ) => boolean);\n\n /**\n * export as `structuredData` or specified variable name.\n */\n exportAs?: string | boolean;\n}\n\ndeclare module 'mdast' {\n interface Data {\n /**\n * [
|
|
1
|
+
{"version":3,"file":"remark-structure.js","names":["data: StructuredData","lastHeading: string | undefined","content"],"sources":["../../src/mdx-plugins/remark-structure.ts"],"sourcesContent":["import Slugger from 'github-slugger';\nimport type { Nodes, Root } from 'mdast';\nimport { remark } from 'remark';\nimport remarkGfm from 'remark-gfm';\nimport type { PluggableList, Transformer } from 'unified';\nimport { visit } from 'unist-util-visit';\nimport { flattenNode, toMdxExport } from './mdast-utils';\nimport type {\n MdxJsxAttribute,\n MdxJsxExpressionAttribute,\n MdxJsxFlowElement,\n} from 'mdast-util-mdx-jsx';\n\ninterface Heading {\n id: string;\n content: string;\n}\n\ninterface Content {\n heading: string | undefined;\n content: string;\n}\n\nexport interface StructuredData {\n headings: Heading[];\n /**\n * Refer to paragraphs, a heading may contain multiple contents as well\n */\n contents: Content[];\n}\n\nexport interface StructureOptions {\n /**\n * Types to be scanned as content.\n *\n * @defaultValue ['heading', 'paragraph', 'blockquote', 'tableCell', 'mdxJsxFlowElement']\n */\n types?: string[] | ((node: Nodes) => boolean);\n\n /**\n * A list of indexable MDX attributes, either:\n *\n * - an array of attribute names.\n * - a function that determines if attribute should be indexed.\n */\n allowedMdxAttributes?:\n | string[]\n | ((\n node: MdxJsxFlowElement,\n attribute: MdxJsxAttribute | MdxJsxExpressionAttribute,\n ) => boolean);\n\n /**\n * export as `structuredData` or specified variable name.\n */\n exportAs?: string | boolean;\n}\n\ndeclare module 'mdast' {\n interface Data {\n /**\n * [Hanzo Docs] Get content of unserializable element, `remarkStructure` uses it to generate search index.\n */\n _string?: string[];\n }\n}\n\ndeclare module 'vfile' {\n interface DataMap {\n /**\n * [Hanzo Docs] injected by `remarkStructure`\n */\n structuredData: StructuredData;\n }\n}\n\nexport const remarkStructureDefaultOptions = {\n types: ['heading', 'paragraph', 'blockquote', 'tableCell', 'mdxJsxFlowElement'],\n allowedMdxAttributes: (node) => {\n if (!node.name) return false;\n\n return ['TypeTable', 'Callout'].includes(node.name);\n },\n exportAs: false,\n} satisfies Required<StructureOptions>;\n\n/**\n * Extract content into structured data.\n *\n * By default, the output is stored into VFile (`vfile.data.structuredData`), you can specify `exportAs` to export it.\n */\nexport function remarkStructure({\n types = remarkStructureDefaultOptions.types,\n allowedMdxAttributes = remarkStructureDefaultOptions.allowedMdxAttributes,\n exportAs = remarkStructureDefaultOptions.exportAs,\n}: StructureOptions = {}): Transformer<Root, Root> {\n const slugger = new Slugger();\n\n if (Array.isArray(allowedMdxAttributes)) {\n const arr = allowedMdxAttributes;\n allowedMdxAttributes = (_node, attribute) =>\n attribute.type === 'mdxJsxAttribute' && arr.includes(attribute.name);\n }\n\n if (Array.isArray(types)) {\n const arr = types;\n types = (node) => arr.includes(node.type);\n }\n\n return (tree, file) => {\n slugger.reset();\n const data: StructuredData = { contents: [], headings: [] };\n let lastHeading: string | undefined;\n\n // Hanzo Docs OpenAPI Generated Structured Data\n if (file.data.frontmatter) {\n const frontmatter = file.data.frontmatter as {\n _openapi?: {\n structuredData?: StructuredData;\n };\n };\n\n if (frontmatter._openapi?.structuredData) {\n data.headings.push(...frontmatter._openapi.structuredData.headings);\n data.contents.push(...frontmatter._openapi.structuredData.contents);\n }\n }\n\n visit(tree, (element) => {\n if (element.type === 'root' || !types(element)) return;\n\n if (element.type === 'heading') {\n element.data ||= {};\n element.data.hProperties ||= {};\n const properties = element.data.hProperties;\n const content = flattenNode(element).trim();\n const id = properties.id ?? slugger.slug(content);\n\n data.headings.push({\n id,\n content,\n });\n\n lastHeading = id;\n return 'skip';\n }\n\n if (element.data?._string) {\n for (const content of element.data._string) {\n data.contents.push({\n heading: lastHeading,\n content,\n });\n }\n\n return 'skip';\n }\n\n if (element.type === 'mdxJsxFlowElement' && element.name) {\n data.contents.push(\n ...element.attributes.flatMap((attribute) => {\n const value =\n typeof attribute.value === 'string' ? attribute.value : attribute.value?.value;\n if (!value || value.length === 0) return [];\n if (allowedMdxAttributes && !allowedMdxAttributes(element, attribute)) return [];\n\n return {\n heading: lastHeading,\n content: attribute.type === 'mdxJsxAttribute' ? `${attribute.name}: ${value}` : value,\n };\n }),\n );\n\n return;\n }\n\n const content = flattenNode(element).trim();\n if (content.length === 0) return;\n\n data.contents.push({\n heading: lastHeading,\n content,\n });\n\n return 'skip';\n });\n\n file.data.structuredData = data;\n if (exportAs) {\n tree.children.unshift(\n toMdxExport(typeof exportAs === 'string' ? exportAs : 'structuredData', data),\n );\n }\n };\n}\n\n/**\n * Extract data from markdown/mdx content\n */\nexport function structure(\n content: string,\n remarkPlugins: PluggableList = [],\n options: StructureOptions = {},\n): StructuredData {\n const result = remark()\n .use(remarkGfm)\n .use(remarkPlugins)\n .use(remarkStructure, options)\n .processSync(content);\n\n return result.data.structuredData!;\n}\n"],"mappings":";;;;;;;AA4EA,MAAa,gCAAgC;CAC3C,OAAO;EAAC;EAAW;EAAa;EAAc;EAAa;EAAoB;CAC/E,uBAAuB,SAAS;AAC9B,MAAI,CAAC,KAAK,KAAM,QAAO;AAEvB,SAAO,CAAC,aAAa,UAAU,CAAC,SAAS,KAAK,KAAK;;CAErD,UAAU;CACX;;;;;;AAOD,SAAgB,gBAAgB,EAC9B,QAAQ,8BAA8B,OACtC,uBAAuB,8BAA8B,sBACrD,WAAW,8BAA8B,aACrB,EAAE,EAA2B;CACjD,MAAM,UAAU,IAAI,SAAS;AAE7B,KAAI,MAAM,QAAQ,qBAAqB,EAAE;EACvC,MAAM,MAAM;AACZ,0BAAwB,OAAO,cAC7B,UAAU,SAAS,qBAAqB,IAAI,SAAS,UAAU,KAAK;;AAGxE,KAAI,MAAM,QAAQ,MAAM,EAAE;EACxB,MAAM,MAAM;AACZ,WAAS,SAAS,IAAI,SAAS,KAAK,KAAK;;AAG3C,SAAQ,MAAM,SAAS;AACrB,UAAQ,OAAO;EACf,MAAMA,OAAuB;GAAE,UAAU,EAAE;GAAE,UAAU,EAAE;GAAE;EAC3D,IAAIC;AAGJ,MAAI,KAAK,KAAK,aAAa;GACzB,MAAM,cAAc,KAAK,KAAK;AAM9B,OAAI,YAAY,UAAU,gBAAgB;AACxC,SAAK,SAAS,KAAK,GAAG,YAAY,SAAS,eAAe,SAAS;AACnE,SAAK,SAAS,KAAK,GAAG,YAAY,SAAS,eAAe,SAAS;;;AAIvE,QAAM,OAAO,YAAY;AACvB,OAAI,QAAQ,SAAS,UAAU,CAAC,MAAM,QAAQ,CAAE;AAEhD,OAAI,QAAQ,SAAS,WAAW;AAC9B,YAAQ,SAAS,EAAE;AACnB,YAAQ,KAAK,gBAAgB,EAAE;IAC/B,MAAM,aAAa,QAAQ,KAAK;IAChC,MAAMC,YAAU,YAAY,QAAQ,CAAC,MAAM;IAC3C,MAAM,KAAK,WAAW,MAAM,QAAQ,KAAKA,UAAQ;AAEjD,SAAK,SAAS,KAAK;KACjB;KACA;KACD,CAAC;AAEF,kBAAc;AACd,WAAO;;AAGT,OAAI,QAAQ,MAAM,SAAS;AACzB,SAAK,MAAMA,aAAW,QAAQ,KAAK,QACjC,MAAK,SAAS,KAAK;KACjB,SAAS;KACT;KACD,CAAC;AAGJ,WAAO;;AAGT,OAAI,QAAQ,SAAS,uBAAuB,QAAQ,MAAM;AACxD,SAAK,SAAS,KACZ,GAAG,QAAQ,WAAW,SAAS,cAAc;KAC3C,MAAM,QACJ,OAAO,UAAU,UAAU,WAAW,UAAU,QAAQ,UAAU,OAAO;AAC3E,SAAI,CAAC,SAAS,MAAM,WAAW,EAAG,QAAO,EAAE;AAC3C,SAAI,wBAAwB,CAAC,qBAAqB,SAAS,UAAU,CAAE,QAAO,EAAE;AAEhF,YAAO;MACL,SAAS;MACT,SAAS,UAAU,SAAS,oBAAoB,GAAG,UAAU,KAAK,IAAI,UAAU;MACjF;MACD,CACH;AAED;;GAGF,MAAM,UAAU,YAAY,QAAQ,CAAC,MAAM;AAC3C,OAAI,QAAQ,WAAW,EAAG;AAE1B,QAAK,SAAS,KAAK;IACjB,SAAS;IACT;IACD,CAAC;AAEF,UAAO;IACP;AAEF,OAAK,KAAK,iBAAiB;AAC3B,MAAI,SACF,MAAK,SAAS,QACZ,YAAY,OAAO,aAAa,WAAW,WAAW,kBAAkB,KAAK,CAC9E;;;;;;AAQP,SAAgB,UACd,SACA,gBAA+B,EAAE,EACjC,UAA4B,EAAE,EACd;AAOhB,QANe,QAAQ,CACpB,IAAI,UAAU,CACd,IAAI,cAAc,CAClB,IAAI,iBAAiB,QAAQ,CAC7B,YAAY,QAAQ,CAET,KAAK"}
|
|
@@ -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
|
*/
|
|
@@ -13,4 +13,4 @@ function normalizeUrl(url) {
|
|
|
13
13
|
|
|
14
14
|
//#endregion
|
|
15
15
|
export { normalizeUrl as t };
|
|
16
|
-
//# sourceMappingURL=normalize-url-
|
|
16
|
+
//# sourceMappingURL=normalize-url-ChLsV26G.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-url-ChLsV26G.js","names":[],"sources":["../src/utils/normalize-url.tsx"],"sourcesContent":["/**\n * normalize URL into the Hanzo Docs standard form (`/slug-1/slug-2`).\n *\n * This includes URLs with trailing slashes.\n */\nexport function normalizeUrl(url: string) {\n if (url.startsWith('http://') || url.startsWith('https://')) return url;\n\n if (!url.startsWith('/')) url = '/' + url;\n if (url.length > 1 && url.endsWith('/')) url = url.slice(0, -1);\n return url;\n}\n"],"mappings":";;;;;;AAKA,SAAgB,aAAa,KAAa;AACxC,KAAI,IAAI,WAAW,UAAU,IAAI,IAAI,WAAW,WAAW,CAAE,QAAO;AAEpE,KAAI,CAAC,IAAI,WAAW,IAAI,CAAE,OAAM,MAAM;AACtC,KAAI,IAAI,SAAS,KAAK,IAAI,SAAS,IAAI,CAAE,OAAM,IAAI,MAAM,GAAG,GAAG;AAC/D,QAAO"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as createContentHighlighter } from "./search-
|
|
2
|
-
import { t as removeUndefined } from "./remove-undefined-
|
|
1
|
+
import { t as createContentHighlighter } from "./search-D6ChCLhY.js";
|
|
2
|
+
import { t as removeUndefined } from "./remove-undefined-Cfs4o_mM.js";
|
|
3
3
|
|
|
4
4
|
//#region src/search/client/orama-cloud.ts
|
|
5
5
|
async function searchDocs(query, options) {
|
|
@@ -81,4 +81,4 @@ async function searchDocs(query, options) {
|
|
|
81
81
|
|
|
82
82
|
//#endregion
|
|
83
83
|
export { searchDocs };
|
|
84
|
-
//# sourceMappingURL=orama-cloud-
|
|
84
|
+
//# sourceMappingURL=orama-cloud-DH3g37zc.js.map
|