-
-
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(theme-classic): allow nested task lists to preserve the indent #7438
Conversation
3be50ab
to
4ddc864
Compare
✅ [V2]
To edit notification comments on pull requests, go to your Netlify site settings. |
⚡️ Lighthouse report for the deploy preview of this PR
|
✅ [V2]
To edit notification comments on pull requests, go to your Netlify site settings. |
Size Change: 0 B Total Size: 796 kB ℹ️ View Unchanged
|
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.
Looks like it's working, but why remove MDXUl instead of encapsulating this logic here?
Note that the bullets are not rendered for all items
I prefer GitHub style but it looks more complicated to achieve (using negative margins etc) and nobody asked for this yet so not a big deal 🤷
@@ -12,8 +12,8 @@ import MDXA from '@theme/MDXComponents/A'; | |||
import MDXPre from '@theme/MDXComponents/Pre'; | |||
import MDXDetails from '@theme/MDXComponents/Details'; | |||
import MDXHeading from '@theme/MDXComponents/Heading'; | |||
import MDXUl from '@theme/MDXComponents/Ul'; |
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.
why remove MDXUl?
It is a "safe" component meant to be swizzled and customized. Removing it means a breaking change.
import MDXImg from '@theme/MDXComponents/Img'; | ||
import './task-list.css'; |
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.
MDXUl is a better place to import the CSS there. I'd like to avoid such imports in MDXComponents and just keep it as a simple map
BTW if MDX injets a .contains-task-list
, it does not necessarily mean that we have to apply it, and we can keep using scoped CSS modules
OK, I've added
|
Pre-flight checklist
Motivation
I realized that nested task lists do not behave as intended. For example, on the TS-ESLint website:
The source is like:
The reason is because we applied
padding-left: 0
to all lists that contain task lists. However, we should only do this for the top-level lists.Test Plan
Test links
Deploy preview: https://deploy-preview-7438--docusaurus-2.netlify.app/tests/pages/markdownPageTests/#task-list
Note that the bullets are not rendered for all items, tasks or not. For reference, here's how GitHub renders it:
I'm not sure if folks will prefer this style, but it also makes sense to me, compared to ours, which will always remove the bullet even when the current list item is not a task item.
Related issues/PRs