about summary refs log tree commit diff
path: root/src/librustdoc/html
AgeCommit message (Collapse)AuthorLines
2022-02-06Rollup merge of #92651 - jsha:impl-spacing, r=GuillaumeGomezMatthias Krüger-20/+24
Remove "up here" arrow on item-infos Use spacing to distinguish what is related to a given heading. This was originally introduced in #53043, in response to #51387. The arrow is a little distracting, and leads the item-info to not be aligned properly with the text below it. Demo: https://rustdoc.crud.net/jsha/impl-spacing/std/string/struct.String.html r? ``@GuillaumeGomez``
2022-02-04Refactor conditionalEliaz Bobadilla-5/+2
2022-02-04Rollup merge of #93576 - jsha:fix-rustdoc-html, r=GuillaumeGomezMatthias Krüger-35/+28
Emit more valid HTML from rustdoc Previously, tidy-html5 (`tidy`) would complain about a few things in our HTML. The main thing is that `<summary>` tags can't contain `<div>`s. That's easily fixed by changing out the `<div>`s for `<span>`s with `display: block`. However, there's also a rule that `<span>`s can't contain heading elements. `<span>` permits only "phrasing content" https://developer.mozilla.org/en-US/docs/Web/HTML/Element/span, and `<h3>` (and friends) are "Flow content, heading content, palpable content". https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements We have a wrapping `<div>` that goes around each `<h3>`/`<h4>`, etc. We turn that into a `<section>` rather than a `<span>` because `<section>` permits "flow content". https://developer.mozilla.org/en-US/docs/Web/HTML/Element/section After this change we get only three warnings from tidy, run on struct.String.html: line 6 column 10790 - Warning: trimming empty <span> line 1 column 1118 - Warning: <link> proprietary attribute "disabled" line 1 column 1193 - Warning: <link> proprietary attribute "disabled" The empty `<span>` is a known issue - there's a span in front of the search box to work around a strange Safari issue. The `<link>` attributes are the non-default stylesheets. We can probably refactor theme application to avoid using this proprietary "disabled" attribute. We can suppress those warnings with flags to tidy, and get a run that returns 0 (success): ``` tidy -o /dev/null -quiet --drop-empty-elements no --warn-proprietary-attributes no build/x86_64-unknown-linux-gnu/doc/std/string/trait.ToString.html ``` Note: this requires the latest version of tidy-html5, built from https://github.com/htacg/tidy-html5. Older versions (including the default version on Ubuntu 21.10) think `<section>` can't occur inside `<summary>`. Demo: https://rustdoc.crud.net/jsha/fix-rustdoc-html/std/string/struct.String.html r? `@GuillaumeGomez`
2022-02-04Rollup merge of #93632 - matthiaskrgr:rustdoclippy2, r=GuillaumeGomezMatthias Krüger-4/+3
rustdoc: clippy::complexity fixes clippy::map_flatten clippy::clone_on_copy clippy::useless_conversion clippy::needless_arbitrary_self_type
2022-02-04Rollup merge of #92735 - GuillaumeGomez:crate-filter-url-param, r=jshaMatthias Krüger-58/+108
Add crate filter parameter in URL Fixes #92621. r? `@jsha`
2022-02-03rustdoc: clippy::complexity fixesMatthias Krüger-4/+3
clippy::map_flatten clippy::clone_on_copy clippy::useless_conversion clippy::needless_arbitrary_self_type
2022-02-03Add filter-crate URL parameterGuillaume Gomez-47/+97
2022-02-02Unify storage getter and setter functionsGuillaume Gomez-12/+12
2022-02-02Emit valid HTML from rustdocJacob Hoffman-Andrews-35/+28
Previously, tidy-html5 (`tidy`) would complain about a few things in our HTML. The main thing is that `<summary>` tags can't contain `<div>`s. That's easily fixed by changing out the `<div>`s for `<span>`s with `display: block`. However, there's also a rule that `<span>`s can't contain heading elements. `<span>` permits only "phrasing content" https://developer.mozilla.org/en-US/docs/Web/HTML/Element/span, and `<h3>` (and friends) are "Flow content, heading content, palpable content". https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements We have a wrapping `<div>` that goes around each `<h3>`/`<h4>`, etc. We turn that into a `<section>` rather than a `<span>` because `<section>` permits "flow content". https://developer.mozilla.org/en-US/docs/Web/HTML/Element/section After this change we get only three warnings from tidy, run on struct.String.html: line 6 column 10790 - Warning: trimming empty <span> line 1 column 1118 - Warning: <link> proprietary attribute "disabled" line 1 column 1193 - Warning: <link> proprietary attribute "disabled" The empty `<span>` is a known issue - there's a span in front of the search box to work around a strange Safari issue. The `<link>` attributes are the non-default stylesheets. We can probably refactor theme application to avoid using this proprietary "disabled" attribute.
2022-02-02Rollup merge of #93420 - jsha:adjust-settings-layout, r=GuillaumeGomezMatthias Krüger-8/+10
Improve wrapping on settings page Previously, the radio button choices for themes would wrap awkwardly on narrow screens. With this change, the group of choices will prefer bumping down to the next line together, leaving the setting name on its own line. Also fix some minor spacing issues: - Align the setting name vertically with the radio button choices. - Use margin instead of padding for most spacing choices. - Use no margin/padding on the right-hand side. Demo: https://rustdoc.crud.net/jsha/adjust-settings-layout/settings.html r? ``@GuillaumeGomez`` Before (narrow screen): ![image](https://user-images.githubusercontent.com/220205/151555533-7ab65216-d178-4dcc-8792-3c8fb9da8718.png) After (narrow screen): ![image](https://user-images.githubusercontent.com/220205/151555702-ad79af32-f84b-4ee4-ae7a-1a2a463c0f6f.png)
2022-02-01Remove "up here" arrow on item-infosJacob Hoffman-Andrews-20/+24
Use spacing to distinguish what is related to a given heading.
2022-02-01librustdoc: render: use render_into instead of creating a temp stringMuhammad Falak R Wani-2/+1
Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
2022-02-01librustdoc: inline and forward all methods for `impl Write for Buffer`Muhammad Falak R Wani-0/+11
Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
2022-02-01librustdoc: impl core::fmt::Write for rustdoc::html::render::BufferMuhammad Falak R Wani-0/+6
Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
2022-01-31Improve wrapping on settings pageJacob Hoffman-Andrews-8/+10
Previously, the radio button choices for themes would wrap awkwardly on narrow screens. With this change, the group of choices will prefer bumping down to the next line together, leaving the setting name on its own line. Also fix some minor spacing issues: - Align the setting name vertically with the radio button choices. - Use margin instead of padding for most spacing choices. - Use no margin/padding on the right-hand side.
2022-01-31Rollup merge of #93444 - camelid:rustdoc-css-cleanup, r=GuillaumeGomez,jshaMatthias Krüger-7/+8
Fix some CSS warnings and errors from VS Code There's no such CSS rule as `box-shadow-color`, so I instead copied the whole `box-shadow` property to each rule to make it actually apply. r? `@jsha`
2022-01-30Auto merge of #92711 - zredb:issue-90187-fix, r=notriddlebors-24/+34
rustdoc: Remove `def_id_no_primitives` Fixes #90187.
2022-01-30Rollup merge of #93183 - jsha:mobile-nav-fixes, r=GuillaumeGomezEric Huss-3/+16
rustdoc: mobile nav fixes - Make sure the mobile-topbar doesn't overflow its height if the user sets a bigger font. - Make sure the sidebar can be scrolled all the way to the bottom by shortening it to accommodate the mobile-topbar. - Make the item name in the mobile-topbar clickable to go to the top of the page. - Remove excess padding sidebar in mobile mode. Demo https://rustdoc.crud.net/jsha/mobile-nav-fixes/std/string/struct.String.html r? `@GuillaumeGomez`
2022-01-29rustdoc: small fixes to mobile navigationJacob Hoffman-Andrews-3/+16
- Make sure the mobile-topbar doesn't overflow its height if the user sets a bigger font. - Make sure the sidebar can be scrolled all the way to the bottom by shortening it to accommodate the mobile-topbar. - Make the item name in the mobile-topbar clickable to go to the top of the page. - Remove excess padding sidebar in mobile mode.
2022-01-30Rollup merge of #93391 - notriddle:notriddle/remove-srclink-tooltip, ↵Matthias Krüger-2/+2
r=jsha,GuillaumeGomez rustdoc: remove tooltip from source link This made more sense back when it was abbreviated, but now it seems redundant.
2022-01-29Fix some CSS warnings and errors from VS CodeNoah Lev-7/+8
There's no such CSS rule as `box-shadow-color`, so I instead copied the whole `box-shadow` property to each rule to make it actually apply.
2022-01-29Rollup merge of #93299 - GuillaumeGomez:dot-separator-no-source, r=jshaMatthias Krüger-3/+4
Fix dot separator when there is no source link Fixes #92973. We did well adding this test since there was a bug: ![Screenshot from 2022-01-25 17-05-48](https://user-images.githubusercontent.com/3050060/151016535-39b45f52-e1e0-4963-ad19-532e24ec4c9b.png) r? `@jsha`
2022-01-28rustdoc: no `shortcut` in `rel="icon"`Miguel Ojeda-1/+1
According to https://html.spec.whatwg.org/multipage/links.html#rel-icon: > For historical reasons, the `icon` keyword may be preceded by > the keyword "`shortcut`". And to https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types: > **Warning:** The `shortcut` link type is often seen before `icon`, > but this link type is non-conforming, ignored and **web authors > must not use it anymore.** While it was removed from the Rust logo case a while ago in commit 085679c8414 ("Use theme-adaptive SVG favicon from other Rust sites"), it is still there for the custom logo case. Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2022-01-28remove allow_fail test flagyuhaixin.hx-13/+0
2022-01-27rustdoc: remove tooltip from source linkMichael Howell-2/+2
This made more sense back when it was abbreviated, but now it seems redundant.
2022-01-25Rollup merge of #93291 - conradludgate:minor-fix-93231, r=GuillaumeGomezMatthias Krüger-1/+1
minor fix for #93231 In #93231 I introduced the new sidebar colours to make the contrast more balanced and easier to read, but it seems I made a copy-paste error in the light theme, resulting in functions appearing green. This one line change replaces that colour with it's corrected orange/brown colour. I have double checked the rest of the colours and they seem ok. Sorry for the inconvenience
2022-01-25Rollup merge of #93286 - jsha:sidebar-nowrap, r=GuillaumeGomezMatthias Krüger-0/+4
Add white-space: nowrap to links in the sidebar We already have overflow: hidden on these links, but if there is a possibility to wrap, they will wrap. This happens in particular for trait implementations because the punctuation (`<>, `) introduces opportunities for breaks. That produces inconsistent UI. Fix it by forcing them not to wrap. Demo: https://rustdoc.crud.net/jsha/sidebar-nowrap/std/string/struct.String.html To see the effect, scroll down to the "Trait Implementations" portion of the sidebar and look at IndexMut. Compare vs: https://doc.rust-lang.org/std/string/struct.String.html https://doc.rust-lang.org/nightly/std/string/struct.String.html r? `@camelid`
2022-01-25Fix invalid extra dot after version if no sourceGuillaume Gomez-3/+4
2022-01-25give light-theme fns the correct orange-brown colourConrad Ludgate-1/+1
2022-01-25Rollup merge of #93251 - jsha:theme-radio, r=GuillaumeGomezMatthias Krüger-50/+78
rustdoc settings: use radio buttons for theme This reduces the number of clicks required to change theme. Also, simplify the UI a bit (remove setting grouping), and add a "Back" link close to the settings icon. Demo: https://rustdoc.crud.net/jsha/theme-radio/settings.html r? ``@GuillaumeGomez`` New: ![image](https://user-images.githubusercontent.com/220205/150702647-4826d525-54fa-439a-b24c-6d5bca6f95bf.png) Old: ![image](https://user-images.githubusercontent.com/220205/150702669-6a4214ed-1dab-4fee-b1aa-59acfce3dbca.png)
2022-01-24Add white-space: nowrap to links in the sidebarJacob Hoffman-Andrews-0/+4
We already have overflow: hidden on these links, but if there is a possibility to wrap, they will wrap. This happens in particular for trait implementations because the punctuation (`<>, `) introduces opportunities for breaks. That produces inconsistent UI. Fix it by forcing them not to wrap.
2022-01-24Rollup merge of #93253 - jsha:theme-on-show, r=GuillaumeGomezMatthias Krüger-6/+25
Update theme on pageshow event When a user goes forward or back, the page may be rendered from the back/forward cache (https://web.dev/bfcache/) rather than from scratch. If they have changed theme in the meantime, that means seeing an incorrect theme on the page they went forward or back to. The `pageshow` event fires on such navigations, so we can update the theme based on that event. Demo: https://rustdoc.crud.net/jsha/theme-on-show/std/string/trait.ToString.html r? `@GuillaumeGomez`
2022-01-24Rollup merge of #93241 - GuillaumeGomez:rust-logo-appearance, r=jshaMatthias Krüger-1/+1
Fix brief appearance of rust logo in the sidebar Part of #91374. I simply removed the CSS animation on the visibility, which now makes it all appear at once. I didn't change the CSS animation on the width though, which gives: https://user-images.githubusercontent.com/3050060/150689595-067a6e00-9875-40c8-9d8a-1e3031dbcaba.mp4 cc `@camelid` r? `@jsha`
2022-01-24Rollup merge of #93231 - conradludgate:doc-link-brightness, r=notriddleMatthias Krüger-0/+67
adjust sidebar link brightness Fairly simple change. I've taken the existing link colour and main body background colours, and made sure that the sidebar+link contrast is the same. ayu: - [main content contrast](https://colourcontrast.cc/0f1419/39afd7) - 7.31 - [current sidebar contrast](https://colourcontrast.cc/14191f/39afd7) - 6.97 - [new sidebar contrast](https://colourcontrast.cc/14191f/56b1d9) - 7.30 dark: - [main content contrast](https://colourcontrast.cc/353535/d2991d) - 4.86 - [current sidebar contrast](https://colourcontrast.cc/14191f/d2991d) - 3.19 - [new sidebar contrast](https://colourcontrast.cc/14191f/fdbf35) - 4.87 light: - [main content contrast](https://colourcontrast.cc/ffffff/3873ad) - 4.97 - [current sidebar contrast](https://colourcontrast.cc/f5f5f5/3873ad) - 4.56 - [new sidebar contrast](https://colourcontrast.cc/f5f5f5/356da4) - 4.97
2022-01-24Rollup merge of #93212 - GuillaumeGomez:cursor-pointer-mobile-sidebar, r=jshaMatthias Krüger-1/+0
Remove unneeded cursor pointer rule on mobile sidebar Since it's on mobile, there isn't much point in this rule... r? `@jsha`
2022-01-24Rollup merge of #93188 - jsha:fix-safari-bumpy-search, r=camelidMatthias Krüger-0/+1
rustdoc: fix bump down typing search on Safari Fixes #93184. For some reason, if the search input doesn't have a previous sibling, typing in the search box increases the search-container's size by about 5px on the bottom. Putting in a dummy sibling fixes it. https://rustdoc.crud.net/jsha/fix-safari-bumpy-search/std/string/struct.String.html r? `@camelid`
2022-01-23Update theme on pageshow eventJacob Hoffman-Andrews-6/+25
When a user goes forward or back, the page may be rendered from the back/forward cache (https://web.dev/bfcache/) rather than from scratch. If they have changed theme in the meantime, that means seeing an incorrect theme on the page they went forward or back to. The `pageshow` event fires on such navigations, so we can update the theme based on that event.
2022-01-23rustdoc settings: use radio buttons for themeJacob Hoffman-Andrews-50/+78
This reduces the number of clicks required to change theme. Also, simplify the UI a bit (remove setting grouping), and add a "Back" link close to the settings icon.
2022-01-23rustdoc: fix bump down typing search on SafariJacob Hoffman-Andrews-0/+1
2022-01-23Rollup merge of #93229 - mark-i-m:noquiet, r=eddybMatthias Krüger-5/+7
Remove DiagnosticBuilder.quiet r? `@eddyb` cc https://github.com/rust-lang/rust/issues/69426 `@GuillaumeGomez` `@Manishearth`
2022-01-23Fix brief appearance of rust logo in the sidebarGuillaume Gomez-1/+1
2022-01-23remove duplicate ruleConrad Ludgate-6/+0
2022-01-23tweak all sidebar coloursConrad Ludgate-3/+67
2022-01-23adjust sidebar link brightnessConrad Ludgate-0/+9
2022-01-23Remove DiagnosticBuilder.quietmark-5/+7
2022-01-23Rollup merge of #93185 - camelid:crate-private, r=GuillaumeGomezMatthias Krüger-1/+1
rustdoc: Make some `pub` items crate-private They don't need to be `pub`. Making them crate-private improves code clarity and `dead_code` linting.
2022-01-23Rollup merge of #93113 - GuillaumeGomez:unify-sizes, r=jshaMatthias Krüger-106/+33
Unify search input and buttons size Fixes #93060. Here what it looks like: ![Screenshot from 2022-01-20 21-38-19](https://user-images.githubusercontent.com/3050060/150418571-fefd6538-b3ee-4dd2-b77b-77e96bcfa0ed.png) ![Screenshot from 2022-01-20 21-38-22](https://user-images.githubusercontent.com/3050060/150418570-53ba259b-9bd4-4084-8b43-d74a5752d712.png) You can test it [here](https://rustdoc.crud.net/imperio/unify-sizes/std/index.html). r? ``@jsha``
2022-01-23Rollup merge of #93068 - jsha:dot-spacing, r=GuillaumeGomezMatthias Krüger-2/+1
Fix spacing for `·` between stability and source This puts in an actual space (by adjusting the space-eating operators in our templates), updates the test, and remove the now-unnecessary CSS rule. r? ``@GuillaumeGomez``
2022-01-22Remove unneeded cursor pointer rule on mobile sidebarGuillaume Gomez-1/+0
2022-01-22Rollup merge of #93172 - jsha:re-remove-line, r=camelidMatthias Krüger-1/+0
rustdoc: remove dashed underline under main heading This was removed in #92797 but accidentally re-introduced by a bad merge in #92861. r? ```@camelid```