@mintlify/common 1.0.589 → 1.0.590
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/getMDXOptions.js +2 -1
- package/dist/mdx/plugins/remark/index.d.ts +1 -0
- package/dist/mdx/plugins/remark/index.js +1 -0
- package/dist/mdx/plugins/remark/remarkVideo.d.ts +2 -0
- package/dist/mdx/plugins/remark/remarkVideo.js +25 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -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, 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
|
],
|
|
@@ -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
|
+
};
|