You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

17 lines
472 B

import { type HastRoot, type UnifiedTransformer, unistUtilVisit } from 'dumi';
/**
* plugin for modify hast tree when docs compiling
*/
function rehypeAntd(): UnifiedTransformer<HastRoot> {
return tree => {
unistUtilVisit.visit(tree, 'element', node => {
if (node.tagName === 'DumiDemoGrid') {
// replace DumiDemoGrid to DemoWrapper, to implement demo toolbar
node.tagName = 'DemoWrapper';
}
});
};
}
export default rehypeAntd;