@mintlify/common 1.0.607 → 1.0.609

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.
@@ -11,7 +11,7 @@ export type GetMdxType = {
11
11
  panelMdxSource?: SerializeSuccess;
12
12
  panelMdxSourceWithNoJs?: SerializeSuccess;
13
13
  };
14
- export declare function getMdx({ path, content, metadata, snippets, subdomain, codeStyling, config, tailwindSelectors, pageType, trace, }: {
14
+ export declare function getMdx({ path, content, metadata, snippets, subdomain, codeStyling, config, tailwindSelectors, pageType, trace, customLanguages, }: {
15
15
  path: string;
16
16
  content: string;
17
17
  metadata: PageMetaTags;
@@ -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 };
@@ -13,7 +13,7 @@ import { getMDXOptions, remarkMdxRemoveJs, remarkExpandContent, remarkSplitCodeG
13
13
  import { codeStylingToThemeOrThemes } from '../getCodeStyling.js';
14
14
  import { createSnippetTreeMap } from './getMdx/snippets.js';
15
15
  export function getMdx(_a) {
16
- return __awaiter(this, arguments, void 0, function* ({ path, content, metadata, snippets, subdomain, codeStyling, config, tailwindSelectors = undefined, pageType = 'default', trace = undefined, }) {
16
+ return __awaiter(this, arguments, void 0, function* ({ path, content, metadata, snippets, subdomain, codeStyling, config, tailwindSelectors = undefined, pageType = 'default', trace = undefined, customLanguages = [], }) {
17
17
  const traceFn = trace !== null && trace !== void 0 ? trace : ((_name, fn) => fn());
18
18
  if (!tailwindSelectors)
19
19
  tailwindSelectors = yield traceFn('getMdx.getTailwindSelectors', () => __awaiter(this, void 0, void 0, function* () { return getTailwindSelectors({ content }); }));
@@ -41,13 +41,35 @@ 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* () {
45
+ return compileMdx({
46
+ content,
47
+ scope,
48
+ mdxOptions,
49
+ mdxOptionsNoJs,
50
+ codeStyling,
51
+ path,
52
+ traceFn,
53
+ customLanguages,
54
+ });
55
+ }));
45
56
  const originalMdxExtracts = structuredClone(mdxExtracts);
46
57
  let panelMdxSource;
47
58
  let panelMdxSourceWithNoJs;
48
59
  if (mdxExtracts.panel && mdxExtracts.panel.content) {
49
60
  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); }));
61
+ const compiledMdx = yield traceFn('getMdx.compileMdx.panelContent', () => __awaiter(this, void 0, void 0, function* () {
62
+ return compileMdx({
63
+ content: panelContent,
64
+ scope,
65
+ mdxOptions,
66
+ mdxOptionsNoJs,
67
+ codeStyling,
68
+ path,
69
+ traceFn,
70
+ customLanguages,
71
+ });
72
+ }));
51
73
  panelMdxSource = compiledMdx.mdxSource;
52
74
  panelMdxSourceWithNoJs = compiledMdx.mdxSourceWithNoJs;
53
75
  // serializing mdx content with the panel content will remove the original mdxExtracts
@@ -67,15 +89,35 @@ export function getMdx(_a) {
67
89
  };
68
90
  });
69
91
  }
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); }));
92
+ function compileMdx(_a) {
93
+ return __awaiter(this, arguments, void 0, function* ({ content, scope, mdxOptions, mdxOptionsNoJs, codeStyling, path, traceFn, customLanguages, }) {
94
+ const mdxSource = yield traceFn('compileMdx.withJs', () => __awaiter(this, void 0, void 0, function* () {
95
+ return getCompiledMdxWithFallback({
96
+ source: content,
97
+ scope,
98
+ mdxOptions,
99
+ codeStyling,
100
+ path,
101
+ traceFn,
102
+ customLanguages,
103
+ });
104
+ }));
105
+ const mdxSourceWithNoJs = yield traceFn('compileMdx.withoutJs', () => __awaiter(this, void 0, void 0, function* () {
106
+ return getCompiledMdxWithFallback({
107
+ source: content,
108
+ scope,
109
+ mdxOptions: mdxOptionsNoJs,
110
+ codeStyling,
111
+ path,
112
+ traceFn,
113
+ customLanguages,
114
+ });
115
+ }));
74
116
  return { mdxSource, mdxSourceWithNoJs };
75
117
  });
76
118
  }
77
- function getCompiledMdxWithFallback(source, scope, mdxOptions, codeStyling, path, traceFn) {
78
- return __awaiter(this, void 0, void 0, function* () {
119
+ function getCompiledMdxWithFallback(_a) {
120
+ return __awaiter(this, arguments, void 0, function* ({ source, scope, mdxOptions, codeStyling, path, traceFn, customLanguages, }) {
79
121
  const themeOrThemes = codeStylingToThemeOrThemes(codeStyling);
80
122
  try {
81
123
  const result = yield traceFn('getCompiledMdxWithFallback.serialize', () => __awaiter(this, void 0, void 0, function* () {
@@ -83,7 +125,7 @@ function getCompiledMdxWithFallback(source, scope, mdxOptions, codeStyling, path
83
125
  source,
84
126
  scope,
85
127
  mdxOptions,
86
- syntaxHighlightingOptions: Object.assign({}, themeOrThemes),
128
+ syntaxHighlightingOptions: Object.assign(Object.assign({}, themeOrThemes), { customLanguages }),
87
129
  });
88
130
  }));
89
131
  if ('error' in result) {
@@ -101,6 +143,7 @@ function getCompiledMdxWithFallback(source, scope, mdxOptions, codeStyling, path
101
143
  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
144
  scope,
103
145
  mdxOptions,
146
+ syntaxHighlightingOptions: Object.assign(Object.assign({}, themeOrThemes), { customLanguages }),
104
147
  });
105
148
  }));
106
149
  if ('error' in fallbackResult) {