UNPKG

@mintlify/common

Version:

Commonly shared code within Mintlify

13 lines (12 loc) 385 B
import { fromHtml } from 'hast-util-from-html'; import { visit } from 'unist-util-visit'; export const rehypeRawComponents = () => { return (tree) => { visit(tree, 'raw', (raw, i, parent) => { const rawAst = fromHtml(raw.value, { fragment: true }); if (parent && i) { parent.children[i] = rawAst; } }); }; };