about summary refs log tree commit diff
path: root/src/librustdoc/html/static/css/rustdoc.css
AgeCommit message (Collapse)AuthorLines
2022-02-17Rollup merge of #93780 - GuillaumeGomez:links-in-sidebar, r=jshaMatthias Krüger-6/+5
Generate list instead of div items in sidebar Fixes #92986. Surprisingly, we didn't have much CSS for this... [Demo](https://rustdoc.crud.net/imperio/links-in-sidebar/std/index.html). r? `@jsha`
2022-02-16Unify sidebar a bit more by generating a list using <ul> instead of <div> ↵Guillaume Gomez-6/+5
elements
2022-02-16Rollup merge of #93382 - GuillaumeGomez:search-input-padding, r=jshaMatthias Krüger-1/+1
Add a bit more padding in search box As asked in https://github.com/rust-lang/rust/pull/93113#issuecomment-1021565703, here is a bit more padding. You can check it [here](https://rustdoc.crud.net/imperio/search-input-padding/foo/index.html). r? `@camelid`
2022-02-13Auto merge of #93763 - jsha:re-space-empty-impls, r=GuillaumeGomezbors-2/+3
rustdoc: fix spacing of non-toggled impl blocks We [recently removed the "up here" arrows on item-infos](https://github.com/rust-lang/rust/pull/92651), and adjusted vertical spacing so that even without the arrow, it would be visually clear which item the item-info belonged to. The new CSS styles for vertical spacing only applied to toggles, though. This missed non-toggled impl blocks - for instance, those without any methods, like https://doc.rust-lang.org/nightly/std/marker/trait.Send.html#implementors. The result was lists of implementors that were spaced too closely. This PR fixes the spacing by making it apply to non-toggled impl blocks as well. This also fixes an issue where item-infos were displayed too far below their items. That was a result of display: table on .item-info .stab. Changed that to display: inline-block. Demo: https://rustdoc.crud.net/jsha/re-space-empty-impls/std/marker/trait.Send.html Before: <img width=300 src="https://user-images.githubusercontent.com/220205/152954394-ec0b80e7-2573-4f06-9d7a-7b10b8ceac60.png"> After: <img width=300 src="https://user-images.githubusercontent.com/220205/152954228-abac1d30-a76d-4ab1-89ec-ef7549fe8c9c.png"> r? `@GuillaumeGomez`
2022-02-09rustdoc: fix spacing of non-toggled impl blocksJacob Hoffman-Andrews-2/+3
We recently removed the "up here" arrows on item-infos, and adjusted vertical spacing so that even without the arrow, it would be visually clear which item the item-info belonged to. The new CSS styles for vertical spacing only applied to toggles, though. This missed non-toggled impl blocks - for instance, those without any methods, like https://doc.rust-lang.org/nightly/std/marker/trait.Send.html#implementors. The result was lists of implementors that were spaced too closely. This PR fixes the spacing by making it apply to non-toggled impl blocks as well. This also fixes an issue where item-infos were displayed too far below their items. That was a result of display: table on .item-info .stab. Changed that to display: inline-block.
2022-02-09Unify headings indent and remove useless anchorGuillaume Gomez-21/+0
2022-02-09Add a bit more padding on search padding and reduce its font sizeGuillaume Gomez-1/+1
2022-02-08rustdoc: tweak line and ¶ spacing for a11yJacob Hoffman-Andrews-60/+52
The W3C Web Content Accessibility Guidelines specify a minimum line spacing of 1.5 and a minimum paragraph spacing of 1.5 times the line spacing. Our current line spacing (implemented by line-height) is 1.4, so it's a small bump to go up to 1.5. Similarly, we have a paragraph spacing of 0.6em. Bump that to 0.75em (which is 1.5 times the 0.5em distance between lines). Also, fix all the font sizes so instead of being round-ish numbers in rem (like 1.1rem, 1.2rem), they are round numbers in pixels. Ensure each font size is at least 2 pixels different than the nearest other font size, so distinctions can be clearly seen. Overall the font-sizes are mostly staying the same, being rounded up or down as appropriate. Remove a few unused styles. Simplify the display of the mobile-topbar location, by setting its margins to auto rather than trying to size it exactly to the topbar.
2022-02-07Fix hover effects in sidebarJacob Hoffman-Andrews-12/+7
The dark and ayu themes have a menu-like highlight on sidebar items. The light theme used to, but it was accidentally lost in the sidebar unification. The change brings back the hover effect in the light theme. It also makes the hover effect apply consistently to all links in the sidebar, including headings. It also simplifies the "In _path_" heading so it's one big link. The breadcrumbs are still readily available at the top of the page.
2022-02-07Rollup merge of #93673 - jsha:linkify-sidebar-headings, r=GuillaumeGomezMara Bos-2/+1
Linkify sidebar headings for sibling items Also adjust CSS so this doesn't produce excess padding/margin. Note: I tried and failed to write a test with browser-UI-test. First I tried to `assert-property: (".block.mod h3 a", {"href": "index.html#macros"})`. But the `href` that gets read out is the fully-quallified URL, starting with `file:///`. That URL will differ depending on what path the test is run from, so that doesn't work. Next I tried clicking on the appropriate sidebar link, and verifying that the appropriate heading on the next page is highlighted with the right background color. However, that also didn't work: according to browser-UI-test, the targeted heading was plain white. However, running with no-headless, I could see that it actually was yellow. I suspect this is a bug in the older version of Chromium used with browser-UI-test's bundled puppeteer, since it doesn't reproduce on latest Chrome. Fixes #92957 Demo: https://rustdoc.crud.net/jsha/linkify-sidebar-headings/std/string/trait.ToString.html r? ``@GuillaumeGomez``
2022-02-05Linkify sidebar headings for sibling itemsJacob Hoffman-Andrews-2/+1
Also adjust CSS so this doesn't produce excess padding/margin.
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-02Emit valid HTML from rustdocJacob Hoffman-Andrews-0/+1
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-01Remove "up here" arrow on item-infosJacob Hoffman-Andrews-20/+24
Use spacing to distinguish what is related to a given heading.
2022-01-31Rollup merge of #93444 - camelid:rustdoc-css-cleanup, r=GuillaumeGomez,jshaMatthias Krüger-1/+0
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-29rustdoc: small fixes to mobile navigationJacob Hoffman-Andrews-2/+12
- 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-29Fix some CSS warnings and errors from VS CodeNoah Lev-1/+0
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-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 #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 #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-23Fix brief appearance of rust logo in the sidebarGuillaume Gomez-1/+1
2022-01-23Rollup merge of #93113 - GuillaumeGomez:unify-sizes, r=jshaMatthias Krüger-64/+19
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-1/+0
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```
2022-01-21Fix spacing for `·` between stability and sourceJacob Hoffman-Andrews-1/+0
2022-01-21Unify search input and buttons sizeGuillaume Gomez-64/+19
2022-01-21Rollup merge of #93139 - jsha:fix-wrapped-names, r=Nemo157Matthias Krüger-5/+25
rustdoc: fix overflow-wrap for table layouts For all table layouts, set overflow-wrap: break-word. Fixes #93135 Demo: https://rustdoc.crud.net/jsha/fix-wrapped-names/std/intrinsics/index.html#functions (Compare vs https://doc.rust-lang.org/nightly/std/intrinsics/index.html - you may have to make your browser narrower to see the effect) r? `@Nemo157`
2022-01-21rustdoc: remove dashed underline under main headingJacob Hoffman-Andrews-1/+0
2022-01-21Auto merge of #93138 - matthiaskrgr:rollup-m8akifd, r=matthiaskrgrbors-1/+8
Rollup of 17 pull requests Successful merges: - #91032 (Introduce drop range tracking to generator interior analysis) - #92856 (Exclude "test" from doc_auto_cfg) - #92860 (Fix errors on blanket impls by ignoring the children of generated impls) - #93038 (Fix star handling in block doc comments) - #93061 (Only suggest adding `!` to expressions that can be macro invocation) - #93067 (rustdoc mobile: fix scroll offset when jumping to internal id) - #93086 (Add tests to ensure that `let_chains` works with `if_let_guard`) - #93087 (Fix src/test/run-make/raw-dylib-alt-calling-convention) - #93091 (⬆ chalk to 0.76.0) - #93094 (src/test/rustdoc-json: Check for `struct_field`s in `variant_tuple_struct.rs`) - #93098 (Show a more informative panic message when `DefPathHash` does not exist) - #93099 (rustdoc: auto create output directory when "--output-format json") - #93102 (Pretty printer algorithm revamp step 3) - #93104 (Support --bless for pp-exact pretty printer tests) - #93114 (update comment for `ensure_monomorphic_enough`) - #93128 (Add script to prevent point releases with same number as existing ones) - #93136 (Backport the 1.58.1 release notes to master) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-01-20rustdoc: fix overflow-wrap for table layoutsJacob Hoffman-Andrews-5/+25
For all table layouts, set overflow-wrap: break-word.
2022-01-20Rollup merge of #93067 - jsha:fix-scroll-padding-top, r=GuillaumeGomezMatthias Krüger-1/+8
rustdoc mobile: fix scroll offset when jumping to internal id Followup to #92692. The semantics of `scroll-margin-top` are a little surprising - the attribute needs to be applied to the element that gets scrolled into the viewport, not the scrolling element. This fixes an issue where clicking on a method (or other item) from the sidebar takes you to a scroll position where the topbar covers up the method name. I'm interested in ideas for how to test this with browser-ui-test, but I think it doesn't yet have what I need. What I need is an assert that `<element>.getBoundingClientRect().y` is > 45. Demo: https://rustdoc.crud.net/jsha/fix-scroll-padding-top/std/string/struct.String.html#method.extend_from_within r? `@GuillaumeGomez`
2022-01-19Rustdoc mobile: put out-of-band on its own lineJacob Hoffman-Andrews-9/+20
Before this, the item name and the stability, source link, and "collapse all docs" would compete for room on a single line, resulting in awkward wrapping behavior on mobile. This gives a separate line for that out-of-band information. It also removes the "copy path" icon on mobile to make a little more room. Also, switch to flex-wrap: wrap, so anytime there's not enough room for `source`, it gets bumped to the next line.
2022-01-19Fix scroll offset when jumping to internal idJacob Hoffman-Andrews-1/+8
2022-01-18Remove horizontal lines at top of pageJacob Hoffman-Andrews-3/+0
They are not needed to separate the search bar and the title, which are visually distinct on their own.
2022-01-18Simplify and unify rustdoc sidebar stylesJacob Hoffman-Andrews-182/+122
This switches to just use size, weight, and spacing to distinguish headings in the sidebar. We no longer use boxes, horizontal bars, or centering to distinguish headings. This makes it much easier to understand the hierarchy of headings, and reduces visual noise. I also refactored how the mobile topbar works. Previously, we tried to shift around elements from the sidebar to make the topbar. Now, the topbar gets its own elements, which can be styled on their own. This makes styling and reasoning about those elements simpler. Because the heading font sizes are bigger, increase the sidebar width slightly. As a very minor change, removed version from the "All types" page. It's now only on the crate page.
2022-01-18Rollup merge of #92830 - jsha:style-cleanups, r=GuillaumeGomezMatthias Krüger-6/+0
Rustdoc style cleanups - Make "since" version numbers grey again (regressed in #92602). - Remove unneeded selectors for when crate filter dropdown is a sibling of search-input. - Crate filter dropdown doesn't need to be 100% width on mobile. - Only build crate filter dropdown when there is more than one crate. - Remove unused addCrateDropdown Demo: https://rustdoc.crud.net/jsha/style-cleanups/std/string/struct.String.html r? `@GuillaumeGomez`
2022-01-18Rollup merge of #92629 - jsha:theme-picker-local-only-2, r=GuillaumeGomezMatthias Krüger-11/+6
Pick themes on settings page, not every page This hides the paintbrush icon on most pages by default, in preference for the settings on the settings page. When loading from a local file, and not in mobile view, continue to show the theme picker. That's because some browsers limit access to localStorage from file:/// URLs, so choosing a theme from settings.html doesn't take effect. Fixes #84539 Part of #59840 r? `@GuillaumeGomez` Demo: https://rustdoc.crud.net/jsha/theme-picker-local-only-2/std/io/trait.Read.html
2022-01-17Rustdoc style cleanupsJacob Hoffman-Andrews-11/+0
- Make "since" version numbers grey again (regressed in #92602). - Remove unneeded selectors for when crate filter dropdown is a sibling of search-input. - Crate filter dropdown doesn't need to be 100% width on mobile. - Only build crate filter dropdown when there is more than one crate. - Remove unused addCrateDropdown.
2022-01-14Pick themes on settings page, not every pageJacob Hoffman-Andrews-11/+6
This hides the paintbrush icon on most pages by default, in preference for the settings on the settings page. When loading from a local file, and not in mobile view, continue to show the theme picker. That's because some browsers limit access to localStorage from file:/// URLs, so choosing a theme from settings.html doesn't take effect.
2022-01-14Enable wrapping words by defaultJacob Hoffman-Andrews-0/+16
Faced with a very long word, browsers will let it overflow its box horizontally rather than break it in the middle. We essentially never want that behavior. We would rather break the word and keep it inside its horizontal limits. So we apply a default overflow-wrap: break-word/anywhere to the document as a while. In some contexts we would rather add a horizontal scrollbar (code blocks), or elide the excess text with an ellipsis (sidebar). Those still work as expected.
2022-01-10Rollup merge of #92602 - jsha:source-link-2, r=GuillaumeGomezMatthias Krüger-12/+20
Make source links look cleaner Change from syntaxy-looking [src] to the plain word "source". Change the syntaxy-looking `[-]` at the top of the page to say "collapse". Reduce opacity of rightside content. Part of #59851 r? `@GuillaumeGomez` Demo: https://rustdoc.crud.net/jsha/source-link-2/std/string/struct.String.html [Discussed on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/display.20of.20source.20link).
2022-01-09Rollup merge of #92490 - jsha:crates-in-results, r=GuillaumeGomezMatthias Krüger-6/+12
Move crate drop-down to search results page This reduces clutter on doc pages. Part of #59840 r? ```@GuillaumeGomez``` Demo: https://rustdoc.crud.net/jsha/crates-in-results/std/index.html?search=str
2022-01-08Make source links look cleanerJacob Hoffman-Andrews-12/+20
Change from syntaxy-looking [src] to the plain word "source".
2022-01-07Rollup merge of #92610 - GuillaumeGomez:css-class-instead-of-inline-style, ↵Eric Huss-0/+4
r=jsha Create CSS class instead of using inline style for search results I saw this change in the update you proposed in https://github.com/rust-lang/rust/pull/92404. :) r? ``@jsha``
2022-01-06Create CSS class instead of using inline style for search resultsGuillaume Gomez-0/+4
2022-01-06Rollup merge of #92404 - GuillaumeGomez:src-font-size, r=jshaMatthias Krüger-1/+4
Fix font size for [src] links in headers Fixes #90384. cc `@jsha` r? `@camelid`
2022-01-06Rollup merge of #92058 - jsha:run-on-hover, r=GuillaumeGomezMatthias Krüger-1/+4
Make Run button visible on hover This slightly reduces the noisiness of doc pages, making them easier to read. Demo: https://rustdoc.crud.net/jsha/run-on-hover/std/string/struct.String.html [Discussed on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/.22Run.22.20button.20visible.20on.20hover). Part of #59845
2022-01-05Move crate drop-down to search results pageJacob Hoffman-Andrews-6/+12
This reduces clutter on doc pages.
2022-01-05Fix font size for [src] links in headersGuillaume Gomez-1/+4