diff options
Diffstat (limited to 'packages/markdown-support/src/rehype-expressions.ts')
-rw-r--r-- | packages/markdown-support/src/rehype-expressions.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/packages/markdown-support/src/rehype-expressions.ts b/packages/markdown-support/src/rehype-expressions.ts new file mode 100644 index 000000000..2762f54fc --- /dev/null +++ b/packages/markdown-support/src/rehype-expressions.ts @@ -0,0 +1,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.value}}` } + } + return child; + }) + } +} |