-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[wesbite] Remove duplicate MarkdownElement component #42028
[wesbite] Remove duplicate MarkdownElement component #42028
Conversation
Netlify deploy previewhttps://deploy-preview-42028--material-ui.netlify.app/ Bundle size report |
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 good, same comment as in #42011 (comment)
The highlight seems to deal badly with horizontal overflow:
And this is probably not in scope for this PR, but I noticed some layout shifts on the homepage when switching between examples, once to go to the loading state, and a second time when rendering the example:
Screen.Recording.2024-04-29.at.11.34.21.mov
I can maybe tackle these on a separate PR? There's another PR #38604 tackling the homepage product suite section that might tackle the layout shift a bit. And the code highlight there might be trickier to tackle, I imagine it'll require wrapping the code lines using Prism, somehow. |
Perhaps we can use a plugin for that? |
That sounds like a good idea! And it'd tackle a docs-infra issue (#41509) I had opened a while ago, too :) |
However, I assume the bad thing about going with the "native Prism" option is losing the animation. Either way, let me know if this PR is in good shape to be merged, and then we can continue discussing these follow-up improvements elsewhere! 😬 |
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 good 👍
Personally, I wouldn't mind. The way the plugin does highlighting is more familiar to how code editors highlight, and the smooth scroll when scrolling it into view would be enough visual feedback for me. In any case, even if we want to keep the animation, building this as a prisma plugin could give us access to the internals we need for a stable implementation. |
export interface HighlightedCodeProps { | ||
code: string; | ||
component?: React.ElementType; |
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 PR is a continuation of #42022.
MarkdownElement
component, whose sole purpose was to strip away the "block" design from the code block so it worked properly within the marketing pages showcase sectionplainStyle
prop to theHighlightedCode
component, which now controls how thepre
element is rendered. That concentrates these different design options in a single component, thus not having twoMarkdownElement
components with essentially the same purposeThis has been explored in #42011 and it seemed to make sense there!