-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
feat(theme-classic): Pass metaOptions to whole codeblock component tree. #11023
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
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Mar 23, 2025
✅ [V2]Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
⚡️ Lighthouse report for the deploy preview of this PR
|
ed0a579
to
2530d7e
Compare
Added, see #11017 (comment) (available as context instead of props) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Pre-flight checklist
Motivation
This PR is part of a series related to #11008 and it superceeds #11011 in the goal to splitup the work into more isolated refactoring/feature parts.
Note that this PR also includes the changes of previous steps and therefore the overall diff can be misleading. The best approach will be to review and merge every step individually and then rebase accordingly.
Intermediately the specific changes can be checked here: Danielku15/docusaurus@feature/codeblock-meta-4...Danielku15:docusaurus:feature/codeblock-meta-5
Step 1 (#11017): Splitup current parseLines logic (separation of concerns)
Step 2 (#11019): Parse metastring into metaOptions and use it across components.
Step 3 (#11021): Add parsing of any options specified in the metastring.
Step 4 (#11022): Add CodeBlockToken component to customize DOM of highlighted tokens.
Step 5 (this PR): Pass
metaOptions
to whole codeblock component tree.The motivation of this part is to allow users to customize the rendering of the components by utilizing any special metaOption which is applied to the code blocks.
Use cases are:
The
metaOptions
doesn't need to be passed explicitely to the CodeBlockToken as it is accessible throughprops.line.metaOptions
(See #11022).Test Plan
Automatic testing relies on existing integration tests.
Manual testing by checking
/docs/markdown-features/code-blocks
showed no impact of the change.If more testing is expected I'd need some guidance on how to typically such tests are written for Swizzled components.
Test links
Deploy preview: https://deploy-preview-11023--docusaurus-2.netlify.app/
Code Blocks: https://deploy-preview-11023--docusaurus-2.netlify.app/docs/markdown-features/code-blocks/
Related issues/PRs