summaryrefslogtreecommitdiff
path: root/packages/markdown/remark/src/rehype-expressions.ts
blob: 26d04623da359043d02aede11f01aaee2dfa5bc4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
import { map } from 'unist-util-map';

export default function rehypeExpressions(): any {
	return function (node: any): any {
		return map(node, (child) => {
			if (child.type === 'mdxTextExpression') {
				return { type: 'text', value: `{${(child as any).value}}` };
			}
			return child;
		});
	};
}