@mintlify/common 1.0.828 → 1.0.829

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.
@@ -61,5 +61,6 @@ export const COMPONENTS_WITH_RAW_ID = new Set([
61
61
  'Table', // spreads props to outer <div>
62
62
  'OptimizedFrame', // spreads props to <iframe>
63
63
  'OptimizedImage', // spreads props to <img>
64
+ 'OptimizedVideo', // spreads props to <video>
64
65
  'View', // spreads props to outer <div>
65
66
  ]);
@@ -6,6 +6,7 @@ export * from './rehypeParamFieldIds.js';
6
6
  export * from './rehypeRawComponents.js';
7
7
  export * from './rehypeTable.js';
8
8
  export * from './rehypeZoomImages.js';
9
+ export * from './rehypeOptimizedVideo.js';
9
10
  export * from './rehypeUnicodeIds.js';
10
11
  export * from './rehypeDynamicTailwindCss.js';
11
12
  export * from './rehypeKeyboardSymbols.js';
@@ -6,6 +6,7 @@ export * from './rehypeParamFieldIds.js';
6
6
  export * from './rehypeRawComponents.js';
7
7
  export * from './rehypeTable.js';
8
8
  export * from './rehypeZoomImages.js';
9
+ export * from './rehypeOptimizedVideo.js';
9
10
  export * from './rehypeUnicodeIds.js';
10
11
  export * from './rehypeDynamicTailwindCss.js';
11
12
  export * from './rehypeKeyboardSymbols.js';
@@ -0,0 +1,2 @@
1
+ import type { Root } from 'hast';
2
+ export declare const rehypeOptimizedVideo: () => (tree: Root) => void;
@@ -0,0 +1,9 @@
1
+ import { u } from 'unist-builder';
2
+ import { visit } from 'unist-util-visit';
3
+ export const rehypeOptimizedVideo = () => (tree) => {
4
+ visit(tree, 'mdxJsxFlowElement', (node, index, parent) => {
5
+ if (node.name !== 'video' || !parent || index == null)
6
+ return;
7
+ parent.children.splice(index, 1, u('mdxJsxFlowElement', { name: 'OptimizedVideo', attributes: node.attributes }, node.children));
8
+ });
9
+ };
@@ -1,6 +1,7 @@
1
1
  import { type SerializeSuccess } from '@mintlify/mdx/types';
2
2
  import type { PageMetaTags, PageType } from '@mintlify/models';
3
3
  import { CodeStyling, DocsConfig } from '@mintlify/validation';
4
+ import type { PluggableList } from 'unified';
4
5
  import { MdxExtracts } from '../../index.js';
5
6
  import { createSnippetTreeMap, type Snippet } from './getMdx/snippets.js';
6
7
  type RunWithTracingFn = <T>(spanName: string, fn: () => Promise<T>) => Promise<T>;
@@ -11,7 +12,7 @@ export type GetMdxType = {
11
12
  panelMdxSource?: SerializeSuccess;
12
13
  panelMdxSourceWithNoJs?: SerializeSuccess;
13
14
  };
14
- export declare function getMdx({ path, content, metadata, snippets, subdomain, codeStyling, config, tailwindSelectors, pageType, trace, customLanguages, variables, }: {
15
+ export declare function getMdx({ path, content, metadata, snippets, subdomain, codeStyling, config, tailwindSelectors, pageType, trace, customLanguages, variables, rehypePlugins, remarkPlugins, }: {
15
16
  path: string;
16
17
  content: string;
17
18
  metadata: PageMetaTags;
@@ -24,5 +25,7 @@ export declare function getMdx({ path, content, metadata, snippets, subdomain, c
24
25
  trace?: RunWithTracingFn;
25
26
  customLanguages?: string[];
26
27
  variables?: Record<string, string>;
28
+ rehypePlugins?: PluggableList;
29
+ remarkPlugins?: PluggableList;
27
30
  }): Promise<GetMdxType>;
28
31
  export { createSnippetTreeMap, type Snippet };
@@ -15,7 +15,7 @@ import { preprocessCustomHeadingIds } from '../preprocessCustomHeadingIds.js';
15
15
  import { replaceVariables } from '../replaceVariables.js';
16
16
  import { createSnippetTreeMap } from './getMdx/snippets.js';
17
17
  export function getMdx(_a) {
18
- return __awaiter(this, arguments, void 0, function* ({ path, content, metadata, snippets, subdomain, codeStyling, config, tailwindSelectors = undefined, pageType = 'default', trace = undefined, customLanguages = [], variables = undefined, }) {
18
+ return __awaiter(this, arguments, void 0, function* ({ path, content, metadata, snippets, subdomain, codeStyling, config, tailwindSelectors = undefined, pageType = 'default', trace = undefined, customLanguages = [], variables = undefined, rehypePlugins = [], remarkPlugins = [], }) {
19
19
  const traceFn = trace !== null && trace !== void 0 ? trace : ((_name, fn) => fn());
20
20
  const processedContent = preprocessCustomHeadingIds(replaceVariables(content, variables));
21
21
  const processedSnippets = snippets.map((snippet) => (Object.assign(Object.assign({}, snippet), { content: preprocessCustomHeadingIds(replaceVariables(snippet.content, variables)) })));
@@ -31,14 +31,20 @@ export function getMdx(_a) {
31
31
  tailwindSelectors,
32
32
  };
33
33
  let mdxExtracts = {};
34
- let plugins = [remarkValidateSteps, remarkValidateTabs];
34
+ let plugins = [remarkValidateSteps, remarkValidateTabs, ...remarkPlugins];
35
35
  if (pageType === 'pdf') {
36
36
  plugins = [...plugins, remarkExpandContent, remarkSplitCodeGroup, remarkSplitTabs];
37
37
  }
38
- const mdxOptions = getMDXOptions({ data: mdxOptionsData, remarkPlugins: plugins, mdxExtracts });
38
+ const mdxOptions = getMDXOptions({
39
+ data: mdxOptionsData,
40
+ remarkPlugins: plugins,
41
+ rehypePlugins,
42
+ mdxExtracts,
43
+ });
39
44
  const mdxOptionsNoJs = getMDXOptions({
40
45
  data: mdxOptionsData,
41
46
  remarkPlugins: [remarkMdxRemoveJs, ...plugins],
47
+ rehypePlugins,
42
48
  });
43
49
  const scope = {
44
50
  codeStyling,
package/dist/mdx/utils.js CHANGED
@@ -139,6 +139,7 @@ export const allowedComponents = [
139
139
  'kbd',
140
140
  'pre',
141
141
  'ZoomImage',
142
+ 'OptimizedVideo',
142
143
  'Mermaid',
143
144
  'View',
144
145
  // Custom tags