@mintlify/common
Version:
Commonly shared code within Mintlify
12 lines (11 loc) • 440 B
JavaScript
import { visit } from 'unist-util-visit';
export const remarkValidateTabs = () => (tree) => {
visit(tree, 'mdxJsxFlowElement', (node, _idx, parent) => {
if (node.name === 'Tab') {
const parentElement = parent;
if (!parentElement || parentElement.name !== 'Tabs') {
console.warn('Please ensure that all <Tab> components are direct children of <Tabs>.');
}
}
});
};