about summary refs log tree commit diff
path: root/src/librustdoc/html
AgeCommit message (Collapse)AuthorLines
2021-04-19Rollup merge of #84330 - GuillaumeGomez:remove-footer, r=jyn514Dylan DPC-1/+0
Remove unused footer section I realized yesterday while working on docs.rs that rustdoc was generating a "footer"section that it doesn't use. No need to keep it then. r? `@jyn514`
2021-04-19Remove unused footer sectionGuillaume Gomez-1/+0
2021-04-19Auto merge of #84283 - jsha:de-emphasize-attributes, r=GuillaumeGomezbors-4/+10
rustdoc: Reduce visual weight of attributes. Followup from #83337. As part of that PR, we stopped hiding attributes behind a toggle, because most things have just zero or one attributes. However, this made clear that the current rendering of attributes emphasizes them a lot, which distracts from function signatures. This PR changes their color of attributes to be the same as the toggles, and reduces their font weight. This also removes `#[lang]` from the list of ALLOWED_ATTRIBUTES. This attribute is an implementation detail rather than part of the public-facing documentation. ![image](https://user-images.githubusercontent.com/220205/115131061-cc407d80-9fa9-11eb-9a77-ad3f3217f391.png) Demo at https://hoffman-andrews.com/rust/de-emph-attr/std/string/struct.String.html#method.trim
2021-04-19Auto merge of #84288 - notriddle:short-links, r=jyn514bors-52/+44
rustdoc: get rid of CURRENT_DEPTH Fixes #82742
2021-04-17rustdoc: get rid of CURRENT_DEPTHMichael Howell-52/+44
2021-04-18Fix the wrong return value type description of validateResulthi-rustin-1/+1
2021-04-17Reduce visual weight of attributes.Jacob Hoffman-Andrews-4/+10
2021-04-17Rollup merge of #84150 - jsha:defer-search-js, r=GuillaumeGomezDylan DPC-1687/+1676
rustdoc: move some search code into search.js This reduces main.s from 3094 lines to 1587. Also it saves some bytes of download in the case where search isn't used. There were a fair number of variables that needed to be accessible in both main.js and search.js, but I didn't want to put too many symbols in the global namespace, so I consolidated much of the search-related state and functions into a new object `window.searchState`. Demo at https://hoffman-andrews.com/rust/move-search/std/?search=foo
2021-04-17rustdoc: move the cx argument to the end of the listMichael Howell-33/+33
This should help make things consistent.
2021-04-17rustdoc: change 'cx to 'tcx, to match the struct itselfMichael Howell-60/+60
2021-04-17rustdoc: use more precise relative URLSMichael Howell-429/+428
Instead of using a depth counter and adding "../" to get to the top, this commit makes rustdoc actually compare the path of what it's linking from to the path that it's linking to. This makes the resulting HTML shorter. Here's a comparison of one of the largest (non-source) files in the Rust standard library docs (about 4% improvement before gzipping). $ wc -c struct.Wrapping.old.html struct.Wrapping.new.html 2387389 struct.Wrapping.old.html 2298538 struct.Wrapping.new.html Most if it can be efficiently gzipped away. $ wc -c struct.Wrapping.old.html.gz struct.Wrapping.new.html.gz 70679 struct.Wrapping.old.html.gz 70050 struct.Wrapping.new.html.gz But it also makes a difference in the final DOM size, reducing it from 91MiB to 82MiB.
2021-04-17Auto merge of #84246 - notriddle:rustdoc-path-printing-cleanup, r=jyn514bors-42/+0
rustdoc: get rid of unused path printing code The code for printing a raw path is only used in utils.rs, which only prints the alternative (non-HTML) format. Path has a function that does the same thing without HTML support, so use that instead.
2021-04-16Auto merge of #84074 - notriddle:rustdoc-macro-visibility, r=jyn514bors-10/+38
rustdoc: clean up and test macro visibility print This fixes the overly-complex invariant mentioned in <https://github.com/rust-lang/rust/pull/83237#issuecomment-815346570>, where the macro source can't have any links in it only because the cache hasn't been populated yet.
2021-04-16rustdoc: get rid of unused path printing codeMichael Howell-42/+0
The code for printing a raw path is only used in utils.rs, which only prints the alternative (non-HTML) format. Path has a function that does the same thing without HTML support, so use that instead.
2021-04-16Rollup merge of #83337 - Manishearth:item-hide, r=GuillaumeGomezDylan DPC-146/+184
rustdoc: Hide item contents, not items This tweaks rustdoc to hide item contents instead of items, and only when there are too many of them. This means that users will _always_ see the type parameters, and will _often_ see fields/etc as long as they are small. Traits have some heuristics for hiding only the methods or only the methods and the consts, since the associated types are super important. I'm happy to play around with the heuristics here; we could potentially make it so that structs/enums/etc are always hidden but traits will try really hard to show type aliases. This needs a test, but you can see it rendered at https://manishearth.net/sand/doc_render/bar/ <details> <summary> Code example </summary> ```rust pub struct PubStruct { pub a: usize, pub b: usize, } pub struct BigPubStruct { pub a: usize, pub b: usize, pub c: usize, pub d: usize, pub e: usize, pub f: usize, } pub union BigUnion { pub a: usize, pub b: usize, pub c: usize, pub d: usize, pub e: usize, pub f: usize, } pub union Union { pub a: usize, pub b: usize, pub c: usize, } pub struct PrivStruct { a: usize, b: usize, } pub enum Enum { A, B, C, D { a: u8, b: u8 } } pub enum LargeEnum { A, B, C, D, E, F, G, H, I, J } pub trait Trait { type A; #[must_use] fn foo(); fn bar(); } pub trait GinormousTrait { type A; type B; type C; type D; type E; type F; const N: usize = 1; #[must_use] fn foo(); fn bar(); } pub trait HugeTrait { type A; const M: usize = 1; const N: usize = 1; const O: usize = 1; const P: usize = 1; const Q: usize = 1; #[must_use] fn foo(); fn bar(); } pub trait BigTrait { type A; #[must_use] fn foo(); fn bar(); fn baz(); fn quux(); fn frob(); fn greeble(); } #[macro_export] macro_rules! foo { (a) => {a}; } ``` </details> Fixes https://github.com/rust-lang/rust/issues/82114
2021-04-14Update comment on search.js static file.Jacob Hoffman-Andrews-2/+1
2021-04-14Change root_path to static_root_pathJacob Hoffman-Andrews-1/+1
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2021-04-13Split search.js from search-index.js.Jacob Hoffman-Andrews-9/+12
2021-04-13tidy format rustFrançois Mockers-10/+28
2021-04-13format cssFrançois Mockers-1/+2
2021-04-13fix source link when in a trait implementationFrançois Mockers-8/+30
2021-04-13add anchors links on hover to items from trait implFrançois Mockers-8/+16
2021-04-13fix links from trait impl methods to trait declarationFrançois Mockers-3/+4
2021-04-13Further consolidate search-related vars and funcsJacob Hoffman-Andrews-76/+61
2021-04-13Consolidate search-related vars and functions.Jacob Hoffman-Andrews-175/+167
This allows sharing across main.js and search.js without exporting too many symbols into the global namespace.
2021-04-12Move search JS into search-index.jsJacob Hoffman-Andrews-1524/+1534
Export a few variables and functions into the global scope because they are needed both by main.js and search-index.js.
2021-04-12+ignore-tidy-filelengthManish Goregaokar-1/+2
2021-04-12Move color to themesManish Goregaokar-5/+9
2021-04-12& -> &&Manish Goregaokar-2/+2
2021-04-12Wrap toggle_open()Manish Goregaokar-1/+4
2021-04-12should_hide_fields > 12Manish Goregaokar-2/+1
2021-04-12Add css classesManish Goregaokar-12/+12
2021-04-12Improve CSS for "hide contents, not items"Jacob Hoffman-Andrews-130/+116
Introduce a first use of the `<details>` and `<summary>` tags as replacements for the JS-built toggles. I think this has the potential to replace all the JS toggles and generally clean up the JS, CSS, and HTML. Split rendering of attributes into two cases: in the case where they are rendered as descendents of a `<pre>` tag, where they use indent spaces and newlines for formatting, matching their surrounding markup. In the case where they are rendered as descendants of a `<code>` tag, they are rendered as `<div>`. This let me clean up some fragile CSS that was adjusting the margin-left of attributes depending on context. Remove toggles for attributes. With the ALLOWED_ATTRIBUTES filter, it's rare for an item to have more than one attribute, so hiding attributes behind a toggle doesn't save any screen space in the common case. Fix a couple of invocations of `matches!` that didn't compile on my machine. Fix a boolean for the JS `createToggle` call that was causing "Expand description" to show up spuriously on already-expanded descriptions. Add JS for auto-hide settings and hide all / show all. Remove a z-index property and some font color tweaks made unnecessary by the <details> toggles. Add CSS for the <details> toggles.
2021-04-12Update src/librustdoc/html/render/print_item.rsManish Goregaokar-1/+1
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2021-04-12Update src/librustdoc/html/render/print_item.rsManish Goregaokar-1/+1
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2021-04-12rustdoc: Add setting for hiding large itemsManish Goregaokar-1/+6
2021-04-12rustdoc: smartly hide associated items of traits if there are too many of themManish Goregaokar-12/+30
2021-04-12rustdoc: hide fields of structs/unions > 5Manish Goregaokar-8/+31
2021-04-12rustdoc: hide variants of enums > 5Manish Goregaokar-7/+34
2021-04-12rustdoc: Stop hiding entire item declarationsManish Goregaokar-33/+5
2021-04-10rustdoc: clean up and test macro visibility printMichael Howell-10/+38
This fixes the overly-complex invariant mentioned in <https://github.com/rust-lang/rust/pull/83237#issuecomment-815346570>, where the macro source can't have any links in it only because the cache hasn't been populated yet.
2021-04-08Add test for idents mergeGuillaume Gomez-0/+20
2021-04-08Merge idents if they are part of a pathGuillaume Gomez-18/+107
2021-04-06Rollup merge of #82963 - camelid:move-sharedcontext, r=GuillaumeGomezDylan DPC-83/+77
Move `SharedContext` to `context.rs` It is tightly connected to `Context` and is primarily used as a field in `Context`. Thus, it should be next to `Context`.
2021-04-05Move `SharedContext` to `context.rs`Camelid-83/+77
It is tightly connected to `Context` and is primarily used as a field in `Context`. Thus, it should be next to `Context`.
2021-04-06Rollup merge of #83835 - notriddle:sort-index, r=ollie27Yuki Okushi-9/+23
rustdoc: sort search index items for compression This should not affect the appearance of the docs pages themselves. This makes the pre-compressed search index smaller, thanks to the empty-string path duplication format, and also the gzipped version, by giving the algorithm more structure to work with. rust$ wc -c search-index-old.js search-index-new.js 2628334 search-index-old.js 2586181 search-index-new.js 5214515 total rust$ gzip search-index-* rust$ wc -c search-index-old.js.gz search-index-new.js.gz 239486 search-index-old.js.gz 237386 search-index-new.js.gz 476872 total
2021-04-05Rollup merge of #83826 - slightlyoutofphase:rustdoc-sidebar-order-shuffle, ↵Dylan DPC-7/+8
r=jyn514 List trait impls before deref methods in doc's sidebar This PR is acting directly on a suggestion made by ```````@jyn514``````` in #83133. I've tested the changes locally, and can confirm that it does in fact properly achieve what he thought it would. This PR also in turn closes #83133.
2021-04-05Update Source Serif to release 4.004Trevor Spiteri-30/+29
Now the family name is Source Serif 4 (upstream issue 77) instead of Source Serif Pro.
2021-04-05Rollup merge of #83717 - notriddle:main-js-slice-loop, r=GuillaumeGomezDylan DPC-9/+12
rustdoc: Separate filter-empty-string out into its own function
2021-04-04Get rid of unneeded `aliases` fieldMichael Howell-2/+6