@mintlify/msft-sdk 1.1.8 → 1.1.10
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/dist/components/Api/Api.js +42 -0
- package/dist/components/Api/Api.js.map +1 -0
- package/dist/components/Api/Api.module.css.js +22 -0
- package/dist/components/Api/Api.module.css.js.map +1 -0
- package/dist/components/Api/ApiReferenceProvider.js +19 -0
- package/dist/components/Api/ApiReferenceProvider.js.map +1 -0
- package/dist/components/Api/MethodPill.js +21 -0
- package/dist/components/Api/MethodPill.js.map +1 -0
- package/dist/components/Api/colors.js +117 -0
- package/dist/components/Api/colors.js.map +1 -0
- package/dist/components/content-components/code-block.js +94 -66
- package/dist/components/content-components/code-block.js.map +1 -1
- package/dist/components/content-components/default-components.js +8 -8
- package/dist/components/content-components/default-components.js.map +1 -1
- package/dist/components/content-components/details/details.js +1 -1
- package/dist/components/content-components/details/details.js.map +1 -1
- package/dist/components/content-components/home.js +14 -14
- package/dist/components/content-components/home.js.map +1 -1
- package/dist/components/content-components/param-name.js +1 -1
- package/dist/components/content-components/param-name.js.map +1 -1
- package/dist/components/content-components/table/index.js +1 -1
- package/dist/components/content-components/table/table-modal.js.map +1 -1
- package/dist/components/content-components/tabs/tab.js.map +1 -1
- package/dist/components/content-components/tabs/tabs.js +26 -22
- package/dist/components/content-components/tabs/tabs.js.map +1 -1
- package/dist/components/nav-tree/dropdown-menu.js +1 -1
- package/dist/components/nav-tree/dropdown-menu.js.map +1 -1
- package/dist/components/nav-tree/index.js +157 -90
- package/dist/components/nav-tree/index.js.map +1 -1
- package/dist/components/nav-tree/mobile-nav.js +2 -2
- package/dist/components/nav-tree/mobile-nav.js.map +1 -1
- package/dist/components/page-context-menu.js +72 -78
- package/dist/components/page-context-menu.js.map +1 -1
- package/dist/components/page.js +120 -0
- package/dist/components/page.js.map +1 -0
- package/dist/components/plain-text-page.js.map +1 -1
- package/dist/components/toc/index.js +8 -8
- package/dist/components/toc/index.js.map +1 -1
- package/dist/index.d.ts +238 -186
- package/dist/index.js +118 -36
- package/dist/index.js.map +1 -1
- package/dist/parser/convert-html-to-mdx.js +7 -6
- package/dist/parser/convert-html-to-mdx.js.map +1 -1
- package/dist/plugins/extract-headings.js +28 -0
- package/dist/plugins/extract-headings.js.map +1 -0
- package/dist/plugins/sanitize/rehype-unwrap-image-links.js +12 -0
- package/dist/plugins/sanitize/rehype-unwrap-image-links.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/utils/cn.js +5 -5
- package/dist/utils/cn.js.map +1 -1
- package/package.json +21 -2
- package/dist/components/docsLayout.js +0 -62
- package/dist/components/docsLayout.js.map +0 -1
- package/dist/components/docsPage.js +0 -133
- package/dist/components/docsPage.js.map +0 -1
- package/dist/node_modules/.pnpm/tailwind-merge@3.3.1/node_modules/tailwind-merge/dist/bundle-mjs.js +0 -2732
- package/dist/node_modules/.pnpm/tailwind-merge@3.3.1/node_modules/tailwind-merge/dist/bundle-mjs.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,39 +1,121 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
1
|
+
import { DocsPage as r } from "./components/page.js";
|
|
2
|
+
import { MDXRenderer as m } from "./components/mdx-renderer.js";
|
|
3
|
+
import { PlainTextPage as a } from "./components/plain-text-page.js";
|
|
4
|
+
import { createDefaultComponents as f, defaultComponents as l } from "./components/content-components/default-components.js";
|
|
5
|
+
import { ComponentsProvider as s, useComponents as d } from "./context/components-context.js";
|
|
6
|
+
import { NavTree as T } from "./components/nav-tree/index.js";
|
|
7
|
+
import { Api as b } from "./components/Api/Api.js";
|
|
8
|
+
import { ApiReferenceProvider2 as P, useApiReference as H } from "./components/Api/ApiReferenceProvider.js";
|
|
9
|
+
import { TableOfContents as y } from "./components/toc/index.js";
|
|
10
|
+
import { PivotAwareTOC as u } from "./components/toc/pivot-aware-toc.js";
|
|
11
|
+
import { PageContextMenu as M } from "./components/page-context-menu.js";
|
|
12
|
+
import { copyMarkdownToClipboard as w, getPageMarkdown as R, useMarkdownCopy as D } from "./hooks/useMarkdownCopy.js";
|
|
13
|
+
import { generateLlmsFullTxt as Z, generateLlmsTxt as A } from "./utils/generate-llms-txt.js";
|
|
14
|
+
import { getNodeText as F } from "./utils/get-node-text.js";
|
|
15
|
+
import { capitalize as B } from "./utils/string.js";
|
|
16
|
+
import { cn as I } from "./utils/cn.js";
|
|
17
|
+
import { getClassNames as S, getTextContent as J, isElement as X } from "./utils/rehype.js";
|
|
18
|
+
import { convertHtmlToMdx as q } from "./parser/convert-html-to-mdx.js";
|
|
19
|
+
import { serializeMdx as K } from "./parser/serialize-mdx.js";
|
|
20
|
+
import { extractHeadings as U } from "./plugins/extract-headings.js";
|
|
21
|
+
import { rehypeRemoveHtmlComments as W, removeHtmlComments as Y } from "./plugins/sanitize/remove-html-comments.js";
|
|
22
|
+
import { CodeBlock as $ } from "./components/content-components/code-block.js";
|
|
23
|
+
import { Heading as oe } from "./components/content-components/heading.js";
|
|
24
|
+
import { Link as te } from "./components/content-components/link.js";
|
|
25
|
+
import { Callout as pe } from "./components/content-components/callouts.js";
|
|
26
|
+
import { ZonePivot as xe } from "./components/content-components/zone-pivots/zone-pivot.js";
|
|
27
|
+
import { ZoneTarget as le } from "./components/content-components/zone-pivots/zone-target.js";
|
|
28
|
+
import { ZonePivotProvider as se } from "./components/content-components/zone-pivots/zone-pivot-context.js";
|
|
29
|
+
import { ZonePivotSelector as ie } from "./components/content-components/zone-pivots/zone-pivot-selector.js";
|
|
30
|
+
import { ParamName as Ce } from "./components/content-components/param-name.js";
|
|
31
|
+
import { Tabs as ge } from "./components/content-components/tabs/tabs.js";
|
|
32
|
+
import { Tab as He } from "./components/content-components/tabs/tab.js";
|
|
33
|
+
import { Details as ye, Summary as ce } from "./components/content-components/details/details.js";
|
|
34
|
+
import { Table as he, TableBody as Me, TableCaption as ke, TableCell as we, TableFooter as Re, TableHead as De, TableHeader as Ne, TableRow as Ze } from "./components/content-components/table/index.js";
|
|
35
|
+
import { allComponents as ze } from "./components/content-components/all-components.js";
|
|
36
|
+
import { Home as Le } from "./components/content-components/home.js";
|
|
37
|
+
import { DropdownMenu as Ee } from "./components/nav-tree/dropdown-menu.js";
|
|
38
|
+
import { MobileNavTree as Oe } from "./components/nav-tree/mobile-nav.js";
|
|
39
|
+
import { rehypeCodeblocks as Je } from "./plugins/rehype/rehype-code-blocks.js";
|
|
40
|
+
import { remarkHeadingIds as je } from "./plugins/remark/remark-heading-ids.js";
|
|
41
|
+
import { sanitizePreTags as Ge } from "./plugins/sanitize/rehype-pre-to-mdx-fence.js";
|
|
42
|
+
import { rehypeCallouts as Qe } from "./plugins/sanitize/rehype-callouts.js";
|
|
43
|
+
import { rehypeParamName as Ve } from "./plugins/sanitize/rehype-param-name.js";
|
|
44
|
+
import { rehypeTabs as Ye } from "./plugins/sanitize/rehype-tabs.js";
|
|
45
|
+
import { rehypeDetails as $e } from "./plugins/sanitize/rehype-details.js";
|
|
46
|
+
import { rehypeHeadingIds as oo } from "./plugins/sanitize/rehype-heading-ids.js";
|
|
47
|
+
import { rehypeZonePivots as to } from "./plugins/sanitize/rehype-zone-pivots.js";
|
|
48
|
+
import { mdxJsxFlowElementHandler as po, rehypeRemark as ao } from "./plugins/sanitize/rehype-remark.js";
|
|
49
|
+
import { tableCellHandler as fo, tableHandler as lo, tableRowHandler as no } from "./plugins/sanitize/rehype-table-align.js";
|
|
18
50
|
export {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
51
|
+
b as Api,
|
|
52
|
+
P as ApiReferenceProvider2,
|
|
53
|
+
pe as Callout,
|
|
54
|
+
$ as CodeBlock,
|
|
55
|
+
s as ComponentsProvider,
|
|
56
|
+
ye as Details,
|
|
57
|
+
r as DocsPage,
|
|
58
|
+
Ee as DropdownMenu,
|
|
59
|
+
oe as Heading,
|
|
60
|
+
Le as Home,
|
|
61
|
+
te as Link,
|
|
62
|
+
m as MDXRenderer,
|
|
63
|
+
Oe as MobileNavTree,
|
|
64
|
+
T as NavTree,
|
|
65
|
+
M as PageContextMenu,
|
|
66
|
+
Ce as ParamName,
|
|
67
|
+
u as PivotAwareTOC,
|
|
68
|
+
a as PlainTextPage,
|
|
69
|
+
ce as Summary,
|
|
70
|
+
He as Tab,
|
|
71
|
+
he as Table,
|
|
72
|
+
Me as TableBody,
|
|
73
|
+
ke as TableCaption,
|
|
74
|
+
we as TableCell,
|
|
75
|
+
Re as TableFooter,
|
|
76
|
+
De as TableHead,
|
|
77
|
+
Ne as TableHeader,
|
|
78
|
+
y as TableOfContents,
|
|
79
|
+
Ze as TableRow,
|
|
80
|
+
ge as Tabs,
|
|
81
|
+
xe as ZonePivot,
|
|
82
|
+
se as ZonePivotProvider,
|
|
83
|
+
ie as ZonePivotSelector,
|
|
84
|
+
le as ZoneTarget,
|
|
85
|
+
ze as allComponents,
|
|
86
|
+
B as capitalize,
|
|
87
|
+
I as cn,
|
|
88
|
+
q as convertHtmlToMdx,
|
|
89
|
+
w as copyMarkdownToClipboard,
|
|
90
|
+
f as createDefaultComponents,
|
|
91
|
+
l as defaultComponents,
|
|
92
|
+
U as extractHeadings,
|
|
93
|
+
Z as generateLlmsFullTxt,
|
|
94
|
+
A as generateLlmsTxt,
|
|
95
|
+
S as getClassNames,
|
|
96
|
+
F as getNodeText,
|
|
97
|
+
R as getPageMarkdown,
|
|
98
|
+
J as getTextContent,
|
|
99
|
+
X as isElement,
|
|
100
|
+
po as mdxJsxFlowElementHandler,
|
|
101
|
+
Qe as rehypeCallouts,
|
|
102
|
+
Je as rehypeCodeblocks,
|
|
103
|
+
$e as rehypeDetails,
|
|
104
|
+
oo as rehypeHeadingIds,
|
|
105
|
+
Ve as rehypeParamName,
|
|
106
|
+
ao as rehypeRemark,
|
|
107
|
+
W as rehypeRemoveHtmlComments,
|
|
108
|
+
Ye as rehypeTabs,
|
|
109
|
+
to as rehypeZonePivots,
|
|
110
|
+
je as remarkHeadingIds,
|
|
111
|
+
Y as removeHtmlComments,
|
|
112
|
+
Ge as sanitizePreTags,
|
|
113
|
+
K as serializeMdx,
|
|
114
|
+
fo as tableCellHandler,
|
|
115
|
+
lo as tableHandler,
|
|
116
|
+
no as tableRowHandler,
|
|
117
|
+
H as useApiReference,
|
|
118
|
+
d as useComponents,
|
|
119
|
+
D as useMarkdownCopy
|
|
38
120
|
};
|
|
39
121
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { unified as
|
|
1
|
+
import { unified as t } from "unified";
|
|
2
2
|
import p from "rehype-parse";
|
|
3
3
|
import i from "remark-mdx";
|
|
4
4
|
import a from "remark-gfm";
|
|
@@ -10,16 +10,17 @@ import { rehypeParamName as y } from "../plugins/sanitize/rehype-param-name.js";
|
|
|
10
10
|
import { rehypeTabs as h } from "../plugins/sanitize/rehype-tabs.js";
|
|
11
11
|
import { rehypeDetails as d } from "../plugins/sanitize/rehype-details.js";
|
|
12
12
|
import { rehypeHeadingIds as x } from "../plugins/sanitize/rehype-heading-ids.js";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
13
|
+
import { rehypeUnwrapImageLinks as l } from "../plugins/sanitize/rehype-unwrap-image-links.js";
|
|
14
|
+
import { rehypeImageUrls as g } from "../plugins/sanitize/rehype-image-urls.js";
|
|
15
|
+
import { rehypeZonePivots as k } from "../plugins/sanitize/rehype-zone-pivots.js";
|
|
16
|
+
import { rehypeRemark as v } from "../plugins/sanitize/rehype-remark.js";
|
|
16
17
|
async function O(m, r = {}) {
|
|
17
18
|
const e = r.mdxExtracts || {}, o = {
|
|
18
19
|
...r,
|
|
19
20
|
mdxExtracts: e
|
|
20
|
-
},
|
|
21
|
+
}, s = await t().use(p).use(u).use(n).use(c).use(y).use(h).use(d).use(x).use(l).use(g, o).use(k, o).use(v).use(a).use(i).use(f).process(m);
|
|
21
22
|
return {
|
|
22
|
-
mdx: String(
|
|
23
|
+
mdx: String(s),
|
|
23
24
|
mdxExtracts: e
|
|
24
25
|
};
|
|
25
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert-html-to-mdx.js","sources":["../../src/parser/convert-html-to-mdx.ts"],"sourcesContent":["import { unified } from \"unified\";\nimport rehypeParse from \"rehype-parse\";\nimport remarkMdx from \"remark-mdx\";\nimport remarkGfm from \"remark-gfm\";\nimport remarkStringify from \"remark-stringify\";\nimport type { ConvertOptions, MdxExtracts } from \"../types\";\nimport {\n sanitizePreTags,\n rehypeCallouts,\n rehypeParamName,\n rehypeTabs,\n rehypeDetails,\n rehypeHeadingIds,\n rehypeZonePivots,\n rehypeRemark,\n rehypeImageUrls,\n} from \"../plugins\";\nimport { rehypeRemoveHtmlComments } from \"../plugins/sanitize/remove-html-comments\";\n\nexport async function convertHtmlToMdx(\n html: string,\n options: ConvertOptions = {}\n): Promise<{ mdx: string; mdxExtracts: MdxExtracts }> {\n const mdxExtracts: MdxExtracts = options.mdxExtracts || {};\n\n const convertOptions: ConvertOptions = {\n ...options,\n mdxExtracts,\n };\n\n const processor = unified()\n .use(rehypeParse)\n .use(rehypeRemoveHtmlComments)\n .use(sanitizePreTags)\n .use(rehypeCallouts)\n .use(rehypeParamName)\n .use(rehypeTabs)\n .use(rehypeDetails)\n .use(rehypeHeadingIds)\n .use(rehypeImageUrls, convertOptions)\n .use(rehypeZonePivots, convertOptions)\n .use(rehypeRemark)\n .use(remarkGfm)\n .use(remarkMdx)\n .use(remarkStringify);\n\n const result = await processor.process(html);\n\n return {\n mdx: String(result),\n mdxExtracts,\n };\n}\n"],"names":["convertHtmlToMdx","html","options","mdxExtracts","convertOptions","result","unified","rehypeParse","rehypeRemoveHtmlComments","sanitizePreTags","rehypeCallouts","rehypeParamName","rehypeTabs","rehypeDetails","rehypeHeadingIds","rehypeImageUrls","rehypeZonePivots","rehypeRemark","remarkGfm","remarkMdx","remarkStringify"],"mappings":"
|
|
1
|
+
{"version":3,"file":"convert-html-to-mdx.js","sources":["../../src/parser/convert-html-to-mdx.ts"],"sourcesContent":["import { unified } from \"unified\";\nimport rehypeParse from \"rehype-parse\";\nimport remarkMdx from \"remark-mdx\";\nimport remarkGfm from \"remark-gfm\";\nimport remarkStringify from \"remark-stringify\";\nimport type { ConvertOptions, MdxExtracts } from \"../types\";\nimport {\n sanitizePreTags,\n rehypeCallouts,\n rehypeParamName,\n rehypeTabs,\n rehypeDetails,\n rehypeHeadingIds,\n rehypeZonePivots,\n rehypeRemark,\n rehypeImageUrls,\n rehypeUnwrapImageLinks,\n} from \"../plugins\";\nimport { rehypeRemoveHtmlComments } from \"../plugins/sanitize/remove-html-comments\";\n\nexport async function convertHtmlToMdx(\n html: string,\n options: ConvertOptions = {}\n): Promise<{ mdx: string; mdxExtracts: MdxExtracts }> {\n const mdxExtracts: MdxExtracts = options.mdxExtracts || {};\n\n const convertOptions: ConvertOptions = {\n ...options,\n mdxExtracts,\n };\n\n const processor = unified()\n .use(rehypeParse)\n .use(rehypeRemoveHtmlComments)\n .use(sanitizePreTags)\n .use(rehypeCallouts)\n .use(rehypeParamName)\n .use(rehypeTabs)\n .use(rehypeDetails)\n .use(rehypeHeadingIds)\n .use(rehypeUnwrapImageLinks)\n .use(rehypeImageUrls, convertOptions)\n .use(rehypeZonePivots, convertOptions)\n .use(rehypeRemark)\n .use(remarkGfm)\n .use(remarkMdx)\n .use(remarkStringify);\n\n const result = await processor.process(html);\n\n return {\n mdx: String(result),\n mdxExtracts,\n };\n}\n"],"names":["convertHtmlToMdx","html","options","mdxExtracts","convertOptions","result","unified","rehypeParse","rehypeRemoveHtmlComments","sanitizePreTags","rehypeCallouts","rehypeParamName","rehypeTabs","rehypeDetails","rehypeHeadingIds","rehypeUnwrapImageLinks","rehypeImageUrls","rehypeZonePivots","rehypeRemark","remarkGfm","remarkMdx","remarkStringify"],"mappings":";;;;;;;;;;;;;;;;AAoBA,eAAsBA,EACpBC,GACAC,IAA0B,IAC0B;AACpD,QAAMC,IAA2BD,EAAQ,eAAe,CAAA,GAElDE,IAAiC;AAAA,IACrC,GAAGF;AAAA,IACH,aAAAC;AAAA,EAAA,GAoBIE,IAAS,MAjBGC,IACf,IAAIC,CAAW,EACf,IAAIC,CAAwB,EAC5B,IAAIC,CAAe,EACnB,IAAIC,CAAc,EAClB,IAAIC,CAAe,EACnB,IAAIC,CAAU,EACd,IAAIC,CAAa,EACjB,IAAIC,CAAgB,EACpB,IAAIC,CAAsB,EAC1B,IAAIC,GAAiBZ,CAAc,EACnC,IAAIa,GAAkBb,CAAc,EACpC,IAAIc,CAAY,EAChB,IAAIC,CAAS,EACb,IAAIC,CAAS,EACb,IAAIC,CAAe,EAES,QAAQpB,CAAI;AAE3C,SAAO;AAAA,IACL,KAAK,OAAOI,CAAM;AAAA,IAClB,aAAAF;AAAA,EAAA;AAEJ;"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { visit as a } from "unist-util-visit";
|
|
2
|
+
import o from "@sindresorhus/slugify";
|
|
3
|
+
function l(e) {
|
|
4
|
+
return e.children.filter((t) => t.type === "text").map((t) => t.value).join("").replace(/\s*\([^)]*\)\s*/g, " ").trim();
|
|
5
|
+
}
|
|
6
|
+
function g() {
|
|
7
|
+
return (e, n) => {
|
|
8
|
+
const i = [];
|
|
9
|
+
a(e, "heading", (t) => {
|
|
10
|
+
const r = t.depth;
|
|
11
|
+
if (r >= 2 && r <= 3) {
|
|
12
|
+
const c = l(t), s = o(c.replace(/\./g, "-"));
|
|
13
|
+
i.push({
|
|
14
|
+
title: c,
|
|
15
|
+
slug: s,
|
|
16
|
+
level: r
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}), n.data = {
|
|
20
|
+
...n.data,
|
|
21
|
+
headings: i
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
g as extractHeadings
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=extract-headings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract-headings.js","sources":["../../src/plugins/extract-headings.ts"],"sourcesContent":["import { visit } from \"unist-util-visit\";\nimport type { Node } from \"unist\";\nimport type { TocItem } from \"../types\";\nimport slugify from \"@sindresorhus/slugify\";\n\nfunction getHeadingText(node: Record<string, unknown>): string {\n const children = node.children as Array<Record<string, unknown>>;\n const text = children\n .filter((child) => child.type === \"text\")\n .map((child) => child.value as string)\n .join(\"\");\n\n return text.replace(/\\s*\\([^)]*\\)\\s*/g, \" \").trim();\n}\n\nexport function extractHeadings() {\n return (tree: Node, file: unknown) => {\n const headings: TocItem[] = [];\n\n visit(tree, \"heading\", (node: Record<string, unknown>) => {\n const depth = node.depth as number;\n if (depth >= 2 && depth <= 3) {\n const text = getHeadingText(node);\n const slug = slugify(text.replace(/\\./g, '-'));\n\n headings.push({\n title: text,\n slug,\n level: depth,\n });\n }\n });\n\n (file as Record<string, unknown>).data = {\n ...((file as Record<string, unknown>).data as Record<string, unknown>),\n headings,\n };\n };\n}\n"],"names":["getHeadingText","node","child","extractHeadings","tree","file","headings","visit","depth","text","slug","slugify"],"mappings":";;AAKA,SAASA,EAAeC,GAAuC;AAO7D,SANiBA,EAAK,SAEnB,OAAO,CAACC,MAAUA,EAAM,SAAS,MAAM,EACvC,IAAI,CAACA,MAAUA,EAAM,KAAe,EACpC,KAAK,EAAE,EAEE,QAAQ,oBAAoB,GAAG,EAAE,KAAA;AAC/C;AAEO,SAASC,IAAkB;AAChC,SAAO,CAACC,GAAYC,MAAkB;AACpC,UAAMC,IAAsB,CAAA;AAE5B,IAAAC,EAAMH,GAAM,WAAW,CAACH,MAAkC;AACxD,YAAMO,IAAQP,EAAK;AACnB,UAAIO,KAAS,KAAKA,KAAS,GAAG;AAC5B,cAAMC,IAAOT,EAAeC,CAAI,GAC1BS,IAAOC,EAAQF,EAAK,QAAQ,OAAO,GAAG,CAAC;AAE7C,QAAAH,EAAS,KAAK;AAAA,UACZ,OAAOG;AAAA,UACP,MAAAC;AAAA,UACA,OAAOF;AAAA,QAAA,CACR;AAAA,MACH;AAAA,IACF,CAAC,GAEAH,EAAiC,OAAO;AAAA,MACvC,GAAKA,EAAiC;AAAA,MACtC,UAAAC;AAAA,IAAA;AAAA,EAEJ;AACF;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { visit as l, SKIP as m } from "unist-util-visit";
|
|
2
|
+
import { isElement as t } from "../../utils/rehype.js";
|
|
3
|
+
const f = () => (h) => {
|
|
4
|
+
l(h, (r, e, i) => {
|
|
5
|
+
if (!(!t(r) || r.tagName !== "a") && !(!i || !("children" in i) || !Array.isArray(i.children)) && r.children && r.children.length === 1 && t(r.children[0]) && r.children[0].tagName === "img" && typeof e == "number")
|
|
6
|
+
return i.children[e] = r.children[0], [m, e];
|
|
7
|
+
});
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
f as rehypeUnwrapImageLinks
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=rehype-unwrap-image-links.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rehype-unwrap-image-links.js","sources":["../../../src/plugins/sanitize/rehype-unwrap-image-links.ts"],"sourcesContent":["import { visit, SKIP } from \"unist-util-visit\";\nimport type { Plugin } from \"unified\";\nimport type { Node, Parent } from \"hast\";\nimport { isElement } from \"../../utils/rehype\";\n\nexport const rehypeUnwrapImageLinks: Plugin<[], Node> = () => {\n return (tree: Node) => {\n visit(tree, (node, index, parent) => {\n if (!isElement(node) || node.tagName !== \"a\") {\n return;\n }\n\n if (!parent || !(\"children\" in parent) || !Array.isArray((parent as Parent).children)) {\n return;\n }\n\n if (\n node.children &&\n node.children.length === 1 &&\n isElement(node.children[0]) &&\n node.children[0].tagName === \"img\"\n ) {\n if (typeof index === \"number\") {\n (parent as Parent).children[index] = node.children[0];\n return [SKIP, index];\n }\n }\n });\n };\n};\n"],"names":["rehypeUnwrapImageLinks","tree","visit","node","index","parent","isElement","SKIP"],"mappings":";;AAKO,MAAMA,IAA2C,MAC/C,CAACC,MAAe;AACrB,EAAAC,EAAMD,GAAM,CAACE,GAAMC,GAAOC,MAAW;AACnC,QAAI,GAACC,EAAUH,CAAI,KAAKA,EAAK,YAAY,QAIrC,GAACE,KAAU,EAAE,cAAcA,MAAW,CAAC,MAAM,QAASA,EAAkB,QAAQ,MAKlFF,EAAK,YACLA,EAAK,SAAS,WAAW,KACzBG,EAAUH,EAAK,SAAS,CAAC,CAAC,KAC1BA,EAAK,SAAS,CAAC,EAAE,YAAY,SAEzB,OAAOC,KAAU;AAClB,aAAAC,EAAkB,SAASD,CAAK,IAAID,EAAK,SAAS,CAAC,GAC7C,CAACI,GAAMH,CAAK;AAAA,EAGzB,CAAC;AACH;"}
|