fix(v2): move metadata export after compiling MDX to avoid weird MDX parsing error. #2105
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Move metadata export after compiling the MDX to avoid weird MDX parsing error.
Although we've fixed #2095 (MDX thinking that metadata was part of paragraph), there might be some other unexpected case.
For example:
This will error out, because it is unclosed (funnily it thinks its unclosed because style must always have
</style>
counterpart. And MDX think metadata is part of the JSXhttps://mdxjs.com/playground
If its closed properly, it doesnt error. Now I'm pretty confused how they determine HTML or JSX
A real scenario is https://github.com/CanopyTax/single-spa.js.org/blob/master/docs/separating-applications.md
Now, we will just do the export on top level on mdx-loader part. See code in this PR
packages/docusaurus-mdx-loader/src/index.js
Have you read the Contributing Guidelines on pull requests?
yes
Test Plan
Test with this markdown. No more error.
Hot reload still working and everything