-
-
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
feat(theme-classic): allow collapsing part of code blocks #5783
Conversation
✔️ [V2] 🔨 Explore the source changes: f8e226c 🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/61e6d2471d5f19000896cbaf 😎 Browse the preview: https://deploy-preview-5783--docusaurus-2.netlify.app |
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-5783--docusaurus-2.netlify.app/ |
2d7f4bf
to
ba91916
Compare
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.
I find this feature interesting and we could definitively use something like this, but it's probably not so easy to get right, and not a high priority either
Some concerns:
-
Does it really need to be in core? Maybe we can instead think of a more generic API so that users can build this kind of feature in userland, inventing their own markers? => smaller and more flexible API surface => less to maintain
-
Inability to mix top-level highlight with sample markers
-
Current UX is unable to contain multiple samples. GitHub diff/PR UX may be better?
-
How does it work with progressive enhancement in mind and JS disabled? (may not matter much, as the meat of the content remains available)
@@ -148,6 +153,14 @@ export function parseLines( | |||
highlightRange += `${highlightBlockStart!}-${lineNumber - 1},`; | |||
break; | |||
|
|||
case 'sample-start': |
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.
wonder if sample is the best marker name? 🤔
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.
This is directly from the Kotlin docs example in #2215: // sampleStart
in that case. We can certainly bikeshed about this, and if we are to just build a generic API, maybe even no bikeshedding at all :D
Sure, now we are back to the question of allowing more markers 👍 I'll look into making |
Now that #7178 is merged, I will be closing this, because I feel like this is better implemented in userland, since different people will have ideas about different UX with such complicated feature. The linked issue will be closed as well. cc @hamza1311 I know Yew will benefit from this, but feel free to swizzle |
Motivation
Resolve #2215. I need this because most of the config tutorials on the website contain a lot of boilerplate to provide the context, but collapsing them makes the doc much more concise.
Have you read the Contributing Guidelines on pull requests?
Yes
Test Plan
Preview: https://deploy-preview-5783--docusaurus-2.netlify.app/docs/next/sidebar/#collapsible-categories
TODO
<Collapsible>
)