@mintlify/common 1.0.607 → 1.0.608

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.
@@ -22,5 +22,6 @@ export declare function getMdx({ path, content, metadata, snippets, subdomain, c
22
22
  tailwindSelectors?: string[] | undefined;
23
23
  pageType?: PageType;
24
24
  trace?: RunWithTracingFn;
25
+ customLanguages?: string[];
25
26
  }): Promise<GetMdxType>;
26
27
  export { createSnippetTreeMap, type Snippet };
@@ -41,13 +41,23 @@ export function getMdx(_a) {
41
41
  config,
42
42
  pageMetadata: metadata,
43
43
  };
44
- const { mdxSource, mdxSourceWithNoJs } = yield traceFn('getMdx.compileMdx.mainContent', () => __awaiter(this, void 0, void 0, function* () { return compileMdx(content, scope, mdxOptions, mdxOptionsNoJs, codeStyling, path, traceFn); }));
44
+ const { mdxSource, mdxSourceWithNoJs } = yield traceFn('getMdx.compileMdx.mainContent', () => __awaiter(this, void 0, void 0, function* () { return compileMdx({ content, scope, mdxOptions, mdxOptionsNoJs, codeStyling, path, traceFn }); }));
45
45
  const originalMdxExtracts = structuredClone(mdxExtracts);
46
46
  let panelMdxSource;
47
47
  let panelMdxSourceWithNoJs;
48
48
  if (mdxExtracts.panel && mdxExtracts.panel.content) {
49
49
  const panelContent = mdxExtracts.panel.content;
50
- const compiledMdx = yield traceFn('getMdx.compileMdx.panelContent', () => __awaiter(this, void 0, void 0, function* () { return compileMdx(panelContent, scope, mdxOptions, mdxOptionsNoJs, codeStyling, path, traceFn); }));
50
+ const compiledMdx = yield traceFn('getMdx.compileMdx.panelContent', () => __awaiter(this, void 0, void 0, function* () {
51
+ return compileMdx({
52
+ content: panelContent,
53
+ scope,
54
+ mdxOptions,
55
+ mdxOptionsNoJs,
56
+ codeStyling,
57
+ path,
58
+ traceFn,
59
+ });
60
+ }));
51
61
  panelMdxSource = compiledMdx.mdxSource;
52
62
  panelMdxSourceWithNoJs = compiledMdx.mdxSourceWithNoJs;
53
63
  // serializing mdx content with the panel content will remove the original mdxExtracts
@@ -67,15 +77,35 @@ export function getMdx(_a) {
67
77
  };
68
78
  });
69
79
  }
70
- function compileMdx(content, scope, mdxOptions, mdxOptionsNoJs, codeStyling, path, traceFn) {
71
- return __awaiter(this, void 0, void 0, function* () {
72
- const mdxSource = yield traceFn('compileMdx.withJs', () => __awaiter(this, void 0, void 0, function* () { return getCompiledMdxWithFallback(content, scope, mdxOptions, codeStyling, path, traceFn); }));
73
- const mdxSourceWithNoJs = yield traceFn('compileMdx.withoutJs', () => __awaiter(this, void 0, void 0, function* () { return getCompiledMdxWithFallback(content, scope, mdxOptionsNoJs, codeStyling, path, traceFn); }));
80
+ function compileMdx(_a) {
81
+ return __awaiter(this, arguments, void 0, function* ({ content, scope, mdxOptions, mdxOptionsNoJs, codeStyling, path, traceFn, customLanguages, }) {
82
+ const mdxSource = yield traceFn('compileMdx.withJs', () => __awaiter(this, void 0, void 0, function* () {
83
+ return getCompiledMdxWithFallback({
84
+ source: content,
85
+ scope,
86
+ mdxOptions,
87
+ codeStyling,
88
+ path,
89
+ traceFn,
90
+ customLanguages,
91
+ });
92
+ }));
93
+ const mdxSourceWithNoJs = yield traceFn('compileMdx.withoutJs', () => __awaiter(this, void 0, void 0, function* () {
94
+ return getCompiledMdxWithFallback({
95
+ source: content,
96
+ scope,
97
+ mdxOptions: mdxOptionsNoJs,
98
+ codeStyling,
99
+ path,
100
+ traceFn,
101
+ customLanguages,
102
+ });
103
+ }));
74
104
  return { mdxSource, mdxSourceWithNoJs };
75
105
  });
76
106
  }
77
- function getCompiledMdxWithFallback(source, scope, mdxOptions, codeStyling, path, traceFn) {
78
- return __awaiter(this, void 0, void 0, function* () {
107
+ function getCompiledMdxWithFallback(_a) {
108
+ return __awaiter(this, arguments, void 0, function* ({ source, scope, mdxOptions, codeStyling, path, traceFn, customLanguages, }) {
79
109
  const themeOrThemes = codeStylingToThemeOrThemes(codeStyling);
80
110
  try {
81
111
  const result = yield traceFn('getCompiledMdxWithFallback.serialize', () => __awaiter(this, void 0, void 0, function* () {
@@ -83,7 +113,7 @@ function getCompiledMdxWithFallback(source, scope, mdxOptions, codeStyling, path
83
113
  source,
84
114
  scope,
85
115
  mdxOptions,
86
- syntaxHighlightingOptions: Object.assign({}, themeOrThemes),
116
+ syntaxHighlightingOptions: Object.assign(Object.assign({}, themeOrThemes), { customLanguages }),
87
117
  });
88
118
  }));
89
119
  if ('error' in result) {
@@ -101,6 +131,7 @@ function getCompiledMdxWithFallback(source, scope, mdxOptions, codeStyling, path
101
131
  source: '🚧 A parsing error occured. Please contact the owner of this website. They can use the Mintlify CLI to test this website locally and see the errors that occur.',
102
132
  scope,
103
133
  mdxOptions,
134
+ syntaxHighlightingOptions: Object.assign(Object.assign({}, themeOrThemes), { customLanguages }),
104
135
  });
105
136
  }));
106
137
  if ('error' in fallbackResult) {