-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
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): move metadata export after compiling MDX to avoid weird MDX parsing error. #2105
Conversation
Deploy preview for docusaurus-preview ready! Built with commit 8d92f08 |
Deploy preview for docusaurus-2 ready! Built with commit 8d92f08 |
Deploy preview for docusaurus-2 ready! Built with commit d74a94e |
Deploy preview for docusaurus-preview ready! Built with commit d74a94e |
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.
Will all of our markdown/MDX files have front matter? I think it's a requirement for us but not part of the spec. Wonder if this breaks for users who have markdown files which don't have front matter.
No it doesnt need to have frontmatter. Actually Ive always tested docusaurus 2 building 1000 files without any frontmatter at all. It also wont break if it doesnt have frontmatter. You can give it a try Btw the frontMatter export code was written by you 😂 |
Ooops. Obviously my memory is quite bad 😅
…On Tue, Dec 10, 2019 at 8:14 PM Endi ***@***.***> wrote:
frontMatter export PR here #1450
<#1450>
Authored by @yangshun <https://github.com/yangshun>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2105?email_source=notifications&email_token=AAKBCHI35RJUXVJAT7HK6PDQYBSJ3A5CNFSM4JYIIXZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGR2FPY#issuecomment-564372159>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKBCHKM4FHJIBYCI4LK67LQYBSJ3ANCNFSM4JYIIXZQ>
.
|
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