-
-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support the components
prop
#260
Labels
🗄 area/interface
This affects the public interface
💪 phase/solved
Post is done
🧒 semver/minor
This is backwards-compatible change
🦋 type/enhancement
This is great to have
Comments
remcohaszing
added
🦋 type/enhancement
This is great to have
🗄 area/interface
This affects the public interface
🧒 semver/minor
This is backwards-compatible change
👍 phase/yes
Post is accepted and can be worked on
labels
Jan 13, 2023
8 tasks
New plan: Let the user explicitly define which components may be passed via DefinitelyTyped/DefinitelyTyped#67374. It’s still possible to override them locally using the |
remcohaszing
added a commit
that referenced
this issue
Feb 12, 2024
This defines the `_components` variable in `_createMdxContent`. This variable contains all components injected through the `components` prop, a reference to `props`, and all local variables. All MDX JSX tags are prefixed with `_components.` in the virtual code. As a result, components declared in the `components` prop are allowed. Components from both the `components` prop and local variables are displayed in the autocomplete. A downside of this approach is that documentation is lost for local components. To mitigate this, only unknown JSX tags are prefixed. Only MDX JSX tags are handled yet. JSX from estree not yet. Refs #260
remcohaszing
added a commit
that referenced
this issue
Feb 12, 2024
This defines the `_components` variable in `_createMdxContent`. This variable contains all components injected through the `components` prop, a reference to `props`, and all local variables. All MDX JSX tags are prefixed with `_components.` in the virtual code. As a result, components declared in the `components` prop are allowed. Components from both the `components` prop and local variables are displayed in the autocomplete. A downside of this approach is that documentation is lost for local components. To mitigate this, only unknown JSX tags are prefixed. Only MDX JSX tags are handled yet. JSX from estree not yet. Refs #260
5 tasks
remcohaszing
added a commit
that referenced
this issue
Feb 12, 2024
This defines the `_components` variable in `_createMdxContent`. This variable contains all components injected through the `components` prop, a reference to `props`, and all local variables. All MDX JSX tags are prefixed with `_components.` in the virtual code. As a result, components declared in the `components` prop are allowed. Components from both the `components` prop and local variables are displayed in the autocomplete. A downside of this approach is that documentation is lost for local components. To mitigate this, only unknown JSX tags are prefixed. Only MDX JSX tags are handled yet. JSX from estree not yet. Refs #260
remcohaszing
added a commit
that referenced
this issue
Feb 20, 2024
This was referenced Feb 20, 2024
Closed
remcohaszing
added a commit
that referenced
this issue
Feb 22, 2024
This comment has been minimized.
This comment has been minimized.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
🗄 area/interface
This affects the public interface
💪 phase/solved
Post is done
🧒 semver/minor
This is backwards-compatible change
🦋 type/enhancement
This is great to have
Initial checklist
Problem
MDX allows to use the
components
prop to pass custom components.The MDX code will be transformed to the following JSX before sending to TypeScript:
Solution
We can extract all MDX elements and generate types for them to some extent. Components may be injected by a provider hook, so they should always be optional.
JSX.IntrinsicElements
Alternatives
🤷
The text was updated successfully, but these errors were encountered: