astro/packages/markdown-support/src/rehype-expressions.ts
Nate Moore 8f4562afbe
Add support for named slots (#661)
* feat: support named slots, slot fallback content

* docs: document slots

* chore: add changeset

* fix: build errors

* chore: prefer `patch` version
2021-07-12 13:07:39 -05:00

12 lines
321 B
TypeScript

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;
});
};
}