summaryrefslogtreecommitdiff
path: root/packages/markdown/remark/src/rehype-escape.ts
blob: bb56166be212d90f14e2a5806a6e751138a1f863 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
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;
		});
	};
}