-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
refactor(v2): add @theme-init alias to give access to initial components #2464
Conversation
Deploy preview for docusaurus-2 ready! Built with commit bdedcbc |
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.
Not really understanding this PR well. Why can't you use the @theme-original
?
Because using
While
Do you see the difference? Do you understand now? And so we can use it for HOC. |
Any thoughts? Still not clear? It seems to me that this is a good way to get rid of code duplication in the live code block component, because it is annoying to duplicate changes every time. |
* feat: support comments for code highlighting * docs(v2): demonstrate highlighting with comments * chore: remove debugging console.log * fix: disable when language is undefined
Code highlighting via comments works as expected https://deploy-preview-2464--docusaurus-2.netlify.com/docs/next/markdown-features/#line-highlighting (in contrast to https://v2.docusaurus.io/docs/next/markdown-features/#line-highlighting) |
@yangshun I would really not like to close this PR, but I don't see you interested in it :( |
@yangshun can you accept this PR? Am I tired of updating it every time according to |
Motivation
I have long wanted to get rid of code duplication in code block components (one basic / one with live block) and, inspired by PR #2455, I realized how this can be achieved by creating a HOC and using the basic code block component as a wrapped component.
To do this, we need a new alias, with which we can get the "initial" component - from the theme itself, not overridden by any plugins.
In this PR, both the code for adding this alias and the refactoring of code block components are simultaneously presented in order to demonstrate it in action. If there is a green light, then I can split this PR into two separate ones.
Have you read the Contributing Guidelines on pull requests?
Yes
Test Plan
Is an new test needed for this?
See this section on preview website, where basic code blocks and live editor are used.
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.)