astro/packages/markdown/remark/src/rehype-escape.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

13 lines
296 B
TypeScript
Raw Normal View History

2021-11-10 17:34:31 -06:00
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;
2021-11-10 17:34:31 -06:00
}
return el;
});
};
}