Open remcohaszing opened 1 year ago
I have some vague ideas, but none of these are ideal.
Firstly, let’s determine what it means for IntelliSense to apply a transformer.
Transformers can:
rehype-mdx-title
, remark-mdx-frontmatter
)_createMdxContent
, which become available inside JSX and expressions.rehype-mdx-code-props
, remark-mdx-math-enhanced
).Most transformers transform the hast in ways that doesn’t affect the editor experience. For example remark-toc
injects a table of contents, but that doesn’t introduce variables nor remove anything relevant.
Some potential solutions:
Initial checklist
Problem
Currentle the language service only supports unified plugins that register micromark syntax extensions. It doesn’t support transformer plugins yet.
For example,
remark-mdx-frontmatter
,rehype-mdx-title
, andrecma-nextjs-static-props
provide a transformers that injects ESM exports into the AST.Solution
TypeScript needs to be aware of injected variables and their types. I don’t know how yet.
Alternatives
:shrug: