@mintlify/common 1.0.1177 → 1.0.1178
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/remark.d.ts
CHANGED
|
@@ -5,5 +5,6 @@ export declare const coreRemarkMdxPlugins: PluggableList;
|
|
|
5
5
|
export declare const coreRemark: import("unified").Processor<Root, undefined, undefined, Root, string>;
|
|
6
6
|
export declare const getAST: (str: string, filePath?: string) => Root;
|
|
7
7
|
export declare const stringifyTree: (tree: Root) => string;
|
|
8
|
+
export declare const stringifyTreeForAgents: (tree: Root) => string;
|
|
8
9
|
export declare function stripVisibilityForMarkdown(mdx: string): string;
|
|
9
10
|
export declare function transformContentForMarkdown(mdx: string, mentionOptions?: RemarkUserMentionsOptions): string;
|
package/dist/mdx/remark.js
CHANGED
|
@@ -17,6 +17,13 @@ export const coreRemarkMdxPlugins = [
|
|
|
17
17
|
remarkMath,
|
|
18
18
|
];
|
|
19
19
|
export const coreRemark = remark().use(coreRemarkMdxPlugins).freeze();
|
|
20
|
+
const agentRemarkMdxPlugins = [
|
|
21
|
+
remarkMdx,
|
|
22
|
+
[remarkGfm, { tablePipeAlign: false }],
|
|
23
|
+
[remarkFrontmatter, ['yaml', 'toml']],
|
|
24
|
+
remarkMath,
|
|
25
|
+
];
|
|
26
|
+
const agentRemark = remark().use(agentRemarkMdxPlugins).freeze();
|
|
20
27
|
export const getAST = (str, filePath) => {
|
|
21
28
|
if (isJsxOrTsx(filePath)) {
|
|
22
29
|
return getJsxEsmTree(str, filePath);
|
|
@@ -24,14 +31,15 @@ export const getAST = (str, filePath) => {
|
|
|
24
31
|
return coreRemark().parse(preprocessCustomHeadingIds(preprocessMdxFragmentCode(str)));
|
|
25
32
|
};
|
|
26
33
|
export const stringifyTree = (tree) => coreRemark().use(remarkStringify).stringify(tree);
|
|
34
|
+
export const stringifyTreeForAgents = (tree) => agentRemark().use(remarkStringify).stringify(tree);
|
|
27
35
|
export function stripVisibilityForMarkdown(mdx) {
|
|
28
36
|
const tree = getAST(mdx);
|
|
29
37
|
remarkVisibilityForMarkdown()(tree);
|
|
30
|
-
return
|
|
38
|
+
return stringifyTreeForAgents(tree);
|
|
31
39
|
}
|
|
32
40
|
export function transformContentForMarkdown(mdx, mentionOptions = {}) {
|
|
33
41
|
const tree = getAST(mdx);
|
|
34
42
|
remarkVisibilityForMarkdown()(tree);
|
|
35
43
|
remarkUserMentions(mentionOptions)(tree);
|
|
36
|
-
return
|
|
44
|
+
return stringifyTreeForAgents(tree);
|
|
37
45
|
}
|