@mintlify/common 1.0.1194 → 1.0.1195
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.
|
@@ -5,7 +5,9 @@ const isInsideTile = (ancestors) => ancestors.some((ancestor) => typeof ancestor
|
|
|
5
5
|
'name' in ancestor &&
|
|
6
6
|
ancestor.name === 'Tile');
|
|
7
7
|
export const rehypeZoomImages = () => (tree) => {
|
|
8
|
-
visitParents(tree, 'mdxJsxFlowElement', (node, ancestors) => {
|
|
8
|
+
visitParents(tree, ['mdxJsxFlowElement', 'mdxJsxTextElement'], (node, ancestors) => {
|
|
9
|
+
if (node.type !== 'mdxJsxFlowElement' && node.type !== 'mdxJsxTextElement')
|
|
10
|
+
return;
|
|
9
11
|
if (node.name !== 'img' &&
|
|
10
12
|
node.name !== 'picture' &&
|
|
11
13
|
node.name !== 'figure' &&
|
|
@@ -23,12 +25,14 @@ export const rehypeZoomImages = () => (tree) => {
|
|
|
23
25
|
if (shouldSkipZoom)
|
|
24
26
|
return;
|
|
25
27
|
if (node.name === 'iframe') {
|
|
28
|
+
if (node.type !== 'mdxJsxFlowElement')
|
|
29
|
+
return;
|
|
26
30
|
parent.children.splice(index, 1, u('mdxJsxFlowElement', { name: 'OptimizedFrame', attributes: node.attributes }, []));
|
|
27
31
|
return;
|
|
28
32
|
}
|
|
29
33
|
// For img elements, replace with OptimizedImage (it applies Zoom internally)
|
|
30
34
|
if (node.name === 'img') {
|
|
31
|
-
const optimizedImg = u(
|
|
35
|
+
const optimizedImg = u(node.type, {
|
|
32
36
|
name: 'OptimizedImage',
|
|
33
37
|
attributes: node.attributes,
|
|
34
38
|
}, []);
|