astro/packages/markdown/remark/src/rehype-escape.ts
2021-12-22 16:11:05 -05:00

12 lines
304 B
TypeScript

import { SKIP, visit } from 'unist-util-visit';
export default function rehypeEscape(): any {
return function (node: any): any {
return visit(node, 'element', (el) => {
if (el.tagName === 'code' || el.tagName === 'pre') {
el.properties['data-astro-raw'] = true;
}
return el;
});
};
}