Skip to content

fix(theme): align inline code to the text baseline - #13065

Open
ziyodovanvar wants to merge 1 commit into
meta:mainfrom
ziyodovanvar:fix-inline-code-baseline
Open

ziyodovanvar wants to merge 1 commit into
meta:mainfrom
ziyodovanvar:fix-inline-code-baseline

Conversation

@ziyodovanvar

@ziyodovanvar ziyodovanvar commented Nov 16, 2026 •

Copy link
Copy Markdown

Pre-flight checklist

  • I have read the Contributing Guidelines on pull requests.
  • If this is a code change: I have written unit tests and/or added dogfooding pages to fully verify the new behavior.
  • If this is a new API or substantial change: the PR has an accompanying issue (closes #0000) and the maintainers have approved on my working plan.

Motivation

Fixes #10652.

Infima sets vertical-align: middle on every code element. Inline code also has vertical padding, so the box is taller than the surrounding text and the glyphs sit below the text baseline. This is most obvious in headings.

CodeInline now aligns that box to the baseline. Code blocks are unchanged, because they do not use this component.

Test Plan

  • pnpm exec vitest run packages/docusaurus-theme-classic/src/theme/CodeInline/__tests__/index.test.tsx
  • The local website could not be started here because this checkout requires Node.js >=26.13 and the machine has Node.js 24.19.0.
  • A reduced page confirmed the two alignments: vertical-align: middle drops the code below the line, and vertical-align: baseline keeps the glyphs on the text baseline.

Test links

Deploy preview: https://deploy-preview-_____--docusaurus-2.netlify.app/

Related issues/PRs

Summary by CodeRabbit

  • Style
    • Inline code now aligns with the text baseline for more consistent rendering.
    • Existing custom styling on inline code is preserved.

Infima vertically centers the inline code box. The box is taller than the
surrounding text, so the glyphs sit below the baseline. Align inline code
to the baseline instead.

Fixes meta#10652
@meta-cla meta-cla Bot added the CLA Signed Signed Facebook CLA label Nov 16, 2026
@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

CodeInline now applies a CSS class that sets inline code to baseline alignment. The component merges this class with any supplied className. A test checks the rendered text and class.

Changes: Inline code alignment

Layer / File(s) Summary
Baseline alignment behavior
packages/docusaurus-theme-classic/src/theme/CodeInline/styles.module.css, packages/docusaurus-theme-classic/src/theme/CodeInline/index.tsx, packages/docusaurus-theme-classic/src/theme/CodeInline/__tests__/index.test.tsx
The CSS rule sets vertical-align: baseline. CodeInline applies the CSS-module class and merges it with any supplied className. The test checks the rendered text and class.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Merge Risk: Minimal · up to f6f89

Inline code will align to the surrounding text baseline, including in headings. The change is narrow and low risk to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "fix(theme): align inline code to the text baseline" matches the main change. The raw summary shows CodeInline gaining a codeInline CSS class with vertical-align: baseline, and the PR object…
Linked Issues check Passed Issue #10652 requires inline code to align to the text baseline, including in a level-one heading. At head, CodeInline in packages/docusaurus-theme-classic/src/theme/CodeInline/index.tsx applies t…
Out of Scope Changes check Passed All changes at head relate to the objective of #10652. The changes are: the .codeInline CSS rule with explanatory comments, the CodeInline component change that adds the class and merges any suppl…
Full details: Title check

Explanation

The title "fix(theme): align inline code to the text baseline" matches the main change. The raw summary shows CodeInline gaining a codeInline CSS class with vertical-align: baseline, and the PR objectives state the goal is baseline alignment of inline code, which addresses linked issue #10652. The title is specific and follows a conventional commit style. The changeset also adds a test, which the title does not mention, but that is expected.

Full details: Linked Issues check

Explanation

Issue #10652 requires inline code to align to the text baseline, including in a level-one heading. At head, CodeInline in packages/docusaurus-theme-classic/src/theme/CodeInline/index.tsx applies the styles.codeInline class. styles.module.css sets .codeInline { vertical-align: baseline; }. This class selector overrides Infima's element-level code { vertical-align: middle; }. The rule applies to all inline code, so headings are covered. The reported behavior depends on that Infima rule, which the PR description and the issue both identify. The added unit test asserts that the rendered code has the codeInline class. It does not check computed alignment, so the visual result rests on the CSS rule and the author's manual reduced-page check, not on an automated test.

Full details: Out of Scope Changes check

Explanation

All changes at head relate to the objective of #10652. The changes are: the .codeInline CSS rule with explanatory comments, the CodeInline component change that adds the class and merges any supplied className with clsx, and a unit test for CodeInline. The component change is needed to apply the class. Code blocks do not use this component, so they are not affected, as the PR description states. No unrelated changes were found in the reviewed files.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: dd91b034-b6c2-4d32-a8ab-01ebee8dd6c3
Commits

Reviewing files that changed from the base of the PR and between 4c4ec4a and f6f89c3.

Files selected for processing: 3

  • packages/docusaurus-theme-classic/src/theme/CodeInline/__tests__/index.test.tsx
  • packages/docusaurus-theme-classic/src/theme/CodeInline/index.tsx
  • packages/docusaurus-theme-classic/src/theme/CodeInline/styles.module.css

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@netlify

netlify Bot commented Nov 16, 2026

Copy link
Copy Markdown

✅ [V2]

Built without sensitive environment variables

Name Link
🔨 Latest commit f6f89c3
🔍 Latest deploy log https://app.netlify.com/projects/docusaurus-2/deploys/6afabc60e43785867b1043ca
😎 Deploy Preview https://deploy-preview-13065--docusaurus-2.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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Signed Facebook CLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Code text not vertically aligned with regular text.

1 participant