Improve styling of <span class="stab"> tags in the documentation's main body #101874
Labels
A-rustdoc-ui
Area: Rustdoc UI (generated HTML)
C-bug
Category: This is a bug.
T-rustdoc
Relevant to the rustdoc team, which will review and decide on the PR/issue.
The Problem
If one tries to put feature labels in the main body of the documentation (what goes inside
<div class="docblock">
) they get styled differently from the one automatically inserted byrustdoc
running with#![feature(doc_auto_cfg)]
. In particular the layout is bad and can cause the appearance of scrollbars on the right hand side of each involved paragraph.Here is an example picture:
The desirable look would of course be
Code to generate the example documentation above.
Cargo.toml
:src/lib.rs
:The Cause
The reason is that
rustdoc.css
has a special rule for.module-item .stab, .import-item .stab
, whereas it does not address.stab
tags appearing as descendant of.docblock
tags.The Fix
From a crate developer's point of view, the fix for this is simple enough: just inject the following CSS
so that they are rendered the same way as the ones generated by
rustdoc
'sdoc_auto_cfg
labels.The Request
Is there any chance that this CSS gets included in the official
rustdoc.css
style?The fix would probably consist in adding
.docblock .stab
torust/src/librustdoc/html/static/css/rustdoc.css
Lines 1064 to 1074 in 4f372b1
except that we don't want the left margin, so probably a dedicated rule is more appropriate.
The text was updated successfully, but these errors were encountered: