Skip to content

Bad rendering Markdown table with rustdoc #100994

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
ValentinColin opened this issue Aug 25, 2022 · 0 comments · Fixed by #101046
Closed

Bad rendering Markdown table with rustdoc #100994

ValentinColin opened this issue Aug 25, 2022 · 0 comments · Fixed by #101046
Labels
A-rustdoc-ui Area: Rustdoc UI (generated HTML) C-bug Category: This is a bug.

Comments

@ValentinColin
Copy link

I tried this code:

//! lib.rs

pub trait FooTrait {
    fn func();
}

/// Struct doc.
///
/// | header1                  | header2                  |
/// |--------------------------|--------------------------|
/// | Lorem Ipsum, Lorem Ipsum | Lorem Ipsum, Lorem Ipsum |
pub struct Foo {}

impl FooTrait for Foo {
    /// Trait impl func doc for foo struct.
    ///
    /// | header1                  | header2                  |
    /// |--------------------------|--------------------------|
    /// | Lorem Ipsum, Lorem Ipsum | Lorem Ipsum, Lorem Ipsum |
    fn func() {
        println!();
    }
}

I expected to see this happen:
The Markdown table in the doc is supposed to have the same rendering in a trait implementation and elsewhere.

Instead, this happened: explanation
The Markdown table in the doc of a trait function implementation is not correct.

There is no separation between columns and rows. Except for the header table.

Also, I don't know if it's intentional but the table header is not centered (see header1 and header2), as it is supposed to be in markdown.

screenshot_doc

Meta

rustc --version --verbose:
I tested on both Stable and Nightly channels.

# Stable
rustc 1.63.0 (4b91a6ea7 2022-08-08)
binary: rustc
commit-hash: 4b91a6ea7258a947e59c6522cd5898e7c0a6a88f
commit-date: 2022-08-08
host: x86_64-unknown-linux-gnu
release: 1.63.0
LLVM version: 14.0.5

# Nightly
rustc 1.65.0-nightly (addacb587 2022-08-24)
binary: rustc
commit-hash: addacb5878b9970ebc1665768a05cb601e7aea15
commit-date: 2022-08-24
host: x86_64-unknown-linux-gnu
release: 1.65.0-nightly
LLVM version: 15.0.0
@ValentinColin ValentinColin added the C-bug Category: This is a bug. label Aug 25, 2022
@Nemo157 Nemo157 added the A-rustdoc-ui Area: Rustdoc UI (generated HTML) label Aug 25, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Aug 26, 2022
rustdoc: remove incorrect CSS selector `.impl-items table td`

Fixes rust-lang#100994

This selector was added in c7312fb. The bug can be seen at <https://doc.rust-lang.org/1.27.0/alloc/slice/trait.SliceIndex.html#foreign-impls>.

This rule was added to help with a `<table>` that was used for displaying the function signature [src] lockup. That lockup was changed in 34bd2b8 to use flexbox instead, leaving this selector unused (at least, for its original purpose).
JohnTitor added a commit to JohnTitor/rust that referenced this issue Aug 27, 2022
rustdoc: remove incorrect CSS selector `.impl-items table td`

Fixes rust-lang#100994

This selector was added in c7312fb. The bug can be seen at <https://doc.rust-lang.org/1.27.0/alloc/slice/trait.SliceIndex.html#foreign-impls>.

This rule was added to help with a `<table>` that was used for displaying the function signature [src] lockup. That lockup was changed in 34bd2b8 to use flexbox instead, leaving this selector unused (at least, for its original purpose).
@bors bors closed this as completed in 25eb52f Aug 27, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-rustdoc-ui Area: Rustdoc UI (generated HTML) C-bug Category: This is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants