UNPKG

@mintlify/common

Version:

Commonly shared code within Mintlify

10 lines (9 loc) 427 B
import { u } from 'unist-builder'; import { visit } from 'unist-util-visit'; export const rehypeOptimizedVideo = () => (tree) => { visit(tree, 'mdxJsxFlowElement', (node, index, parent) => { if (node.name !== 'video' || !parent || index == null) return; parent.children.splice(index, 1, u('mdxJsxFlowElement', { name: 'OptimizedVideo', attributes: node.attributes }, node.children)); }); };