Skip to content

Rustdoc table row highlighting for even lines and code highlighting match #162662

Description

@DanielEScherzer

Code

/// Some documentation
///
/// | Heading |
/// | - |
/// | Before `Foo` after |
/// | Before `Bar` after |
fn main() {
    println!("Hello, world!");
}

Reproduction Steps

cargo doc

Expected Outcome

Table rows with code blocks have the code block highlighted in a way to render them separately from normal text

Actual Output

Even numbered rows in tables have the same background color as the code blocks. Relevant CSS (first selector includes other targets omitted for simplicity, both include other rules)

.docblock code, {
    background-color: var(--code-block-background-color);
}
.docblock table tbody tr:nth-child(2n) {
	background: var(--table-alt-row-background-color);
}
--table-alt-row-background-color: #f5f5f5;
--code-block-background-color: #f5f5f5;

Rendered result:

Image

Version

rustdoc 1.98.1 (48a229cea 2026-09-01)

Additional Details

@rustbot label +A-a11y A-rustdoc-ui

Activity

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

Metadata

Metadata

Assignees

Labels

A-a11yArea: Anything to do with accessibilityA-rustdoc-uiArea: Rustdoc UI (generated HTML)C-bugCategory: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.T-rustdoc-frontendRelevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions