@mintlify/common 1.0.812 → 1.0.813
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/mdx/plugins/remark/remarkExtractTableOfContents.d.ts +1 -0
- package/dist/mdx/plugins/remark/remarkExtractTableOfContents.js +1 -1
- package/dist/mdx/plugins/remark/remarkMdxRemoveUnknownJsx/index.d.ts +1 -1
- package/dist/mdx/preprocessCustomHeadingIds.d.ts +6 -0
- package/dist/mdx/preprocessCustomHeadingIds.js +7 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PageMetaTags } from '@mintlify/models';
|
|
2
2
|
import type { Root } from 'mdast';
|
|
3
3
|
import type { MdxExtracts } from '../../../types/index.js';
|
|
4
|
+
export declare const HEADING_NAMES: string[];
|
|
4
5
|
export declare const remarkExtractTableOfContents: (mdxExtracts?: MdxExtracts, pageMetadata?: PageMetaTags) => (tree: Root) => void;
|
|
@@ -2,7 +2,7 @@ import { visit } from 'unist-util-visit';
|
|
|
2
2
|
import { slugify } from '../../../slugify.js';
|
|
3
3
|
import { createMdxJsxAttribute, getTableOfContentsTitle } from '../../lib/remark-utils.js';
|
|
4
4
|
import { AVOIDED_PAGE_MODES, HEADING_LEVELS } from './remarkComponentIds.js';
|
|
5
|
-
const HEADING_NAMES = ['h1', 'h2', 'h3', 'h4'];
|
|
5
|
+
export const HEADING_NAMES = ['h1', 'h2', 'h3', 'h4'];
|
|
6
6
|
const COMPONENTS_TO_EXCLUDE_HEADINGS = [
|
|
7
7
|
'Accordion',
|
|
8
8
|
'AccordionGroup',
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Root } from 'mdast';
|
|
2
|
-
export declare const remarkMdxRemoveUnknownJsx: () => (tree: Root) => Root | import("mdast
|
|
2
|
+
export declare const remarkMdxRemoveUnknownJsx: () => (tree: Root) => Root | import("mdast").Link | import("mdast").Delete | import("mdast").Blockquote | import("mdast").Break | import("mdast").Code | import("mdast").Definition | import("mdast").Emphasis | import("mdast").FootnoteDefinition | import("mdast").FootnoteReference | import("mdast").Heading | import("mdast").Html | import("mdast").Image | import("mdast").ImageReference | import("mdast").InlineCode | import("mdast").LinkReference | import("mdast").List | import("mdast").ListItem | import("mdast").Paragraph | import("mdast").Strong | import("mdast").Table | import("mdast").TableCell | import("mdast").TableRow | import("mdast").Text | import("mdast").ThematicBreak | import("mdast").Yaml | import("mdast-util-math").InlineMath | import("mdast-util-math").Math | import("mdast-util-mdx-expression").MdxTextExpression | import("mdast-util-mdx-expression").MdxFlowExpression | import("mdast-util-mdx").MdxJsxFlowElement | import("mdast-util-mdx").MdxJsxTextElement | import("mdast-util-mdxjs-esm").MdxjsEsm;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { RootContent } from 'mdast';
|
|
2
|
+
import { MdxJsxFlowElement } from 'mdast-util-mdx-jsx';
|
|
1
3
|
/**
|
|
2
4
|
* Converts markdown headings with custom ID syntax into JSX heading elements.
|
|
3
5
|
*
|
|
@@ -6,3 +8,7 @@
|
|
|
6
8
|
* produces JSX heading elements that the existing remark pipeline already handles.
|
|
7
9
|
*/
|
|
8
10
|
export declare function preprocessCustomHeadingIds(content: string): string;
|
|
11
|
+
export interface JsxHeadingElement extends MdxJsxFlowElement {
|
|
12
|
+
readonly __jsxHeading: true;
|
|
13
|
+
}
|
|
14
|
+
export declare const isJsxHeadingElement: (node: RootContent) => node is JsxHeadingElement;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import slugify from '@sindresorhus/slugify';
|
|
2
|
+
import { HEADING_NAMES } from './plugins/remark/remarkExtractTableOfContents.js';
|
|
2
3
|
/**
|
|
3
4
|
* Converts markdown headings with custom ID syntax into JSX heading elements.
|
|
4
5
|
*
|
|
@@ -18,3 +19,9 @@ export function preprocessCustomHeadingIds(content) {
|
|
|
18
19
|
return `<h${level} id="${sanitizedId}">\n${text}\n</h${level}>`;
|
|
19
20
|
});
|
|
20
21
|
}
|
|
22
|
+
export const isJsxHeadingElement = (node) => {
|
|
23
|
+
return (node.type === 'mdxJsxFlowElement' &&
|
|
24
|
+
'name' in node &&
|
|
25
|
+
typeof node.name === 'string' &&
|
|
26
|
+
HEADING_NAMES.includes(node.name));
|
|
27
|
+
};
|