Skip to content

[docs] Add background to inline code tags#4978

Merged
aarongarciah merged 6 commits into
mui:masterfrom
aarongarciah:docs-code-inline-glow-up
Jun 10, 2026
Merged

[docs] Add background to inline code tags#4978
aarongarciah merged 6 commits into
mui:masterfrom
aarongarciah:docs-code-inline-glow-up

Conversation

@aarongarciah

@aarongarciah aarongarciah commented Jun 5, 2026

Copy link
Copy Markdown
Member

Closes #4009
Previous attempt: #4043

before after
Screenshot 2026-06-05 at 12 12 07 Screenshot 2026-06-05 at 12 11 55

@aarongarciah aarongarciah requested a review from dav-is June 5, 2026 10:09
@aarongarciah aarongarciah added the docs Improvements or additions to the documentation. label Jun 5, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jun 5, 2026

Copy link
Copy Markdown

commit: 4b8a6d0

@code-infra-dashboard

code-infra-dashboard Bot commented Jun 5, 2026

Copy link
Copy Markdown

Bundle size

Bundle Parsed size Gzip size
@base-ui/react 0B(0.00%) 0B(0.00%)

Details of bundle changes

Performance

Total duration: 1,181.81 ms -217.04 ms(-15.5%) | Renders: 50 (+0) | Paint: 1,789.05 ms -310.12 ms(-14.8%)

Test Duration Renders
Slider mount (300 instances) 147.02 ms ▼-55.88 ms(-27.5%) 3 (+0)
Popover mount (300 instances) 63.08 ms ▼-21.37 ms(-25.3%) 1 (+0)
Checkbox mount (500 instances) 62.04 ms ▼-21.29 ms(-25.6%) 1 (+0)
Select open (500 options) 51.22 ms ▼-14.35 ms(-21.9%) 14 (+0)

8 tests within noise — details


Check out the code infra dashboard for more information about this PR.

@netlify

netlify Bot commented Jun 5, 2026

Copy link
Copy Markdown

Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 4b8a6d0
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6a296edc60eaae0008d27b01
😎 Deploy Preview https://deploy-preview-4978--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@aarongarciah

Copy link
Copy Markdown
Member Author

@dav-is the new local rehype plugin seems the only reliable way of doing this without introducing any runtime. The idea is that instances like the one in the screenshot below (HTML tags) are kept without a background.

image

If you have any ideas on how to make this simpler, please share. CSS-only solutions required checking for certain .pl-* class names being present inside the <code> tag.

@dav-is

dav-is commented Jun 8, 2026

Copy link
Copy Markdown
Member

If you have any ideas on how to make this simpler

Are you opposed to using :has() selectors? The performance should be fine, given it only needs to check one level deep on inline code blocks. It's set to become Baseline Widely Avaiable in July (supported in all browsers for 30 months).

code[data-inline]:not(:has(> .di-ht)) {
  /* */
}

If not, your PR uses the enhancers API as intended 👍🏼

@aarongarciah

Copy link
Copy Markdown
Member Author

Are you opposed to using :has() selectors?

@dav-is that was my first attempt, but targeting .pl-* classes instead of the docs infra ones (.di-*). It felt wrong, but it's growing on me. Seems way simpler, although more brittle.

@aarongarciah aarongarciah force-pushed the docs-code-inline-glow-up branch from e925463 to 71a917c Compare June 9, 2026 14:47
@aarongarciah

Copy link
Copy Markdown
Member Author

@dav-is you convinced me. Updated the PR to stick to the CSS-only approach.

@aarongarciah aarongarciah merged commit c9bc7c2 into mui:master Jun 10, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to the documentation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[docs] Blue color for non-links is problematic

2 participants