about summary refs log tree commit diff
path: root/src/librustdoc/html/render
AgeCommit message (Collapse)AuthorLines
2021-06-20Use Tera templates for rustdoc.Jacob Hoffman-Andrews-1/+22
Replaces a format!() call in layout::render with a template expansion. Introduces a `templates` field in SharedContext so parts of rustdoc can share pre-rendered templates. This currently builds in a copy of the single template available, like with static files. However, future work can make this live-loadable with a perma-unstable flag, to make rustdoc developers' work easier.
2021-06-20"(const: unstable)" for stable-but-const-unstableDeadbeef-9/+31
2021-06-19rustdoc: Introduce new `DynTrait` type for better representation of trait ↵Justus K-0/+1
objects
2021-06-19Rollup merge of #86370 - ↵Yuki Okushi-2/+3
matteo-briani:fix-rustdoc-stabilized-versions-layout, r=GuillaumeGomez Fix rustdoc stabilized versions layout Fixes #86342 r? `@GuillaumeGomez`
2021-06-18Resolve intra-doc links in summary descMichael Howell-4/+9
Before: ![rustdoc-intra-doc-link-summary-before](https://user-images.githubusercontent.com/1593513/122623069-9d995e80-d04f-11eb-8d46-ec2ec126bb5e.png) After: ![rustdoc-intra-doc-link-summary](https://user-images.githubusercontent.com/1593513/122623076-a4c06c80-d04f-11eb-967a-f5916871c34b.png)
2021-06-18Auto merge of #86322 - trinity-1686a:rustdoc-fix-overflow-recursive-deref, ↵bors-13/+0
r=jyn514 fix rustdoc stack overflow on mutually recursive Deref fix #85095 fix #85037
2021-06-17rustdoc: add optional woff2 versions of Source Serif and Source CodeTrevor Spiteri-0/+6
2021-06-17Fix rustdoc stabilized versions layoutMatteo Briani-2/+3
2021-06-16Restore details for Impls on Foreign TypesJacob Hoffman-Andrews-4/+10
These were previously removed along with the details in the "Implementors" section of trait pages. But for "Implementations on Foreign Types," we need to include the details because they will not be documented anywhere else.
2021-06-16Fix target highlighting in rustdoc.Jacob Hoffman-Andrews-36/+21
Also factor out outer_version and const_outer_version into render_rightside.
2021-06-16Move anchor earlier in the DOM for easier layoutJacob Hoffman-Andrews-8/+11
2021-06-16Factor out render_rightsideJacob Hoffman-Andrews-43/+30
This covers rendering of stability_since and the srclink across methods and trait implementations, so their DOM representation is consistent.
2021-06-16Make portability part of the summary.Jacob Hoffman-Andrews-9/+21
That means it will be visible under "Implementors" on trait pages, and under "Implementations" on struct/enum pages, even when all methods are collapsed. Switch to a float layout for rightside elements.
2021-06-16Use render_impl_summary when rendering traits.Jacob Hoffman-Andrews-43/+29
2021-06-16Remove methods under Implementors on trait pagesJacob Hoffman-Andrews-17/+21
These were hidden by default, and duplicated information already on the page anyhow. Also remove the "Auto-hide trait implementors of a trait" setting, which is not needed anymore.
2021-06-17Rollup merge of #86361 - GuillaumeGomez:missing-backslashes, r=jshaYuki Okushi-4/+4
Add missing backslashes to prevent unwanted newlines in rustdoc HTML Just adding some forgotten backslashes. r? `@jsha`
2021-06-16Open trait implementations' toggles by default.Jacob Hoffman-Andrews-7/+2
This makes it possible to use Ctrl-F to find methods defined in traits.
2021-06-16Add missing backslashes to prevent unwanted backlines in rustdoc HTMLGuillaume Gomez-4/+4
2021-06-15remove code for recursive Deref in sidebarTrinity Pointard-29/+2
fix #85037
2021-06-15fix rustdoc stack overflow on mutually recursive DerefTrinity Pointard-3/+17
fix #85095
2021-06-15Rollup merge of #86277 - jsha:remove-must-use, r=ManishearthYuki Okushi-8/+2
Remove must_use from ALLOWED_ATTRIBUTES This is a fairly common attribute on methods, but is not something you need to know when reading the method docs - the purpose of the attribute is for the compiler to tell you about it if you forget to use a value. Removing reclaims some valuable space in the summary of methods, particularly when the attribute has a long string value. As discussed in #84309. Partially addresses #81482. r? ```@Manishearth```
2021-06-15Auto merge of #84867 - pnkfelix:rustdoc-revert-deref-recur, r=jyn514bors-27/+8
rustdoc: revert deref recur to resume inclusion of impl ExtTrait<Local> for ExtType As discussed here: https://github.com/rust-lang/rust/issues/82465#issuecomment-829290384, Revert PR #80653 to resolve issue #82465. Issue #82465 was we had stopped including certain trait implementations, namely implementations on an imported type of an imported trait *instantiated on a local type*. That bug was injected by PR #80653. Reverting #80653 means we don't list all the methods that you have accessible via recursively applying `Deref`. [Discussion in last week's rustc triage meeting](https://zulip-archive.rust-lang.org/238009tcompilermeetings/19557weekly2021042954818.html#236680594) led us to conclude that the bug was worse than the enhancement, and there was not an obvious fix for the bug itself. So for the short term we remove the enhancement, while in the long term we will work on figuring out a way to have our imported trait implementation cake and eat it too.
2021-06-13Remove must_use from ALLOWED_ATTRIBUTESJacob Hoffman-Andrews-8/+2
This is a fairly common attribute on methods, but is not something you need to know when reading the method docs - the purpose of the attribute is for the compiler to tell you about it if you forget to use a value. Removing reclaims some valuable space in the summary of methods.
2021-06-10manually crafted revert of PR #80653, to address issue #82465.Felix S. Klock II-27/+8
(update: placated tidy) (update: rebased post PR #84707 ) merge me
2021-06-07Refactor: Extract render_summary from render_impl.Jacob Hoffman-Andrews-78/+86
This allows for a more readable straight-through logic in render_impl without need for a closure.
2021-06-05Fix invalid ID value in all.html fileGuillaume Gomez-2/+8
2021-06-05Rollup merge of #85503 - liigo:tooltips, r=GuillaumeGomezGuillaume Gomez-1/+1
rustdoc: add tooltips to some buttons
2021-06-03Auto merge of #84834 - GuillaumeGomez:sidebar-unification, r=jshabors-40/+39
Sidebar unification This PR does a few things: * Put crates list at all levels (before, it was only on the "top" items) * Fix bug in module sidebar: the list of items was from the parent module. The other changes (on bootstrap mostly) were to allow to generate multiple crates in a same folder so that we can ensure that clicking on the crates in the sidebar works as expected. I added a rustdoc-gui test to ensure everything is where it should be. r? `@jyn514`
2021-06-02Remove data-level selectors from CSS.Jacob Hoffman-Andrews-11/+7
2021-06-01Don't generate impl-items div container if there is noneGuillaume Gomez-4/+6
2021-06-01Remove invalid usage of aria-levelGuillaume Gomez-7/+7
2021-06-01Replace h3 and h4 containing invalid DOMGuillaume Gomez-14/+32
2021-06-01Replace empty href with "#"Guillaume Gomez-1/+1
2021-06-01Rollup merge of #85622 - jsha:untoggle-undocumented, r=GuillaumeGomezGuillaume Gomez-10/+4
Remove toggle for "undocumented items." Per discussion in #84326. For trait implementations, this was misleading: the items actually do have documentation (but it comes from the trait definition). For both trait implementations and trait implementors, this was redundant: in both of those cases, the items are default-hidden by different toggle at the level above. Update tests: Remove XPath selectors that over-specified on details tag, in cases that weren't testing toggles. Add an explicit test for toggles on methods. Rename item-hide-threshold to toggle-item-contents for consistency. Demo: https://hoffman-andrews.com/rust/untoggle-undocumented/std/string/struct.String.html https://hoffman-andrews.com/rust/untoggle-undocumented/std/io/trait.Read.html
2021-05-31Add title for copy to clipboard button in rustdocIvan Tham-1/+2
2021-05-31Improve display of the separation between page items and siblings in the sidebarGuillaume Gomez-1/+1
2021-05-31Only list crates on the crate pageGuillaume Gomez-1/+8
2021-05-31Remove unneeded file to load sidebar items at crate levelGuillaume Gomez-1/+0
2021-05-31* Put crates list at all levelsGuillaume Gomez-38/+31
* Fix bug in module sidebar: the list of items was from the parent module
2021-05-30Remove toggle for "undocumented items."Jacob Hoffman-Andrews-10/+4
Per discussion in #84326. For trait implementations, this was misleading: the items actually do have documentation (but it comes from the trait definition). For both trait implementations and trait implementors, this was redundant: in both of those cases, the items are default-hidden by different toggle at the level above. Update tests: Remove XPath selectors that over-specified on details tag, in cases that weren't testing toggles. Add an explicit test for toggles on methods. Rename item-hide-threshold to toggle-item-contents for consistency.
2021-05-28Remove `--print unversioned-files` from rustdocBoris-Chengbiao Zhou-2/+1
This flag isn't needed anymore. See #83784.
2021-05-27Rollup merge of #85722 - GuillaumeGomez:trait-toggle, r=jshaGuillaume Gomez-4/+13
Fix trait methods' toggle A `<details>` tag wasn't closed on trait methods, which created broken DOM. I also used this occasion to only generate the toggle in case there is documentation on the method. r? `@jsha`
2021-05-26* Fix bug where some <details> tags were not closed.Guillaume Gomez-4/+13
* Don't generate a <details> if there is no documentation
2021-05-26Rollup merge of #84048 - konan8205:master, r=jshaYuki Okushi-0/+2
Avoid CJK legacy fonts in Windows As metioned in #84035, the default serif CJK font in Windows is meh-looking. To avoid this, we should use sans-serif font or provide CJK glyph supported font in `rustdoc.css`.
2021-05-24Remove doubled braces in non_exhaustive structs’ documentation text.Kevin Reid-1/+1
In commit 4b806878549990d2ad2aa3c265751d3d89947cdf (part of Rust 1.52.1) many calls to `write!(w,` were replaced with `w.write_str(`, but this one contained braces that were doubled to escape them when taken as a format string, and so changing the call without changing the text caused them to become doubled in the final HTML output. I examined `print_item.rs` and the diff of that prior commit for any other occurrences of this mistake and I did not find any.
2021-05-23Don't hide inherent implementations by defaultGuillaume Gomez-5/+14
2021-05-22Fix auto-hide for implementations and implementors.Jacob Hoffman-Andrews-1/+1
This sets their toggles to be closed in the HTML (matching the default setting), and opens them if the setting indicates to do so. This distinguishes between implementations and implementors based on being descendants of certain named elements.
2021-05-20rustdoc: add tooltips to some buttonsLiigo Zhuang-1/+1
2021-05-18Add method-toggle to <details> for methods.Jacob Hoffman-Andrews-3/+6
The makes the code for handling "auto-hide" settings more consistent.
2021-05-18Rollup merge of #85280 - jsha:move-trait-toggles, r=GuillaumeGomezGuillaume Gomez-2/+7
Toggle-wrap items differently than top-doc. This makes sure things like trait methods get wrapped at the `<h3><code>` level rather than at the `.docblock` level. Also it ensures that only the actual top documentation gets the `.top-doc` class. Fixes #85167 Before: ![image](https://user-images.githubusercontent.com/220205/117743384-98790200-b1bb-11eb-8804-588530842514.png) https://doc.rust-lang.org/nightly/std/io/trait.Read.html#tymethod.read After: ![image](https://user-images.githubusercontent.com/220205/118410882-98a75080-b646-11eb-949d-ca688bab6923.png)