astro/packages/markdown/remark/src/rehype-escape.ts
Juan Martín Seery b2c37385f9
chore: changed data-astro-raw to is:raw (#2706)
* chore: changed `data-astro-raw` to `is:raw`

* changesets
2022-03-03 11:34:36 -06:00

12 lines
296 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['is:raw'] = true;
}
return el;
});
};
}