@mintlify/common 1.0.1301 → 1.0.1303
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/lib/index.d.ts
CHANGED
package/dist/mdx/lib/index.js
CHANGED
|
@@ -9,9 +9,10 @@ const normalize = (value) => Array.from(value)
|
|
|
9
9
|
.filter((character) => character > ' ')
|
|
10
10
|
.join('')
|
|
11
11
|
.toLowerCase();
|
|
12
|
+
const localName = (name) => name.slice(name.lastIndexOf(':') + 1).toLowerCase();
|
|
12
13
|
const targetsScriptableAttribute = (attributeName) => {
|
|
13
|
-
const
|
|
14
|
-
return SCRIPTABLE_TARGETS.has(
|
|
14
|
+
const name = localName(attributeName);
|
|
15
|
+
return SCRIPTABLE_TARGETS.has(name) || name.startsWith('on');
|
|
15
16
|
};
|
|
16
17
|
function isSafeSmilAttribute(attribute) {
|
|
17
18
|
if (attribute.type === 'mdxJsxExpressionAttribute')
|
|
@@ -28,7 +29,7 @@ function isSafeSmilAttribute(attribute) {
|
|
|
28
29
|
return value.startsWith('#');
|
|
29
30
|
return !ANIMATION_VALUE_ATTRIBUTES.has(name) || !SCRIPTABLE_URL.test(value);
|
|
30
31
|
}
|
|
31
|
-
export const isUnsafeSmilElement = ({ name, attributes = [] }) => name != null && SMIL_ELEMENTS.has(name
|
|
32
|
+
export const isUnsafeSmilElement = ({ name, attributes = [] }) => name != null && SMIL_ELEMENTS.has(localName(name)) && !attributes.every(isSafeSmilAttribute);
|
|
32
33
|
export const remarkMdxRemoveUnsafeSmil = () => (tree) => {
|
|
33
34
|
remove(tree, { cascade: false }, (node) => isMdxJsxElement(node) && isUnsafeSmilElement(node));
|
|
34
35
|
};
|