about summary refs log tree commit diff
path: root/src/librustdoc/html/render
AgeCommit message (Collapse)AuthorLines
2023-01-13rustdoc: remove unnecessary DOM class `h1.fqn`Michael Howell-5/+5
It's misleading. The main heading sometimes isn't an fully qualified name at all. It's also redundant. It's always a child of `div.main-heading`, so just use that.
2023-01-13CrateData: don't allocate String when Serialize, &str is enoughklensy-1/+1
2023-01-13Playground.crate_name String -> Symbolklensy-3/+2
2023-01-13IndexItem.name String -> Symbolklensy-5/+5
2023-01-13evade clonesklensy-4/+4
2023-01-10Remove unneeded ItemId::Primitive variantGuillaume Gomez-20/+55
2023-01-06Correctly render sidebar for relative module pathsclubby789-25/+59
2023-01-03clean: Remove `ctor_kind` from `VariantStruct`.Nixon Enraght-Moony-10/+1
It's always `None`.
2023-01-01clean: Always store enum disriminant.Nixon Enraght-Moony-17/+20
2022-12-29Fix index out of bounds issues in rustdocyukang-2/+1
2022-12-22Rollup merge of #106027 - notriddle:notriddle/more-scraped-examples-inner, ↵Matthias Krüger-3/+2
r=GuillaumeGomez rustdoc: simplify CSS and DOM for more-scraped-examples This gets rid of the more-scraped-examples-inner wrapper, instead nesting the children directly and using absolute positioning for the toggle line.
2022-12-22Auto merge of #104889 - GuillaumeGomez:fix-impl-block-in-const-expr, r=notriddlebors-1/+1
Fix impl block in const expr Fixes #83026. The problem was that we didn't visit block expressions. Considering how big the [walk_expr](https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_hir/intravisit.rs.html#678) function is, I decided to instead implement the `hir` visitor on the struct. It also answers the question which was in a comment for `RustdocVisitor`: we should have used a visitor instead of our ad-hoc implementation. Adding this visitor also added some extra checks that weren't present before (check changes in `rustdoc-ui` tests). r? `@notriddle`
2022-12-21rustdoc: simplify CSS and DOM for more-scraped-examplesMichael Howell-3/+2
This gets rid of the more-scraped-examples-inner wrapper, instead nesting the children directly and using absolute positioning for the toggle line.
2022-12-16Don't add "Read more" link if there is no extra contentGuillaume Gomez-2/+3
2022-12-13Rollup merge of #105639 - notriddle:notriddle/text-css, r=GuillaumeGomezMatthias Krüger-1/+1
rustdoc: remove `type="text/css" from stylesheet links MDN directly recommends this in <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link>, since "CSS is the only stylesheet language used on the web." Like 07a243b2a46384235d7e2c08688978b7cf018973, but a few places that were missed the first time.
2022-12-12rustdoc: remove `type="text/css" from stylesheet linksMichael Howell-1/+1
MDN directly recommends this in <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link>, since "CSS is the only stylesheet language used on the web." Like 07a243b2a46384235d7e2c08688978b7cf018973, but a few places that were missed the first time.
2022-12-12rustdoc: stop treating everything in a trait item as a methodMichael Howell-3/+3
This was added in 0b9b4b70683db6ef707755f520f139eb7b92a944 to fix the spacing on trait pages, but stopped being needed because 791f04e5a47ee78951552c7ed1545b2b01a44c74 stopped styling method-toggle. By only putting the method-toggle class on actual methods, the JS setting does the right thing.
2022-12-07Improve code readabilityGuillaume Gomez-1/+1
2022-12-07Update scrape-examples help, fix documentation typosWill Crichton-7/+8
2022-12-07Improve several aspects of the Rustdoc scrape-examples UI.Will Crichton-5/+13
* Examples take up less screen height. * Snippets from binary crates are prioritized. * toggle-all-docs does not expand "More examples" sections.
2022-12-01rustc_hir: Change representation of import paths to support multiple resolutionsVadim Petrochenkov-8/+0
2022-12-01rustc_hir: Relax lifetime requirements on `Visitor::visit_path`Vadim Petrochenkov-1/+1
2022-11-28rustdoc: remove `fnname` CSS class that's styled exactly like `fn`Michael Howell-2/+2
It's not obvious why this was ever a separate class name, since even in c4219a478354b464079b1b7ab081e071e8e39765 when it was first added, it was styled identically to regular `fn` links.
2022-11-24move things from rustc_target::abi to rustc_abihkalbasi-2/+2
2022-11-24make rustc_target usable outside of rustchkalbasi-4/+4
2022-11-23Improve accessibility:Guillaume Gomez-15/+15
* Set aria-label attribute on search input * Put anchor text directly into the DOM and not in the CSS
2022-11-21Unreserve braced enum variants in value namespaceVadim Petrochenkov-12/+12
2022-11-19rustdoc: use real buttons for scrape examples controlsMichael Howell-1/+1
2022-11-17rustdoc: use `code-header` class to format enum variantsMichael Howell-15/+16
The font size and weights should be exactly the same after this commit, but the spacing is changed to be exactly the same as methods.
2022-11-13Rollup merge of #104177 - notriddle:notriddle/js-notable-trait-v2, ↵Yuki Okushi-4/+2
r=GuillaumeGomez rustdoc: use consistent "popover" styling for notable traits Follow-up to #104129 Fixes https://github.com/rust-lang/rust/issues/104313. Preview: https://notriddle.com/notriddle-rustdoc-demos/js-notable-trait-v2/std/iter/trait.Iterator.html#method.step_by ## Before ![image](https://user-images.githubusercontent.com/1593513/200710372-d2d992ce-0bdc-4437-9a2e-379a29df09cf.png) ![image](https://user-images.githubusercontent.com/1593513/200711266-e372b176-daa9-45f3-a022-738ef0a77d3c.png) ## After ![image](https://user-images.githubusercontent.com/1593513/200710601-09b3b717-116f-43c6-b14f-34a8b02b33c0.png) ![image](https://user-images.githubusercontent.com/1593513/200711288-3978cdc1-a6c2-47f6-9216-e22e3c1f5bdf.png)
2022-11-13Rollup merge of #103650 - notriddle:notriddle/line-anchors, r=GuillaumeGomezYuki Okushi-4/+1
rustdoc: change `.src-line-numbers > span` to `.src-line-numbers > a` Example: https://notriddle.com/notriddle-rustdoc-demos/line-anchors/test_dingus/fn.test.html This allows people to treat them like real links, such as right-click to copy URL, and makes the line numbers in a scraped example work at all, when before this commit was added, they had the clickable pointer cursor but did not actually do anything when clicked.
2022-11-12rustdoc: avoid excessive HTML generated in example sourcesMichael Howell-5/+1
2022-11-11rustdoc: use consistent "popover" styling for notable traitsMichael Howell-4/+2
2022-11-11rustdoc: fix HTML validation failure by escaping `data-ty`Michael Howell-2/+2
2022-11-09rustdoc: sort output to make it deterministicMichael Howell-1/+2
2022-11-07rustdoc: use javascript to layout notable traits popupsMichael Howell-59/+122
Fixes #102576
2022-11-07rustdoc: refactor `notable_traits_decl` to just act on the type directlyMichael Howell-68/+72
2022-11-05Rollup merge of #101702 - jsha:static-files2, r=notriddle,GuillaumeGomezMatthias Krüger-264/+60
rustdoc: add hash to filename of toolchain files All static files used by rustdoc are now stored in static.files/ and their filenames include a hash of their contents. Their filenames no longer include the contents of the --resource-suffix flag. This clarifies caching semantics. Anything in static.files can use Cache-Control: immutable because any updates will show up as a new URL. Invocation-specific files like crates-NN.js, search-index-NN.js, and sidebar-items-NN.js still get the resource suffix. This has a useful side effect: once toolchain files aren't affected by resource suffix, it will become possible for docs.rs to include crate version in the resource suffix. That should fix a caching issue with `/latest/` URLs: https://github.com/rust-lang/docs.rs/issues/1593. My goal is that it should be safe to serve all rustdoc JS, CSS, and fonts with infinite caching headers, even when new versions of a crate are uploaded in the same place as old versions. The --disable-minification flag is removed because it would vary the output of static files based on invocation flags. Instead, for rustdoc development purposes it's preferable to symlink static files to a non-minified copy for quick iteration. Example listing: ``` $ cd build/x86_64-unknown-linux-gnu/doc/ && find . | egrep 'js$|css$' | egrep -v 'sidebar-items|implementors' | sort ./crates1.65.0.js ./rust.css ./search-index1.65.0.js ./source-files1.65.0.js ./static.files/ayu-2bfd0af01c176fd5.css ./static.files/dark-95d11b5416841799.css ./static.files/light-c83a97e93a11f15a.css ./static.files/main-efc63f77fb116394.js ./static.files/normalize-76eba96aa4d2e634.css ./static.files/noscript-5bf457055038775c.css ./static.files/rustdoc-7a422337900fa894.css ./static.files/scrape-examples-3dd10048bcead3a4.js ./static.files/search-47f3c289722672cf.js ./static.files/settings-17b08337296ac774.js ./static.files/settings-3f95eacb845293c0.css ./static.files/source-script-215e9db86679192e.js ./static.files/storage-26d846fcae82ff09.js ``` Fixes #98413
2022-11-03Remove rustdoc clean::Visibility typeGuillaume Gomez-22/+27
2022-10-31rustdoc: change `.src-line-numbers > span` to `.src-line-numbers > a`Michael Howell-5/+6
This allows people to treat them like real links, such as right-click to copy URL, and makes the line numbers in a scraped example work at all, when before this commit was added, they had the clickable pointer cursor but did not actually do anything when clicked.
2022-10-30Make rustdoc Item::visibility computed on-demandGuillaume Gomez-35/+43
2022-10-29Generate static file hashes onceJacob Hoffman-Andrews-6/+5
2022-10-29Make --static-root-path point to static.filesJacob Hoffman-Andrews-5/+8
2022-10-29rustdoc: add hash to filename of toolchain filesJacob Hoffman-Andrews-263/+57
All static files used by rustdoc are now stored in static.files/ and include a hash of their contents. They no longer include the contents of the --resource-suffix flag. This clarifies caching semantics. Anything in static.files can use Cache-Control: immutable because any updates will show up as a new URL. Invocation-specific files like crates-NN.js, search-index-NN.js, and sidebar-items-NN.js still get the resource suffix. The --disable-minification flag is removed because it would vary the output of static files based on invocation flags. Instead, for rustdoc development purposes it's preferable to symlink static files to a non-minified copy for quick iteration.
2022-10-29Fix z-indexes of code example feature and cleanup its CSSGuillaume Gomez-5/+1
2022-10-27Rollup merge of #103432 - jsha:box-is-not-notable, r=GuillaumeGomezYuki Okushi-0/+9
rustdoc: don't mark Box<T> as Iterator, Read, etc Because Box<T> has pass-through implementations, rustdoc was giving it the "Notable Traits" treatment for Iterator, Read, Write, and Future, even when the type of T was unspecified. Pin had the same problem, but just for Future. Fixes #100320
2022-10-23rustdoc: don't mark Box<T> as Iterator, Read, etcJacob Hoffman-Andrews-0/+9
Because Box<T> has pass-through implementations, rustdoc was giving it the "Notable Traits" treatment for Iterator, Read, Write, and Future, even when the type of T was unspecified. Pin had the same problem, but just for Future.
2022-10-19Rollup merge of #103211 - notriddle:notriddle/dot-location, r=GuillaumeGomezMatthias Krüger-1/+1
rustdoc: remove class name `location` from sidebar sibling nav Preview: https://notriddle.com/notriddle-rustdoc-demos/sidebar-location/std/vec/struct.Vec.html This change tweaks the CSS to apply most of its styles to `.sidebar h2`, cleaning up a few redundant rules from `.mobile-topbar .location` and restoring useful navigation aids in mobile mode. ## Before ![location-before](https://user-images.githubusercontent.com/1593513/196521014-d8730830-c3a2-4ed7-9266-05454cd31e05.png) ## After ![location-after](https://user-images.githubusercontent.com/1593513/196521020-75ec1fa5-b3dc-4c5d-97b6-afccb5fbe00a.png)
2022-10-19Avoid cloning `RenderOptions`.Nicholas Nethercote-2/+1
By moving `RenderOptions` out of `Option`, because the two structs' uses are almost entirely separate. The only complication is that `unstable_features` is needed in both structs, but it's a tiny `Copy` type so its duplication seems fine.
2022-10-18rustdoc: remove class name `location` from sidebar sibling navMichael Howell-1/+1
This change tweaks the CSS to apply most of its styles to `.sidebar h2`, cleaning up a few redundant rules from `.mobile-topbar .location` and restoring useful navigation aids in mobile mode.