[rustdoc] Wrap code blocks in <code> tag#88093
Conversation
|
r? @ollie27 (rust-highfive has picked a reviewer for you, use r? to override) |
Another shortcoming of rustdoc... Welcome to a huge years old codebase! :) For consistency it should be applied the same on equivalent items but I think it's a bit out of scope here. For things other than codeblocks, just having a
Well, not all But enforcing the existing is always a good idea and such a test would be very welcome. :) |
0c3f394 to
378d92c
Compare
|
I changed the newlines after |
378d92c to
ccd550e
Compare
|
I checked locally and it looks good to me. Thanks! @bors: r+ |
|
📌 Commit ccd550e has been approved by |
…laumeGomez Rollup of 8 pull requests Successful merges: - rust-lang#86123 (Preserve more spans in internal `rustc_queries!` macro) - rust-lang#87874 (Add TcpStream type to TcpListener::incoming docs) - rust-lang#88034 (rustc_privacy: Replace `HirId`s and `DefId`s with `LocalDefId`s where possible) - rust-lang#88050 (Remove `HashStable` impls for `FileName` and `RealFileName`) - rust-lang#88093 ([rustdoc] Wrap code blocks in `<code>` tag) - rust-lang#88146 (Add tests for some `feature(const_evaluatable_checked)` incr comp issues) - rust-lang#88153 (Update .mailmap) - rust-lang#88159 (Use a trait instead of the now disallowed missing trait there) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This PR modifies Rustdoc output so that fenced code snippets, items and whole file source codes are wrapped in
<pre><code>instead of just<pre>. This should improve the semantic meaning of the generated content.I'm not sure what to do about
render_attributes_in_preandrender_attributes_in_code. These functions were clearly expected to be used for things inside<pre>or<code>, and since I added<code>in this PR, some of them will be used in a different context than before. However, it seems to me that even before they were not consistent. For example,item_constantusedrender_attributes_in_codefor its attributes, however there was no<code>used for constants before this PR...Should I create some
rustdoc-guitests? For example to check that all<pre>tags have a<code>child?Fixes: #88020