@mintlify/msft-sdk 1.1.11 → 1.1.14
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/content-components/code-block.js +2 -2
- package/dist/components/content-components/code-block.js.map +1 -1
- package/dist/components/content-components/default-components.js +4 -4
- package/dist/components/content-components/default-components.js.map +1 -1
- package/dist/components/content-components/home.js +3 -278
- package/dist/components/content-components/home.js.map +1 -1
- package/dist/components/content-components/zone-pivots/zone-pivot-selector.js +22 -19
- package/dist/components/content-components/zone-pivots/zone-pivot-selector.js.map +1 -1
- package/dist/components/docsLayout.js +60 -0
- package/dist/components/docsLayout.js.map +1 -0
- package/dist/components/docsPage.js +128 -0
- package/dist/components/docsPage.js.map +1 -0
- package/dist/components/nav-tree/index.js +123 -100
- package/dist/components/nav-tree/index.js.map +1 -1
- package/dist/components/page-context-menu.js +47 -53
- package/dist/components/page-context-menu.js.map +1 -1
- package/dist/components/toc/index.js +6 -6
- package/dist/components/toc/index.js.map +1 -1
- package/dist/index.d.ts +180 -2
- package/dist/index.js +114 -112
- package/dist/index.js.map +1 -1
- package/dist/parser/serialize-mdx.js +27 -22
- package/dist/parser/serialize-mdx.js.map +1 -1
- package/dist/plugins/extract-headings.js +23 -17
- package/dist/plugins/extract-headings.js.map +1 -1
- package/dist/plugins/remark/remark-heading-ids.js +21 -14
- package/dist/plugins/remark/remark-heading-ids.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/components/page.js +0 -118
- package/dist/components/page.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { Node as Node_2 } from 'unist';
|
|
|
8
8
|
import { Node as Node_3 } from 'hast';
|
|
9
9
|
import { Plugin as Plugin_2 } from 'unified';
|
|
10
10
|
import * as React_2 from 'react';
|
|
11
|
+
import { ReactNode } from 'react';
|
|
11
12
|
import { Root } from 'mdast';
|
|
12
13
|
import { Root as Root_2 } from 'hast';
|
|
13
14
|
import { State } from 'hast-util-to-mdast';
|
|
@@ -83,6 +84,14 @@ export declare function ComponentsProvider({ children, LinkComponent, }: {
|
|
|
83
84
|
LinkComponent?: LinkComponent;
|
|
84
85
|
}): JSX_2.Element;
|
|
85
86
|
|
|
87
|
+
declare type ContextualOption = {
|
|
88
|
+
id: string;
|
|
89
|
+
title: string;
|
|
90
|
+
description: string;
|
|
91
|
+
icon: default_2.ElementType;
|
|
92
|
+
action: () => void;
|
|
93
|
+
};
|
|
94
|
+
|
|
86
95
|
export declare function convertHtmlToMdx(html: string, options?: ConvertOptions): Promise<{
|
|
87
96
|
mdx: string;
|
|
88
97
|
mdxExtracts: MdxExtracts;
|
|
@@ -119,7 +128,123 @@ declare interface DetailsProps {
|
|
|
119
128
|
open?: boolean;
|
|
120
129
|
}
|
|
121
130
|
|
|
122
|
-
|
|
131
|
+
/**
|
|
132
|
+
* DocsLayout component provides a complete documentation layout with sidebar navigation
|
|
133
|
+
* and main content area. It's designed to be scalable, customizable, and tree-shakable.
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```tsx
|
|
137
|
+
* <DocsLayout
|
|
138
|
+
* navTree={{ items: [...] }}
|
|
139
|
+
* activeHref="/docs/getting-started"
|
|
140
|
+
* theme="dark"
|
|
141
|
+
* bottomLinks={[
|
|
142
|
+
* { href: "https://blog.com", label: "Blog", icon: BlogIcon }
|
|
143
|
+
* ]}
|
|
144
|
+
* LinkComponent={Link}
|
|
145
|
+
* >
|
|
146
|
+
* <YourPageContent />
|
|
147
|
+
* </DocsLayout>
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
export declare const DocsLayout: ({ navTree, children, activeHref, activeId, theme, className, bottomLinks, LinkComponent, localization, telemetry, showSidebar, sidebarClassName, }: DocsLayoutProps) => JSX_2.Element;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Localization strings for DocsLayout
|
|
154
|
+
*/
|
|
155
|
+
export declare interface DocsLayoutLocalization {
|
|
156
|
+
/** Aria label for the sidebar navigation. Default: "Sidebar navigation" */
|
|
157
|
+
sidebarAriaLabel?: string;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Props for the DocsLayout component
|
|
162
|
+
*/
|
|
163
|
+
export declare interface DocsLayoutProps {
|
|
164
|
+
/** Navigation tree data structure */
|
|
165
|
+
navTree: NavTreeData;
|
|
166
|
+
/** The main content to render in the layout */
|
|
167
|
+
children: ReactNode;
|
|
168
|
+
/** Currently active href for navigation highlighting */
|
|
169
|
+
activeHref?: string;
|
|
170
|
+
/** Currently active ID for navigation highlighting */
|
|
171
|
+
activeId?: string;
|
|
172
|
+
/** Theme for the layout */
|
|
173
|
+
theme?: "light" | "dark";
|
|
174
|
+
/** Additional CSS classes for the outer container */
|
|
175
|
+
className?: string;
|
|
176
|
+
/** Bottom links configuration (e.g., blog, GitHub, feedback) */
|
|
177
|
+
bottomLinks?: BottomLinkConfig[];
|
|
178
|
+
/** Custom Link component for navigation (e.g., React Router Link, Next.js Link) */
|
|
179
|
+
LinkComponent?: LinkComponent;
|
|
180
|
+
/** Localization strings */
|
|
181
|
+
localization?: DocsLayoutLocalization;
|
|
182
|
+
/** Telemetry configuration */
|
|
183
|
+
telemetry?: DocsLayoutTelemetry;
|
|
184
|
+
/** Whether to show the sidebar. Default: true */
|
|
185
|
+
showSidebar?: boolean;
|
|
186
|
+
/** Custom className for the sidebar to control responsive behavior.
|
|
187
|
+
* Default: "mint:max-lg:hidden" (hidden below lg breakpoint) */
|
|
188
|
+
sidebarClassName?: string;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Telemetry configuration for DocsLayout
|
|
193
|
+
*/
|
|
194
|
+
export declare interface DocsLayoutTelemetry {
|
|
195
|
+
/** Activity name for bottom link clicks */
|
|
196
|
+
bottomLinkActivity?: string;
|
|
197
|
+
/** Phase for bottom link clicks (e.g., "Start", "Complete") */
|
|
198
|
+
bottomLinkPhase?: string;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* DocsPage component renders a documentation page with MDX content, table of contents,
|
|
203
|
+
* zone pivot selectors, and page context menu. It supports full customization through
|
|
204
|
+
* props for localization, telemetry, and custom components.
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* ```tsx
|
|
208
|
+
* <DocsPage
|
|
209
|
+
* payload={{
|
|
210
|
+
* content: "...",
|
|
211
|
+
* serializedContent: Content,
|
|
212
|
+
* title: "Getting Started",
|
|
213
|
+
* description: "Learn how to get started"
|
|
214
|
+
* }}
|
|
215
|
+
* toc={[{ title: "Introduction", slug: "intro", level: 2 }]}
|
|
216
|
+
* theme="dark"
|
|
217
|
+
* pathname="/docs/getting-started"
|
|
218
|
+
* LinkComponent={Link}
|
|
219
|
+
* localization={{
|
|
220
|
+
* onThisPage: "In this article"
|
|
221
|
+
* }}
|
|
222
|
+
* telemetry={{
|
|
223
|
+
* contextMenuActivity: "DocsPageContextMenu",
|
|
224
|
+
* contextMenuPhase: "Start"
|
|
225
|
+
* }}
|
|
226
|
+
* />
|
|
227
|
+
* ```
|
|
228
|
+
*/
|
|
229
|
+
export declare function DocsPage({ payload, toc, navTree, activeHref, theme, className, pathname, markdownContent, allPages, baseUrl, bottomLinks, LinkComponent, localization, telemetry, contextMenu, }: DocsPagePropsWithCustomization): JSX_2.Element;
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Localization strings for DocsPage component
|
|
233
|
+
*/
|
|
234
|
+
export declare interface DocsPageLocalization {
|
|
235
|
+
/** Text for "On this page" heading. Default: "On this page" */
|
|
236
|
+
onThisPage?: string;
|
|
237
|
+
/** Loading message. Default: "Loading..." */
|
|
238
|
+
loading?: string;
|
|
239
|
+
/** Error title. Default: "Error" */
|
|
240
|
+
errorTitle?: string;
|
|
241
|
+
/** Generic error message. Default: "Something went wrong" */
|
|
242
|
+
errorMessage?: string;
|
|
243
|
+
/** Not found title. Default: "Page not found" */
|
|
244
|
+
notFoundTitle?: string;
|
|
245
|
+
/** Not found message. Default: "The page you're looking for doesn't exist" */
|
|
246
|
+
notFoundMessage?: string;
|
|
247
|
+
}
|
|
123
248
|
|
|
124
249
|
export declare interface DocsPageProps {
|
|
125
250
|
payload: PayloadData;
|
|
@@ -136,6 +261,36 @@ export declare interface DocsPageProps {
|
|
|
136
261
|
LinkComponent?: LinkComponent;
|
|
137
262
|
}
|
|
138
263
|
|
|
264
|
+
/**
|
|
265
|
+
* Enhanced DocsPageProps with localization and telemetry support
|
|
266
|
+
*/
|
|
267
|
+
export declare interface DocsPagePropsWithCustomization extends DocsPageProps {
|
|
268
|
+
/** Localization strings */
|
|
269
|
+
localization?: DocsPageLocalization;
|
|
270
|
+
/** Telemetry configuration */
|
|
271
|
+
telemetry?: DocsPageTelemetry;
|
|
272
|
+
/** Context menu configuration */
|
|
273
|
+
contextMenu?: PageContextMenuConfig;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Telemetry configuration for DocsPage
|
|
278
|
+
*/
|
|
279
|
+
export declare interface DocsPageTelemetry {
|
|
280
|
+
/** Activity name for page context menu interactions */
|
|
281
|
+
contextMenuActivity?: string;
|
|
282
|
+
/** Phase for context menu interactions */
|
|
283
|
+
contextMenuPhase?: string;
|
|
284
|
+
/** Activity name for TOC link clicks */
|
|
285
|
+
tocLinkActivity?: string;
|
|
286
|
+
/** Phase for TOC link clicks */
|
|
287
|
+
tocLinkPhase?: string;
|
|
288
|
+
/** Activity name for zone pivot selector changes */
|
|
289
|
+
zonePivotActivity?: string;
|
|
290
|
+
/** Phase for zone pivot changes */
|
|
291
|
+
zonePivotPhase?: string;
|
|
292
|
+
}
|
|
293
|
+
|
|
139
294
|
export declare type ElementType = {
|
|
140
295
|
type?: string;
|
|
141
296
|
tagName?: string;
|
|
@@ -290,6 +445,24 @@ declare interface NavTreeProps {
|
|
|
290
445
|
|
|
291
446
|
export declare const PageContextMenu: ({ className, pathname, markdownContent, onCopyMarkdown, onViewMarkdown, allPages, baseUrl, }: PageContextMenuProps) => JSX_2.Element;
|
|
292
447
|
|
|
448
|
+
/**
|
|
449
|
+
* Configuration for the page context menu
|
|
450
|
+
*/
|
|
451
|
+
export declare interface PageContextMenuConfig {
|
|
452
|
+
/** Custom actions for the page context menu. If provided, these will replace the default actions. */
|
|
453
|
+
customActions?: ContextualOption[];
|
|
454
|
+
/** Callback fired after markdown is successfully copied */
|
|
455
|
+
onCopyMarkdown?: () => void;
|
|
456
|
+
/** Custom handler for "Copy Page" action. If provided, replaces default copy behavior. */
|
|
457
|
+
onCopyPage?: () => void | Promise<void>;
|
|
458
|
+
/** Custom handler for "View as Markdown" action. If provided, replaces default view behavior. */
|
|
459
|
+
onViewMarkdown?: (pathname: string) => void;
|
|
460
|
+
/** Custom handler for "View llms.txt" action. If provided, replaces default behavior. */
|
|
461
|
+
onViewLlmsTxt?: () => void;
|
|
462
|
+
/** Custom handler for "View llms-full.txt" action. If provided, replaces default behavior. */
|
|
463
|
+
onViewLlmsFullTxt?: () => void;
|
|
464
|
+
}
|
|
465
|
+
|
|
293
466
|
export declare interface PageContextMenuProps {
|
|
294
467
|
className?: string;
|
|
295
468
|
pathname: string;
|
|
@@ -352,7 +525,12 @@ export declare function removeHtmlComments(root: Root_2): void;
|
|
|
352
525
|
|
|
353
526
|
export declare const sanitizePreTags: Plugin_2<[], Node_3>;
|
|
354
527
|
|
|
355
|
-
export declare function serializeMdx(mdxString: string): Promise<
|
|
528
|
+
export declare function serializeMdx(mdxString: string): Promise<SerializeMdxResult>;
|
|
529
|
+
|
|
530
|
+
export declare interface SerializeMdxResult {
|
|
531
|
+
Content: default_2.ComponentType;
|
|
532
|
+
headings: TocItem[];
|
|
533
|
+
}
|
|
356
534
|
|
|
357
535
|
export declare function Summary({ children, isOpen }: SummaryProps): JSX_2.Element;
|
|
358
536
|
|
package/dist/index.js
CHANGED
|
@@ -1,117 +1,119 @@
|
|
|
1
|
-
import { DocsPage as r } from "./components/
|
|
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 {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
1
|
+
import { DocsPage as r } from "./components/docsPage.js";
|
|
2
|
+
import { DocsLayout as m } from "./components/docsLayout.js";
|
|
3
|
+
import { MDXRenderer as a } from "./components/mdx-renderer.js";
|
|
4
|
+
import { PlainTextPage as f } from "./components/plain-text-page.js";
|
|
5
|
+
import { createDefaultComponents as n, defaultComponents as s } from "./components/content-components/default-components.js";
|
|
6
|
+
import { ComponentsProvider as i, useComponents as T } from "./context/components-context.js";
|
|
7
|
+
import { NavTree as b } from "./components/nav-tree/index.js";
|
|
8
|
+
import { ApiReferenceProvider2 as P, useApiReference as y } from "./components/Api/ApiReferenceProvider.js";
|
|
9
|
+
import { TableOfContents as c } from "./components/toc/index.js";
|
|
10
|
+
import { PivotAwareTOC as u } from "./components/toc/pivot-aware-toc.js";
|
|
11
|
+
import { PageContextMenu as k } 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 L } from "./utils/generate-llms-txt.js";
|
|
14
|
+
import { getNodeText as A } 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 ye } from "./components/content-components/tabs/tab.js";
|
|
33
|
+
import { Details as ce, Summary as ve } from "./components/content-components/details/details.js";
|
|
34
|
+
import { Table as he, TableBody as ke, TableCaption as Me, 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 Fe } from "./components/content-components/home.js";
|
|
37
|
+
import { MobileNavTree as Ee } from "./components/nav-tree/mobile-nav.js";
|
|
38
|
+
import { rehypeCodeblocks as Oe } from "./plugins/rehype/rehype-code-blocks.js";
|
|
39
|
+
import { remarkHeadingIds as Je } from "./plugins/remark/remark-heading-ids.js";
|
|
40
|
+
import { sanitizePreTags as je } from "./plugins/sanitize/rehype-pre-to-mdx-fence.js";
|
|
41
|
+
import { rehypeCallouts as Ge } from "./plugins/sanitize/rehype-callouts.js";
|
|
42
|
+
import { rehypeParamName as Qe } from "./plugins/sanitize/rehype-param-name.js";
|
|
43
|
+
import { rehypeTabs as Ve } from "./plugins/sanitize/rehype-tabs.js";
|
|
44
|
+
import { rehypeDetails as Ye } from "./plugins/sanitize/rehype-details.js";
|
|
45
|
+
import { rehypeHeadingIds as $e } from "./plugins/sanitize/rehype-heading-ids.js";
|
|
46
|
+
import { rehypeZonePivots as oo } from "./plugins/sanitize/rehype-zone-pivots.js";
|
|
47
|
+
import { mdxJsxFlowElementHandler as to, rehypeRemark as mo } from "./plugins/sanitize/rehype-remark.js";
|
|
48
|
+
import { tableCellHandler as ao, tableHandler as xo, tableRowHandler as fo } from "./plugins/sanitize/rehype-table-align.js";
|
|
48
49
|
export {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
P as ApiReferenceProvider2,
|
|
51
|
+
pe as Callout,
|
|
52
|
+
$ as CodeBlock,
|
|
53
|
+
i as ComponentsProvider,
|
|
54
|
+
ce as Details,
|
|
55
|
+
m as DocsLayout,
|
|
54
56
|
r as DocsPage,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
57
|
+
oe as Heading,
|
|
58
|
+
Fe as Home,
|
|
59
|
+
te as Link,
|
|
60
|
+
a as MDXRenderer,
|
|
61
|
+
Ee as MobileNavTree,
|
|
62
|
+
b as NavTree,
|
|
63
|
+
k as PageContextMenu,
|
|
64
|
+
Ce as ParamName,
|
|
65
|
+
u as PivotAwareTOC,
|
|
66
|
+
f as PlainTextPage,
|
|
65
67
|
ve as Summary,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
68
|
+
ye as Tab,
|
|
69
|
+
he as Table,
|
|
70
|
+
ke as TableBody,
|
|
71
|
+
Me as TableCaption,
|
|
72
|
+
we as TableCell,
|
|
73
|
+
Re as TableFooter,
|
|
74
|
+
De as TableHead,
|
|
75
|
+
Ne as TableHeader,
|
|
76
|
+
c as TableOfContents,
|
|
77
|
+
Ze as TableRow,
|
|
78
|
+
ge as Tabs,
|
|
79
|
+
xe as ZonePivot,
|
|
80
|
+
se as ZonePivotProvider,
|
|
81
|
+
ie as ZonePivotSelector,
|
|
82
|
+
le as ZoneTarget,
|
|
83
|
+
ze as allComponents,
|
|
84
|
+
B as capitalize,
|
|
85
|
+
I as cn,
|
|
86
|
+
q as convertHtmlToMdx,
|
|
87
|
+
w as copyMarkdownToClipboard,
|
|
88
|
+
n as createDefaultComponents,
|
|
89
|
+
s as defaultComponents,
|
|
90
|
+
U as extractHeadings,
|
|
91
|
+
Z as generateLlmsFullTxt,
|
|
92
|
+
L as generateLlmsTxt,
|
|
93
|
+
S as getClassNames,
|
|
94
|
+
A as getNodeText,
|
|
95
|
+
R as getPageMarkdown,
|
|
96
|
+
J as getTextContent,
|
|
97
|
+
X as isElement,
|
|
98
|
+
to as mdxJsxFlowElementHandler,
|
|
99
|
+
Ge as rehypeCallouts,
|
|
100
|
+
Oe as rehypeCodeblocks,
|
|
101
|
+
Ye as rehypeDetails,
|
|
102
|
+
$e as rehypeHeadingIds,
|
|
103
|
+
Qe as rehypeParamName,
|
|
104
|
+
mo as rehypeRemark,
|
|
105
|
+
W as rehypeRemoveHtmlComments,
|
|
106
|
+
Ve as rehypeTabs,
|
|
107
|
+
oo as rehypeZonePivots,
|
|
108
|
+
Je as remarkHeadingIds,
|
|
109
|
+
Y as removeHtmlComments,
|
|
110
|
+
je as sanitizePreTags,
|
|
111
|
+
K as serializeMdx,
|
|
112
|
+
ao as tableCellHandler,
|
|
113
|
+
xo as tableHandler,
|
|
114
|
+
fo as tableRowHandler,
|
|
115
|
+
y as useApiReference,
|
|
116
|
+
T as useComponents,
|
|
117
|
+
D as useMarkdownCopy
|
|
116
118
|
};
|
|
117
119
|
//# 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,28 +1,33 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { compile as
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
1
|
+
import * as a from "react/jsx-runtime";
|
|
2
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
3
|
+
import { compile as p, run as c } from "@mdx-js/mdx";
|
|
4
|
+
import d from "remark-gfm";
|
|
5
|
+
import { extractHeadings as f } from "../plugins/extract-headings.js";
|
|
6
|
+
import { rehypeCodeblocks as l } from "../plugins/rehype/rehype-code-blocks.js";
|
|
7
|
+
import { remarkHeadingIds as u } from "../plugins/remark/remark-heading-ids.js";
|
|
8
|
+
import { defaultComponents as g } from "../components/content-components/default-components.js";
|
|
9
|
+
async function H(t) {
|
|
10
|
+
var r;
|
|
9
11
|
try {
|
|
10
|
-
const o = await
|
|
12
|
+
const o = await p(t, {
|
|
11
13
|
outputFormat: "function-body",
|
|
12
|
-
remarkPlugins: [
|
|
13
|
-
rehypePlugins: [
|
|
14
|
-
}),
|
|
15
|
-
...
|
|
14
|
+
remarkPlugins: [d, u, f],
|
|
15
|
+
rehypePlugins: [l]
|
|
16
|
+
}), n = String(o), e = ((r = o.data) == null ? void 0 : r.headings) || [], { default: m } = await c(n, {
|
|
17
|
+
...a
|
|
16
18
|
});
|
|
17
|
-
return
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
return {
|
|
20
|
+
Content: (i) => /* @__PURE__ */ s(
|
|
21
|
+
m,
|
|
22
|
+
{
|
|
23
|
+
...i,
|
|
24
|
+
components: {
|
|
25
|
+
...g
|
|
26
|
+
}
|
|
23
27
|
}
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
),
|
|
29
|
+
headings: e
|
|
30
|
+
};
|
|
26
31
|
} catch (o) {
|
|
27
32
|
throw console.error(
|
|
28
33
|
"MDX compilation failed:",
|
|
@@ -31,6 +36,6 @@ async function x(r) {
|
|
|
31
36
|
}
|
|
32
37
|
}
|
|
33
38
|
export {
|
|
34
|
-
|
|
39
|
+
H as serializeMdx
|
|
35
40
|
};
|
|
36
41
|
//# sourceMappingURL=serialize-mdx.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialize-mdx.js","sources":["../../src/parser/serialize-mdx.tsx"],"sourcesContent":["import { compile } from \"@mdx-js/mdx\";\nimport { run } from \"@mdx-js/mdx\";\nimport * as runtime from \"react/jsx-runtime\";\nimport React from \"react\";\nimport remarkGfm from \"remark-gfm\";\nimport { rehypeCodeblocks, remarkHeadingIds } from \"../plugins\";\nimport { defaultComponents } from \"../components\";\n\nexport async function serializeMdx(\n mdxString: string\n): Promise<
|
|
1
|
+
{"version":3,"file":"serialize-mdx.js","sources":["../../src/parser/serialize-mdx.tsx"],"sourcesContent":["import { compile } from \"@mdx-js/mdx\";\nimport { run } from \"@mdx-js/mdx\";\nimport * as runtime from \"react/jsx-runtime\";\nimport React from \"react\";\nimport remarkGfm from \"remark-gfm\";\nimport { rehypeCodeblocks, remarkHeadingIds } from \"../plugins\";\nimport { extractHeadings } from \"../plugins/extract-headings\";\nimport { defaultComponents } from \"../components\";\nimport type { TocItem } from \"../types\";\n\nexport interface SerializeMdxResult {\n Content: React.ComponentType;\n headings: TocItem[];\n}\n\nexport async function serializeMdx(\n mdxString: string\n): Promise<SerializeMdxResult> {\n try {\n const compiled = await compile(mdxString, {\n outputFormat: \"function-body\",\n remarkPlugins: [remarkGfm, remarkHeadingIds, extractHeadings],\n rehypePlugins: [rehypeCodeblocks],\n });\n\n const compiledMdx = String(compiled);\n\n const headings = (compiled.data?.headings as TocItem[]) || [];\n\n const { default: Content } = await run(compiledMdx, {\n ...runtime,\n });\n\n const Component = (props: Record<string, unknown>) => (\n <Content\n {...props}\n components={{\n ...defaultComponents,\n }}\n />\n );\n\n return {\n Content: Component,\n headings,\n };\n } catch (error) {\n console.error(\n \"MDX compilation failed:\",\n error instanceof Error ? error.message : String(error)\n );\n throw error;\n }\n}\n"],"names":["serializeMdx","mdxString","compiled","compile","remarkGfm","remarkHeadingIds","extractHeadings","rehypeCodeblocks","compiledMdx","headings","_a","Content","run","runtime","props","jsx","defaultComponents","error"],"mappings":";;;;;;;;AAeA,eAAsBA,EACpBC,GAC6B;;AAC7B,MAAI;AACF,UAAMC,IAAW,MAAMC,EAAQF,GAAW;AAAA,MACxC,cAAc;AAAA,MACd,eAAe,CAACG,GAAWC,GAAkBC,CAAe;AAAA,MAC5D,eAAe,CAACC,CAAgB;AAAA,IAAA,CACjC,GAEKC,IAAc,OAAON,CAAQ,GAE7BO,MAAYC,IAAAR,EAAS,SAAT,gBAAAQ,EAAe,aAA0B,CAAA,GAErD,EAAE,SAASC,EAAA,IAAY,MAAMC,EAAIJ,GAAa;AAAA,MAClD,GAAGK;AAAA,IAAA,CACJ;AAWD,WAAO;AAAA,MACL,SAVgB,CAACC,MACjB,gBAAAC;AAAA,QAACJ;AAAA,QAAA;AAAA,UACE,GAAGG;AAAA,UACJ,YAAY;AAAA,YACV,GAAGE;AAAA,UAAA;AAAA,QACL;AAAA,MAAA;AAAA,MAMF,UAAAP;AAAA,IAAA;AAAA,EAEJ,SAASQ,GAAO;AACd,kBAAQ;AAAA,MACN;AAAA,MACAA,aAAiB,QAAQA,EAAM,UAAU,OAAOA,CAAK;AAAA,IAAA,GAEjDA;AAAA,EACR;AACF;"}
|
|
@@ -1,28 +1,34 @@
|
|
|
1
|
-
import { visit as
|
|
2
|
-
import
|
|
3
|
-
function
|
|
4
|
-
return
|
|
1
|
+
import { visit as l } from "unist-util-visit";
|
|
2
|
+
import g from "@sindresorhus/slugify";
|
|
3
|
+
function p(n) {
|
|
4
|
+
return n.children.filter((t) => t.type === "text").map((t) => t.value).join("").replace(/\s*\([^)]*\)\s*/g, " ").trim();
|
|
5
5
|
}
|
|
6
|
-
function
|
|
7
|
-
return (
|
|
8
|
-
const i = [];
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
if (
|
|
12
|
-
const
|
|
6
|
+
function h() {
|
|
7
|
+
return (n, s) => {
|
|
8
|
+
const i = [], t = /* @__PURE__ */ new Map();
|
|
9
|
+
l(n, "heading", (r) => {
|
|
10
|
+
const c = r.depth;
|
|
11
|
+
if (c === 2) {
|
|
12
|
+
const o = p(r);
|
|
13
|
+
let e = g(o.replace(/\./g, "-"));
|
|
14
|
+
if (t.has(e)) {
|
|
15
|
+
const a = t.get(e) + 1;
|
|
16
|
+
t.set(e, a), e = `${e}-${a}`;
|
|
17
|
+
} else
|
|
18
|
+
t.set(e, 1);
|
|
13
19
|
i.push({
|
|
14
|
-
title:
|
|
15
|
-
slug:
|
|
16
|
-
level:
|
|
20
|
+
title: o,
|
|
21
|
+
slug: e,
|
|
22
|
+
level: c
|
|
17
23
|
});
|
|
18
24
|
}
|
|
19
|
-
}),
|
|
20
|
-
...
|
|
25
|
+
}), s.data = {
|
|
26
|
+
...s.data,
|
|
21
27
|
headings: i
|
|
22
28
|
};
|
|
23
29
|
};
|
|
24
30
|
}
|
|
25
31
|
export {
|
|
26
|
-
|
|
32
|
+
h as extractHeadings
|
|
27
33
|
};
|
|
28
34
|
//# sourceMappingURL=extract-headings.js.map
|
|
@@ -1 +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
|
|
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 const slugCounts = new Map<string, number>();\n\n visit(tree, \"heading\", (node: Record<string, unknown>) => {\n const depth = node.depth as number;\n if (depth === 2) {\n const text = getHeadingText(node);\n let slug = slugify(text.replace(/\\./g, '-'));\n\n // Handle duplicate slugs by adding a counter\n if (slugCounts.has(slug)) {\n const count = slugCounts.get(slug)! + 1;\n slugCounts.set(slug, count);\n slug = `${slug}-${count}`;\n } else {\n slugCounts.set(slug, 1);\n }\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","slugCounts","visit","depth","text","slug","slugify","count"],"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,GACtBC,wBAAiB,IAAA;AAEvB,IAAAC,EAAMJ,GAAM,WAAW,CAACH,MAAkC;AACxD,YAAMQ,IAAQR,EAAK;AACnB,UAAIQ,MAAU,GAAG;AACf,cAAMC,IAAOV,EAAeC,CAAI;AAChC,YAAIU,IAAOC,EAAQF,EAAK,QAAQ,OAAO,GAAG,CAAC;AAG3C,YAAIH,EAAW,IAAII,CAAI,GAAG;AACxB,gBAAME,IAAQN,EAAW,IAAII,CAAI,IAAK;AACtC,UAAAJ,EAAW,IAAII,GAAME,CAAK,GAC1BF,IAAO,GAAGA,CAAI,IAAIE,CAAK;AAAA,QACzB;AACE,UAAAN,EAAW,IAAII,GAAM,CAAC;AAGxB,QAAAL,EAAS,KAAK;AAAA,UACZ,OAAOI;AAAA,UACP,MAAAC;AAAA,UACA,OAAOF;AAAA,QAAA,CACR;AAAA,MACH;AAAA,IACF,CAAC,GAEAJ,EAAiC,OAAO;AAAA,MACvC,GAAKA,EAAiC;AAAA,MACtC,UAAAC;AAAA,IAAA;AAAA,EAEJ;AACF;"}
|