-
Notifications
You must be signed in to change notification settings - Fork 701
MD component prop pass-thru #996
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
Conversation
| size: number; | ||
| }>; | ||
|
|
||
| type MdComponentProps = { [key: string]: any }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not thrilled about how loose this type is, but technically any props from valid MD components can be passed here, and the user can supply their own component map (in which case, we can't account for the prop types their components will accept). Seems like it'd be hard to make this as strict as possible - and making this unnecessarily strict is also a bad idea (since TS will yell about it not recognizing props that might actually be valid).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also think leaving it open gives us API flexibility. We could also use the Record type but I think that's two sides of the same coin here.
carloskelly13
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great, but let's actually add back the example of this to examples/js/index.js perhaps on line 195.
|
Great work @gksander and great suggestion @carlos-kelly ! One extra tip -- when changing |
Description
This PR allows the user to pass a
componentPropsprop to theMarkdownsuite of components, and these props will be passed down to each individual component generated by the MD conversion process. E.g.,will style the header with a color of blue, background of red. This gives the user some control over how their markdown components render elements.
Type of Change
Please delete options that are not relevant (including this descriptive text).
How Has This Been Tested?
Tests added to
markdown.test.jsto test these changes. You can also try thecomponentPropsprop out within the JS example slides.