fix(v2): handle case when <code> children is not a string#1584
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 |
yangshun
left a comment
There was a problem hiding this comment.
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
