about summary refs log tree commit diff
path: root/src/librustdoc/html
AgeCommit message (Collapse)AuthorLines
2021-10-25Fix scrollbars appearing on information tooltip on mac when they shouldn'tGuillaume Gomez-1/+1
2021-10-25Fix clippy lints in librustdocGuillaume Gomez-119/+98
2021-10-24Rollup merge of #90155 - jsha:outdent-methods, r=GuillaumeGomez,camelidMatthias Krüger-18/+10
Fix alignment of method headings for scannability We sometimes use indentation to indicate something is a heading: The section that comes after is indented by 24px relative to the heading. However, the relationship between the "Implementations" section heading, the `impl` headings it contains, and the `pub fn` subheadings within each impl, is awkward. It goes **Implementations**, 15px indent, `impl`, 5px indent, `pub fn`, 4px indent, docblock. I line up `impl` and `pub fn` with the `Implementations` heading, give `impl` a larger font size to indicate it is higher in the hierarchy, and indent the docblock a full 24px relative to their parent, matching the indents we use elsewhere to distinguish section headings. By letting the `pub fn` stick out to the left of the docblock, I think this makes methods significantly more scannable. Related to #59829 r? `````@camelid````` [Old](https://doc.rust-lang.org/nightly/std/string/struct.String.html#implementations): [![image](https://user-images.githubusercontent.com/220205/138380233-9c63a0f2-0f80-40a3-ab3d-a1ee9fb7c5d8.png)](https://doc.rust-lang.org/nightly/std/string/struct.String.html#implementations) [New](https://jacob.hoffman-andrews.com/rust/outdent-methods/std/string/struct.String.html#implementations): [![image](https://user-images.githubusercontent.com/220205/138392479-b45fce3f-bf43-42e0-81ee-c4bb9ac35cda.png)](https://jacob.hoffman-andrews.com/rust/outdent-methods/std/string/struct.String.html#implementations)
2021-10-23Outdent method headings so they stand outJacob Hoffman-Andrews-18/+10
The makes the heading / documentation distinction clearer.
2021-10-23Rollup merge of #85833 - willcrichton:example-analyzer, r=jyn514Matthias Krüger-29/+685
Scrape code examples from examples/ directory for Rustdoc Adds support for the functionality described in https://github.com/rust-lang/rfcs/pull/3123 Matching changes to Cargo are here: https://github.com/rust-lang/cargo/pull/9525 Live demo here: https://willcrichton.net/example-analyzer/warp/trait.Filter.html#method.and
2021-10-22Move def_id logic into render_call_locationsWill Crichton-4/+3
2021-10-22Rename `Type::def_id_full()` to `Type::def_id()`Noah Lev-12/+9
It should be preferred over `def_id_no_primitives()`, so it should have a shorter name. I also put it before `def_id_no_primitives()` so that it shows up first in the docs.
2021-10-22Rename `Type::def_id()` to `Type::def_id_no_primitives()`Noah Lev-4/+9
The old name was confusing because it's easy to assume that using `def_id()` is fine, but in some situations it's incorrect. In general, `def_id_full()` should be preferred, so `def_id_full()` should have a shorter name. That will happen in the next commit.
2021-10-22Replace `GetDefId` with inherent methodsNoah Lev-5/+3
Now that it's only implemented for `Type`, using inherent methods instead means that imports are no longer necessary. Also, `GetDefId` is only meant to be used with `Type`, so it shouldn't be a trait.
2021-10-22Remove `GetDefId` impl for `FnRetTy`Noah Lev-1/+1
It was only used in one place, so it seems better to use ordinary functions.
2021-10-22Revert def_id addition from clean::Function, add test forWill Crichton-4/+3
scrape-examples options
2021-10-19Small scrape-example fixesWill Crichton-1/+6
2021-10-20Rollup merge of #90036 - jsha:less-rule, r=GuillaumeGomezYuki Okushi-5/+8
Remove border-bottom from most docblocks. Headings in the top-doc docblock still get a border-bottom due to a rule that covers all h2, h3, and h4. Method docblocks are generally h5, and so don't get a border-bottom anymore. This fixes a problem where a sub-sub-heading within a method would have a line that went all the way across the page, creating a division that made that sub-sub-heading look much more important than it really is. Fixes #90033 Demo at https://jacob.hoffman-andrews.com/rust/less-rule/std/string/struct.String.html r? ``@GuillaumeGomez``
2021-10-20Rollup merge of #90018 - GuillaumeGomez:too-long-item-names, r=jshaYuki Okushi-126/+161
Fix rustdoc UI for very long type names Fixes #89972. While working on it, I also discovered that when the item name is too long, it also breaks the flow of the page. To make things right, I also renamed the `type-decl` CSS class into `item-decl` (because this PR also generates it for more than type declarations). So here are the before/after screenshots: ![Screenshot from 2021-10-18 16-58-03](https://user-images.githubusercontent.com/3050060/137757247-637fcf04-4406-49c6-8a8a-18c2074aacd9.png) ![Screenshot from 2021-10-18 16-58-26](https://user-images.githubusercontent.com/3050060/137757252-17935e63-53b3-449f-a535-7be91ff0e257.png) ![Screenshot from 2021-10-18 16-58-07](https://user-images.githubusercontent.com/3050060/137757278-8b12e348-2980-4fc4-8853-bef99d58981f.png) ![Screenshot from 2021-10-18 16-58-28](https://user-images.githubusercontent.com/3050060/137757282-534a0e1b-3016-49ba-b3ac-e45bdb9035cb.png) r? ``@jsha``
2021-10-18Reduce margin on h5 and h6Jacob Hoffman-Andrews-1/+8
2021-10-18Remove border-bottom from most docblocks.Jacob Hoffman-Andrews-4/+0
Headings in the top-doc docblock still get a border-bottom due to a rule that covers all h2, h3, and h4. Method docblocks are generally h5, and so don't get a border-bottom anymore. This fixes a problem where a sub-sub-heading within a method would have a line that went all the way across the page, creating a division that made that sub-sub-heading look much more important than it really is.
2021-10-18Prevent documentation page title to grow too bigGuillaume Gomez-0/+1
2021-10-18* Remove left margin on items declaration at the top of their documentation pageGuillaume Gomez-126/+160
* Rename "type-decl" into "item-decl" to reflect the change of usage
2021-10-16clippy::complexity changesMatthias Krüger-1/+1
2021-10-14Auto merge of #89815 - GuillaumeGomez:associated-consts-sidebar, r=notriddlebors-16/+79
Associated consts sidebar Fixes #89354. A screenshot with `f32`: ![Screenshot from 2021-10-12 15-07-57](https://user-images.githubusercontent.com/3050060/136962078-5faf7b87-7ea5-4d7a-99a4-b2afd77b78e2.png)
2021-10-13Improve code readability for sidebar linksGuillaume Gomez-16/+48
2021-10-12List associated constants in the sidebarGuillaume Gomez-7/+38
2021-10-12rustdoc: update noto sans krShinwoo Park-13/+14
2021-10-11Cleanup .item-table CSSStefan Schindler-1/+1
2021-10-11Rollup merge of #89736 - GuillaumeGomez:rm-unused-css-rule, r=dns2utf8Matthias Krüger-2/+0
Remove unused CSS rule As you can see in the firefox devtools: ![Screenshot from 2021-10-10 14-28-08](https://user-images.githubusercontent.com/3050060/136695689-16c77ceb-b1ab-40df-963a-048f2258e217.png) It needs the display to be `grid` or `inline-grid`, which isn't the case. r? `@dns2utf8`
2021-10-11Rollup merge of #89632 - GuillaumeGomez:fix-docblock-code, r=jshaMatthias Krüger-0/+4
Fix docblock code display on mobile Fixes https://github.com/rust-lang/rust/issues/89618. Before: ![Screenshot from 2021-10-07 12-01-37](https://user-images.githubusercontent.com/3050060/136363624-72bedddd-b45e-48a0-89b4-6563612f8677.png) After: ![Screenshot from 2021-10-07 20-17-21](https://user-images.githubusercontent.com/3050060/136440704-fa9ffa68-8e94-46a7-b556-c41aa5153750.png) r? `@jsha`
2021-10-10Remove unused CSS ruleGuillaume Gomez-2/+0
2021-10-10Fix <code> blocks in doc blocks display on mobileGuillaume Gomez-0/+4
2021-10-10Auto merge of #89695 - jsha:more-templates, r=GuillaumeGomezbors-55/+113
Move top part of print_item to Tera templates Part of #84419. This moves the first line of each item page (E.g. `Struct foo::Bar .... 1.0.0 [-][src]` into a Tera template. I also moved template initialization into its own module and added a small macro to reduce duplication and opportunity for errors.
2021-10-09Auto merge of #88379 - camelid:cleanup-clean, r=jyn514bors-115/+96
rustdoc: Cleanup various `clean` types Cleanup various `clean` types.
2021-10-09Remove some stray whitespace.Jacob Hoffman-Andrews-3/+3
2021-10-09Rollup merge of #89700 - GuillaumeGomez:fix-rustdoc-higher-bound-html-gen, ↵Guillaume Gomez-2/+6
r=notriddle Fix invalid HTML generation for higher bounds Considering this is a bug, I cherry-picked the commit from #89676 so it's merged more quickly. r? ``@notriddle``
2021-10-09Fix invalid HTML generation for higher boundsGuillaume Gomez-2/+6
2021-10-08Move template initialization into its own file.Jacob Hoffman-Andrews-15/+23
2021-10-08Add template for print_itemJacob Hoffman-Andrews-46/+96
Add print_item.html and the code in print_item.rs to use it.
2021-10-08Change handling of spans in scrape examples, add test for highlight decorationsWill Crichton-1/+18
2021-10-08Rollup merge of #89538 - notriddle:notriddle/arrow-highlight, r=GuillaumeGomezGuillaume Gomez-6/+25
Make rustdoc not highlight `->` and `=>` as operators It was marking them up as `<span class="op">=</span><span class="op">&gt;</span>`, which is bloaty and wrong (at least, I think `<=` and `=>` should probably be different colors, since they're so different and yet made from the same symbols). Before: ![image](https://user-images.githubusercontent.com/1593513/135939748-f49b0f9e-6a7d-4d65-935a-e31cdf688a81.png) After: ![image](https://user-images.githubusercontent.com/1593513/135940063-5ef1f6b1-7e03-4227-b46b-572b063aba05.png)
2021-10-08Move more scrape-examples logic from JS to rustWill Crichton-60/+60
Fix failing test Add missing backslash Fix padding issue with horizontal scrollbar
2021-10-07Move some expansion logic into generation-time, fix section header links, ↵Will Crichton-40/+54
remove ID from line numbers, fix horizontal scrolling on non-expanded elements
2021-10-07Rollup merge of #89596 - GuillaumeGomez:implicit-doc-cfg, r=jyn514Guillaume Gomez-1/+1
Make cfg imply doc(cfg) This is a reopening of #79341, rebased and modified a bit (we made a lot of refactoring in rustdoc's types so they needed to be reflected in this PR as well): * `hidden_cfg` is now in the `Cache` instead of `DocContext` because `cfg` information isn't stored anymore on `clean::Attributes` type but instead computed on-demand, so we need this information in later parts of rustdoc. * I removed the `bool_to_options` feature (which makes the code a bit simpler to read for `SingleExt` trait implementation. * I updated the version for the feature. There is only one thing I couldn't figure out: [this comment](https://github.com/rust-lang/rust/pull/79341#discussion_r561855624) > I think I'll likely scrap the whole `SingleExt` extension trait as the diagnostics for 0 and >1 items should be different. How/why should they differ? EDIT: this part has been solved, the current code was fine, just needed a little simplification. cc `@Nemo157` r? `@jyn514` Original PR description: This is only active when the `doc_cfg` feature is active. The implicit cfg can be overridden via `#[doc(cfg(...))]`, so e.g. to hide a `#[cfg]` you can use something like: ```rust #[cfg(unix)] #[doc(cfg(all()))] pub struct Unix; ``` By adding `#![doc(cfg_hide(foobar))]` to the crate attributes the cfg `#[cfg(foobar)]` (and _only_ that _exact_ cfg) will not be implicitly treated as a `doc(cfg)` to render a message in the documentation.
2021-10-06Update to latest rustc and rustdoc stylesWill Crichton-7/+8
2021-10-06Unversioned -> InvocationSpecificWill Crichton-1/+1
2021-10-06Fix lint error, change scrape-examples.js minify callWill Crichton-2/+9
2021-10-06Move JS into a standalone fileWill Crichton-115/+124
2021-10-06Change serialized format to use DefPathHash instead of custom StringWill Crichton-28/+21
Move test to rustdoc-ui Fix test writing to wrong directory Formatting Fix test Add FIXME Remove raw multiline strings
2021-10-06Incorporate jyn's feedbackWill Crichton-36/+81
* Move call location logic from function constructor to rendering * Fix issue with macro spans in scraping examples * Clean up example loading logic Documentation / newtype for DecorationInfo Fix line number display Serialize edition of call site, other small cleanup
2021-10-06Add styles for non-white themesWill Crichton-15/+61
Tweak colors Tabs New link heading style
2021-10-06Reduce blur size, fix example width bug, add better error handling for I/O ↵Will Crichton-29/+68
issues Remove repository url Fix formatting Fix file_span in print_src Formatting
2021-10-06Move highlighting logic from JS to RustWill Crichton-159/+145
Continue migrating JS functionality Cleanup Fix compile error Clean up the diff Set toggle font to sans-serif
2021-10-06Sort examples by sizeWill Crichton-36/+126
Improve styling Start to clean up code, add comments