You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expected to see this happen: Either the source code is shown side-by-side with the line numbers, or the line numbers aren't shown at all.
Instead, this happened:
I think there's a very old issue about this that was fixed for newer browsers, but I can't seem to find it. This has definitely happened on ancient docs in docs.rs before. cc @ojeda - is this something you care about? I saw someone mentioned it in https://lkml.org/lkml/2021/4/16/49 but I don't know if that was actually serious.
Meta
Not sure what rust-for-linux is using, but I can replicate the issue with rustdoc 1.53.0-nightly (d0695c9 2021-04-12).
I think we will need to see the overall sentiment from the kernel community. Reading the source code directly is good enough in my opinion, since Markdown is designed to be readable as-is, but we will see.
Perhaps it is easier to have a plain-text renderer in rustdoc than to try to keep the other docs always working in TUI browsers.
Perhaps it is easier to have a plain-text renderer in rustdoc than to try to keep the other docs always working in TUI browsers.
That will be a lot more work 😅 to be perfectly frank I don't think rustdoc will ever have a renderer other than HTML, my hope is that the JSON format will stabilize enough that people can use it to write their own community backends.
Reacted by Miguel Ojeda, Matthias Beyer and Violet/Multi
one possible workaround would be adding the attributes hidden="" style="display: block;" to the pre element that contains the line numbers. since hidden is often implemented as display: none;, this will show the numbers on most modern browsers (only tested firefox), and not show it on browsers that don't support css.
Activity
ojeda commentedon Apr 16, 2021
I think we will need to see the overall sentiment from the kernel community. Reading the source code directly is good enough in my opinion, since Markdown is designed to be readable as-is, but we will see.
Perhaps it is easier to have a plain-text renderer in
rustdocthan to try to keep the other docs always working in TUI browsers.ojeda commentedon Apr 16, 2021
Currently we recommend 2021-02-20 as that's the one we use in our CI.
By the way, thanks a lot for taking a look at this! :)
jyn514 commentedon Apr 16, 2021
That will be a lot more work 😅 to be perfectly frank I don't think rustdoc will ever have a renderer other than HTML, my hope is that the JSON format will stabilize enough that people can use it to write their own community backends.
ojeda commentedon Apr 16, 2021
Sure! A format-independent renderer like the JSON one would be enough.
lolbinarycat commentedon Jan 16, 2025
one possible workaround would be adding the attributes
hidden="" style="display: block;"to thepreelement that contains the line numbers. sincehiddenis often implemented asdisplay: none;, this will show the numbers on most modern browsers (only tested firefox), and not show it on browsers that don't support css.Rollup merge of rust-lang#136829 - GuillaumeGomez:move-line-numbers-i…
Unrolled build for rust-lang#136829