Skip to content

Bad rendering Markdown table with rustdoc #100994

Closed
@ValentinColin

Description

@ValentinColin

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-rustdoc-uiArea: Rustdoc UI (generated HTML)C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions