-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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): ignore import declarations in excerpt #2380
Conversation
Deploy preview for docusaurus-2 ready! Built with commit 17c093d |
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.
Import statements can be written anywhere on the page, so if users want to avoid this problem in most cases they can shift it below a little. I rather not add brittle hacks to our code.
But people usually import components at the very beginning of the file, so we are only interested in this place. And given the current architecture, this is a not bad solution. |
Should I close this PR? |
Ok let's close this. Sorry about this. |
No problem, although I did not understand why this is a bad way, given that we need to remove the imports declarations at the top of the file, in the same way we could remove Markdown markup. |
…ix-ignore-imports-excerpt
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.
Thanks. Should we filter out require()
statements as well? Some people might be using it.
Motivation
Resolve #2373
Resolve #2601
Have you read the Contributing Guidelines on pull requests?
Yes.
Test Plan
Compare MDX page with
import
s, eg:Description: import ColorGenerator from '@site/src/components/ColorGenerator';
Description: This doc guides you through migrating an existing Docusaurus 1 site to Docusaurus 2.
Related PRs
(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/docusaurus, and link to your PR here.)