]> git.lizzy.rs Git - rust.git/commit
Rollup merge of #105442 - notriddle:notriddle/docblock-table-css, r=GuillaumeGomez
authorMatthias Krüger <matthias.krueger@famsik.de>
Fri, 9 Dec 2022 06:25:46 +0000 (07:25 +0100)
committerGitHub <noreply@github.com>
Fri, 9 Dec 2022 06:25:46 +0000 (07:25 +0100)
commit441669c382298661db59cdf4374dbd40ab75b222
treeaae293388492ec26ce63a07d0dc4f74021a7ac44
parent4b09861a68f71539919c6d5c880a1c528b7be8ab
parent34700f6594436b49005151ee12dd2ae06c7cad03
Rollup merge of #105442 - notriddle:notriddle/docblock-table-css, r=GuillaumeGomez

rustdoc: clean up docblock table CSS

# Preview

http://notriddle.com/notriddle-rustdoc-demos/table-2/test_dingus/fn.test.html

# Before

![image](https://user-images.githubusercontent.com/1593513/206364287-1b80eaaf-2e0e-4138-8b56-4aa8ff39abac.png)

# After

![image](https://user-images.githubusercontent.com/1593513/206364209-d287d165-31be-4de1-9b43-05b35ce2a86b.png)

# Details

* The rule `display: block` had no noticeable effect. Technically, because markdown tables have a tbody and thead, they get wrapped in an [anonymous table box] in the CSS tree, nested within the `<table>` element's block layout box.

  This rule was added in #87230 to make the table side-scrolling, but this same issue was doubly fixed in #88742 by wrapping it in an explicit `<div>` tag. Since accessibility advocates recommend the wrapper div over marking the table as `display: block`, we'll stick with that.

  https://adrianroselli.com/2020/11/under-engineered-responsive-tables.html

* The rule `width: calc(100% - 2px)` had no visible effect, because the anonymous table box was not affected.

* The style is tweaked to basically be the same style GitHub uses. In particular, it adds zebra stripes, and removes dotted borders.

  https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/Markdown.20table.20styling

[anonymous table box]: https://www.w3.org/TR/CSS2/tables.html#anonymous-boxes
src/librustdoc/html/static/css/rustdoc.css