Skip to content

Custom Elements in react-remark #616

Discussion options

You must be logged in to vote

I want the Button tag in my MD to render to my button class in React. Is there a way to do this?

Depends on the exact behavior you want.
HTML will map both <button> and <Button> (and all other upper and lowercase combinations) to button, and if that's what you're looking for rehypeReactOptions should work fine.
If you want to differentiate between <button> and <Button>, then you want JSX in markdown instead of HTML in markdown, which is where MDX (also built on remark) could help https://mdxjs.com/advanced/runtime

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by ChristianMurphy
Comment options

You must be logged in to vote
1 reply
@piscopancer
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants