-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
fix(v2): handle case when <code> children is not a string #1584
Conversation
Deploy preview for docusaurus-2 ready! Built with commit e7fd705 |
Deploy preview for docusaurus-preview ready! Built with commit e7fd705 |
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 seems ok as a temporary fix but I don't think it's the most robust approach 🤔
Ideally we find out the reason for the extra newline and fix it, or trim() only when it's a string.
Hmm.. I feel this is the long term solution though. Syntax highlighting doesnt work if the children is not a string. Even mdxjs.com had error for this Official mdxjs.com also use children.trim ! |
Even if trim is removed. It still error out (i tried locally) because Highlight expect a string, not react element |
I suppose it's not recommended to use |
Yeah actually it was true. Why would someone use < But well, let's be the nice guy who handles even this kind of abuse |
Document this in #1578 |
Motivation
Fix #1581
We should only pass our codeblock component if it's content is a string.
Note that this bug is because MDX turns
<div>
or react component to real react element.Have you read the Contributing Guidelines on pull requests?
yes
Test Plan
Before
After