@mintlify/common 1.0.589 → 1.0.591

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.
@@ -1,4 +1,4 @@
1
- import { rehypeCodeBlocks, rehypeDynamicTailwindCss, rehypeMdxExtractEndpoint, rehypeMdxExtractExamples, rehypeParamFieldIds, rehypeRawComponents, rehypeUnicodeIds, rehypeZoomImages, remarkExtractChangelogFilters, remarkExtractTableOfContents, remarkFrames, remarkComponentIds, remarkMdxInjectSnippets, remarkMdxRemoveUnusedVariables, remarkRemoveImports, remarkMdxExtractPanel, } from './plugins/index.js';
1
+ import { rehypeCodeBlocks, rehypeDynamicTailwindCss, rehypeMdxExtractEndpoint, rehypeMdxExtractExamples, rehypeParamFieldIds, rehypeRawComponents, rehypeTable, rehypeUnicodeIds, rehypeZoomImages, remarkExtractChangelogFilters, remarkExtractTableOfContents, remarkFrames, remarkComponentIds, remarkMdxInjectSnippets, remarkMdxRemoveUnusedVariables, remarkRemoveImports, remarkMdxExtractPanel, remarkVideo, } from './plugins/index.js';
2
2
  import { remarkMdxRemoveUnknownJsx } from './plugins/remark/remarkMdxRemoveUnknownJsx/index.js';
3
3
  import { remarkMermaid } from './plugins/remark/remarkMermaid.js';
4
4
  // avoid running extractors unnecessarily
@@ -22,6 +22,7 @@ export const getMDXOptions = ({ data, remarkPlugins = [], rehypePlugins = [], md
22
22
  remarkFrames,
23
23
  remarkRemoveImports,
24
24
  remarkMermaid,
25
+ remarkVideo,
25
26
  ...remarkPlugins,
26
27
  remarkMdxRemoveUnknownJsx,
27
28
  ],
@@ -29,6 +30,7 @@ export const getMDXOptions = ({ data, remarkPlugins = [], rehypePlugins = [], md
29
30
  rehypeCodeBlocks,
30
31
  rehypeParamFieldIds,
31
32
  ...rehypeExtractors(mdxExtracts, data),
33
+ rehypeTable,
32
34
  rehypeRawComponents,
33
35
  rehypeZoomImages,
34
36
  rehypeUnicodeIds,
@@ -3,6 +3,7 @@ export * from './rehypeMdxExtractEndpoint/index.js';
3
3
  export * from './rehypeMdxExtractExamples.js';
4
4
  export * from './rehypeParamFieldIds.js';
5
5
  export * from './rehypeRawComponents.js';
6
+ export * from './rehypeTable.js';
6
7
  export * from './rehypeZoomImages.js';
7
8
  export * from './rehypeUnicodeIds.js';
8
9
  export * from './rehypeDynamicTailwindCss.js';
@@ -3,6 +3,7 @@ export * from './rehypeMdxExtractEndpoint/index.js';
3
3
  export * from './rehypeMdxExtractExamples.js';
4
4
  export * from './rehypeParamFieldIds.js';
5
5
  export * from './rehypeRawComponents.js';
6
+ export * from './rehypeTable.js';
6
7
  export * from './rehypeZoomImages.js';
7
8
  export * from './rehypeUnicodeIds.js';
8
9
  export * from './rehypeDynamicTailwindCss.js';
@@ -0,0 +1,2 @@
1
+ import type { Pluggable } from 'unified';
2
+ export declare const rehypeTable: Pluggable;
@@ -0,0 +1,21 @@
1
+ import { u } from 'unist-builder';
2
+ import { visit } from 'unist-util-visit';
3
+ import { createMdxJsxAttribute } from '../../lib/remark-utils.js';
4
+ export const rehypeTable = () => {
5
+ return (tree) => {
6
+ visit(tree, 'element', (node, index, parent) => {
7
+ if (node.tagName === 'table' && parent && index !== undefined) {
8
+ const attributes = Object.entries(node.properties).map(([key, value]) => {
9
+ const attributeValue = Array.isArray(value) ? value.join(' ') : value;
10
+ const attributeName = key === 'class' ? 'className' : key;
11
+ return createMdxJsxAttribute(attributeName, attributeValue);
12
+ });
13
+ const tableComponent = u('mdxJsxFlowElement', {
14
+ name: 'Table',
15
+ attributes,
16
+ }, node.children);
17
+ parent.children.splice(index, 1, tableComponent);
18
+ }
19
+ });
20
+ };
21
+ };
@@ -14,3 +14,4 @@ export * from './remarkComponentIds.js';
14
14
  export * from './remarkMdxExtractPanel.js';
15
15
  export * from './remarkValidateSteps.js';
16
16
  export * from './remarkValidateTabs.js';
17
+ export * from './remarkVideo.js';
@@ -14,3 +14,4 @@ export * from './remarkComponentIds.js';
14
14
  export * from './remarkMdxExtractPanel.js';
15
15
  export * from './remarkValidateSteps.js';
16
16
  export * from './remarkValidateTabs.js';
17
+ export * from './remarkVideo.js';
@@ -0,0 +1,2 @@
1
+ import type { Root } from 'mdast';
2
+ export declare const remarkVideo: () => (tree: Root) => void;
@@ -0,0 +1,25 @@
1
+ import { visit } from 'unist-util-visit';
2
+ import { createMdxJsxAttribute } from '../../lib/remark-utils.js';
3
+ export const remarkVideo = () => {
4
+ return (tree) => {
5
+ visit(tree, 'mdxJsxFlowElement', (node) => {
6
+ if (node.name === 'video') {
7
+ const hasAutoPlay = node.attributes.some((attr) => attr.type === 'mdxJsxAttribute' && attr.name === 'autoPlay');
8
+ if (hasAutoPlay) {
9
+ const hasPlaysInline = node.attributes.some((attr) => attr.type === 'mdxJsxAttribute' && attr.name === 'playsInline');
10
+ const hasLoop = node.attributes.some((attr) => attr.type === 'mdxJsxAttribute' && attr.name === 'loop');
11
+ const hasMuted = node.attributes.some((attr) => attr.type === 'mdxJsxAttribute' && attr.name === 'muted');
12
+ if (!hasPlaysInline) {
13
+ node.attributes.push(createMdxJsxAttribute('playsInline', true));
14
+ }
15
+ if (!hasLoop) {
16
+ node.attributes.push(createMdxJsxAttribute('loop', true));
17
+ }
18
+ if (!hasMuted) {
19
+ node.attributes.push(createMdxJsxAttribute('muted', true));
20
+ }
21
+ }
22
+ }
23
+ });
24
+ };
25
+ };