about summary refs log tree commit diff
path: root/src/librustdoc/html
AgeCommit message (Collapse)AuthorLines
2023-02-13Rollup merge of #107340 - notriddle:notriddle/simplify-doctest-tooltip, ↵Matthias Krüger-109/+81
r=GuillaumeGomez rustdoc: merge doctest tooltip with notable traits tooltip Fixes https://discord.com/channels/442252698964721669/443150878111694848/1066420140167680000 <details><summary>a user report where the tooltip arrow overlaps the text</summary> ![](https://cdn.discordapp.com/attachments/443150878111694848/1066420139530145812/this-example-is-not-tested-busted-rendering.png) </details> Fixes #91100 Preview: <https://notriddle.com/notriddle-rustdoc-demos/simplify-doctest-tooltip/std/vec/struct.Vec.html#indexing> Screenshot: ![image](https://user-images.githubusercontent.com/1593513/214975516-72667632-4609-49fa-8c37-e8d2ba1ba7dc.png)
2023-02-12Rollup merge of #107964 - notriddle:notriddle/title-line-height, ↵Matthias Krüger-0/+8
r=GuillaumeGomez rustdoc: use tighter line height in h1 and h2 This keeps the line height for body text the same, as required by WCAG, but for headers, it makes sense to have wrapped lines be a bit tighter packed. ## Before ![image](https://user-images.githubusercontent.com/1593513/218332683-88a02467-7811-4e6b-81f8-67dded691465.png) ## After ![image](https://user-images.githubusercontent.com/1593513/218332698-a1b2a265-0658-4306-8473-b835f663172d.png)
2023-02-12Rollup merge of #107934 - ↵Matthias Krüger-4/+16
notriddle:notriddle/intra-doc-link-meta-description, r=camelid,GuillaumeGomez rustdoc: account for intra-doc links in `<meta name="description">` Similar to #86451, but for the SEO descriptions instead of the search descriptions.
2023-02-12Rollup merge of #107930 - GuillaumeGomez:js-func-improvement, r=notriddleMatthias Krüger-6/+4
Improve JS function itemTypeFromName code a bit Very small code improvement replacing a `for` loop with `findIndex` method. r? ````@notriddle````
2023-02-12rustdoc: use tighter line height in h1 and h2Michael Howell-0/+8
2023-02-11rustdoc: account for intra-doc links in `<meta name="description">`Michael Howell-4/+16
2023-02-11Improve JS function itemTypeFromName code a bitGuillaume Gomez-6/+4
2023-02-11Rollup merge of #107909 - notriddle:notriddle/register-header-empty-cond, ↵Matthias Krüger-5/+1
r=camelid rustdoc: remove redundant `if s.is_empty()` from `find_testable_code`
2023-02-11Rollup merge of #107864 - notriddle:notriddle/rustdoc-write-stutter, ↵Matthias Krüger-15/+12
r=GuillaumeGomez rustdoc: clean up `write!` calls with less stuttering
2023-02-11Auto merge of #94857 - petrochenkov:doclink2, r=oli-obkbors-9/+1
Resolve documentation links in rustc and store the results in metadata This PR implements MCP https://github.com/rust-lang/compiler-team/issues/584. Doc links are now resolved in rustc and stored into metadata, so rustdoc simply retrieves them through a query (local or extern), Code that is no longer used is removed, and some code that no longer needs to be public is privatized. The removed code includes resolver cloning, so this PR fixes https://github.com/rust-lang/rust/issues/83761.
2023-02-11Rollup merge of #107490 - notriddle:notriddle/rm-sidebar-tooltip, ↵Dylan DPC-14/+4
r=GuillaumeGomez rustdoc: remove inconsistently-present sidebar tooltips Discussed in https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/Inconsistent.20sidebar.20tooltips/near/323565625
2023-02-10rustdoc: remove redundant `if s.is_empty()` from `find_testable_code`Michael Howell-5/+1
2023-02-10Resolve documentation links in rustc and store the results in metadataVadim Petrochenkov-9/+1
This commit implements MCP https://github.com/rust-lang/compiler-team/issues/584 It also removes code that is no longer used, and that includes code cloning resolver, so issue #83761 is fixed.
2023-02-10Rollup merge of #107852 - notriddle:notriddle/rm-tab, r=GuillaumeGomezMatthias Krüger-7/+5
rustdoc: remove unused fn parameter `tab`
2023-02-09rustdoc: clean up `write!` calls with less stutteringMichael Howell-15/+12
2023-02-09Rollup merge of #107655 - notriddle:notriddle/small-url-encode, r=GuillaumeGomezDylan DPC-64/+54
rustdoc: use the same URL escape rules for fragments as for examples Carries over improvements from #107284
2023-02-09rustdoc: remove unused fn parameter `tab`Michael Howell-7/+5
2023-02-08rustdoc: use [svgo] to shrink `wheel.svg`Michael Howell-1/+1
[svgo]: https://github.com/svg/svgo $ du -bs src/librustdoc/html/static/images/wheel.svg wheel-old.svg 2972 src/librustdoc/html/static/images/wheel.svg 3764 wheel-old.svg 100*((2972-3764)/3764) = -21.04%
2023-02-08Rollup merge of #107770 - notriddle:notriddle/br2nl, r=GuillaumeGomezMatthias Krüger-17/+14
rustdoc: use a newline instead of `<br>` to format code headers Since these elements now use `white-space: pre-wrap` since #107615, it's fine to use newlines for formatting, which is smaller and a bit less complicated.
2023-02-07rustdoc: simplify DOM for `.item-table`Michael Howell-17/+19
This switches from using `<div>` to the more semantic `<ul>`, and using class names that rhyme with the classes the search results table uses.
2023-02-07rustdoc: use a newline instead of `<br>` to format code headersMichael Howell-17/+14
Since these elements now use `white-space: pre-wrap` since 784665d4ce59c5239791f1f96fa2137e47ca1817, it's fine to use newlines for formatting, which is smaller and a bit less complicated.
2023-02-07Rollup merge of #107471 - notriddle:notriddle/default-settings, r=GuillaumeGomezMatthias Krüger-0/+2
rustdoc: do not include empty default-settings tag in HTML
2023-02-06Rollup merge of #107725 - GuillaumeGomez:turn-markdownwithtoc-into-struct, ↵Matthias Krüger-9/+9
r=notriddle Turn MarkdownWithToc into a struct with named fields Extracted the commit from https://github.com/rust-lang/rust/pull/107640. r? `@notriddle`
2023-02-06Turn MarkdownWithToc into a struct with named fieldsGuillaume Gomez-9/+9
2023-02-06Rollup merge of #107669 - notriddle:notriddle/ayu-smaller, r=GuillaumeGomezDylan DPC-34/+14
rustdoc: combine duplicate rules in ayu CSS
2023-02-06Auto merge of #107141 - notriddle:notriddle/max-lev-distance-2023, ↵bors-65/+84
r=GuillaumeGomez rustdoc: compute maximum Levenshtein distance based on the query Preview: https://notriddle.com/notriddle-rustdoc-demos/search-lev-distance-2023/std/index.html?search=regex The heuristic is pretty close to the name resolver, maxLevDistance = `Math.floor(queryLen / 3)`. Fixes #103357 Fixes #82131 Similar to https://github.com/rust-lang/rust/pull/103710, but following the suggestion in https://github.com/rust-lang/rust/pull/103710#issuecomment-1296360267 to use `floor` instead of `ceil`, and unblocked now that https://github.com/rust-lang/rust/pull/105796 made it so that setting the max lev distance to `0` doesn't cause substring matches to be removed.
2023-02-04rustdoc: trait bound formattingRoland Strasser-12/+21
rustdoc: fix item-spacer rustdoc: use proper comment style rustdoc: change formatting where clauses for traits rustdoc: remove semicolon from provided methods update provided methods formatting
2023-02-04rustdoc: combine duplicate rules in ayu CSSMichael Howell-34/+14
2023-02-03rustdoc: use the same URL escape rules for fragments as for examplesMichael Howell-64/+54
2023-02-03Rollup merge of #107615 - notriddle:notriddle/nbsp, r=GuillaumeGomezMichael Goulet-12/+14
Replace nbsp in all rustdoc code blocks Based on #106125 by `@dtolnay` — this PR fixes the line wrapping bug. Fixes #106098. This makes code copyable from rustdoc rendered documentation into a Rust source file.
2023-02-03Replace nbsp in all rustdoc code blocksMichael Howell-12/+14
Co-Authored-By: David Tolnay <dtolnay@gmail.com>
2023-02-02Auto merge of #107000 - GuillaumeGomez:fix-items-in-doc-hidden-block, ↵bors-1/+1
r=notriddle,petrochenkov Fix handling of items inside a `doc(hidden)` block Fixes #106373. cc `@aDotInTheVoid` r? `@notriddle`
2023-02-02Rollup merge of #107531 - GuillaumeGomez:inline-images-in-css, r=notriddleMatthias Krüger-10/+13
Inline CSS background images directly into the CSS A nice advantage of this is that it removes a few entries in the list of static files. r? ``@notriddle``
2023-02-01Inline CSS background images directly into the CSSGuillaume Gomez-10/+13
2023-01-31Rollup merge of #107527 - notriddle:notriddle/wcagcontrast, r=GuillaumeGomezGuillaume Gomez-18/+5
rustdoc: stop making unstable items transparent Fixes #93393
2023-01-31Rollup merge of #107491 - notriddle:notriddle/setting-check, r=GuillaumeGomezGuillaume Gomez-2/+0
rustdoc: remove unused CSS from `.setting-check` These rules were needed for the mobile-style switches, but those were removed in 0f3ae6218ef1d9e9b14bf983b463785b14abc205
2023-01-31Rollup merge of #107354 - tspiteri:source-serif-4.005, r=GuillaumeGomezGuillaume Gomez-4/+12
rustdoc: update Source Serif 4 from 4.004 to 4.005 [Version 4.005](https://github.com/adobe-fonts/source-serif/releases/tag/4.005R) was released on 2023-01-20.
2023-01-31rustdoc: stop making unstable items transparentMichael Howell-18/+5
Fixes #93393
2023-01-31rustdoc: remove inconsistently-present sidebar tooltipsMichael Howell-14/+4
Discussed in https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/Inconsistent.20sidebar.20tooltips/near/323565625
2023-01-31Clean up eslint annotations and remove unused JS functionGuillaume Gomez-2/+0
2023-01-31Rollup merge of #107482 - notriddle:notriddle/keywords, r=jshaYuki Okushi-16/+3
rustdoc: remove meta keywords from HTML Discussed in <https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/.60.3Cmeta.20name.3D.22keywords.22.3E.60>
2023-01-31Rollup merge of #107477 - GuillaumeGomez:css-var, r=notriddleYuki Okushi-32/+21
Migrate last part of CSS themes to CSS variables No changes in the output. This is already tested in `tests/rustdoc-gui/search-tab.goml` so no need to add a GUI test. r? `@notriddle`
2023-01-31Rollup merge of #107476 - notriddle:notriddle/item-decl-3, r=GuillaumeGomezYuki Okushi-317/+277
rustdoc: remove unnecessary wrapper `div.item-decl` from HTML
2023-01-30rustdoc: remove unused CSS from `.setting-check`Michael Howell-2/+0
These rules were needed for the mobile-style switches, but those were removed in 0f3ae6218ef1d9e9b14bf983b463785b14abc205
2023-01-30rustdoc: remove meta keywords from HTMLMichael Howell-16/+3
Discussed in <https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/.60.3Cmeta.20name.3D.22keywords.22.3E.60>
2023-01-30Migrate last part of CSS themes to CSS variablesGuillaume Gomez-32/+21
2023-01-30rustdoc: remove unnecessary wrapper div.item-decl from HTMLMichael Howell-317/+277
2023-01-30Rollup merge of #107177 - thanatos:fix-doc-errant-light-theme, r=notriddleMatthias Krüger-62/+54
Keep all theme-updating logic together Prior to this PR, if the page is restored from the browser bfcache¹, we call `switchToSavedTheme`. But `switchToSavedTheme` never looks at the `use-system-theme` preference. Further, if it can't find a saved theme, it will fall back to the default of "light". For a user with cookies disabled² whose preferred color scheme is dark, this means the theme will wobble back and forth between dark and light. The sequence that occurs is, 1. The page is loaded. During a page load, we consult `use-system-theme`: as cookies are disabled, this preference is unset. The default is true. Because the default is true, we look at the preferred color scheme: for our example user, that's "dark". **The page theme is set to dark.** We'll attempt to store these preferences in localStorage, but fail due to cookies being disabled. 2. The user navigates through the docs. Subsequent page loads happen, and the same process in step 1 recurs. Previous pages are (potentially) put into the bfcache. 3. The user navigates backwards/forwards, causing a page in bfcache to be pulled out of cache. The `pageShow` event handler is triggered. However, this calls `switchToSavedTheme`: this doesn't consider the system theme, as noted above. Instead, it only looks for a saved theme. However, with cookies disabled, there is none. It defaults to light. **The page theme is set to light!** The user wonders why the dark theme is lost. There are effectively two functions trying to determine and apply the correct theme: `updateSystemTheme` and `switchToSavedTheme`. Thus, we merge them into just one: `updateTheme`. This function contains all the logic for determining the correct theme, and is called in all circumstances where we need to set the theme: * The initial page load * If the browser preferred color scheme (i.e., light/dark mode) is changed * If the page is restored from bfcache * If the user updates the theme preferences (i.e., in `settings.js`) Fixes https://github.com/rust-lang/rust/issues/94250. ¹bfcache: https://web.dev/bfcache/ The bfcache is used to sleep a page, if the user navigates away from it, and to restore it from cache if the user returns to it. ²Note that the browser preference that enables/disables cookies really controls many forms of storage. The same preference thus also affects localStorage. (This is so a normal browser user doesn't need to understand the distinction between "cookies" and "localStorage".)
2023-01-30rustdoc: do not include empty default-settings tag in HTMLMichael Howell-0/+2
2023-01-30Keep all theme-updating logic togetherRoy Wellington Ⅳ-46/+54
Prior to this PR, if the page is restored from the browser bfcache¹, we call `switchToSavedTheme`. But `switchToSavedTheme` never looks at the `use-system-theme` preference. Further, if it can't find a saved theme, it will fall back to the default of "light". For a user with cookies disabled² whose preferred color scheme is dark, this means the theme will wobble back and forth between dark and light. The sequence that occurs is, 1. The page is loaded. During a page load, we consult `use-system-theme`: as cookies are disabled, this preference is unset. The default is true. Because the default is true, we look at the preferred color scheme: for our example user, that's "dark". **The page theme is set to dark.** We'll attempt to store these preferences in localStorage, but fail due to cookies being disabled. 2. The user navigates through the docs. Subsequent page loads happen, and the same process in step 1 recurs. Previous pages are (potentially) put into the bfcache. 3. The user navigates backwards/forwards, causing a page in bfcache to be pulled out of cache. The `pageShow` event handler is triggered. However, this calls `switchToSavedTheme`: this doesn't consider the system theme, as noted above. Instead, it only looks for a saved theme. However, with cookies disabled, there is none. It defaults to light. **The page theme is set to light!** The user wonders why the dark theme is lost. There are effectively two functions trying to determine and apply the correct theme: `updateSystemTheme` and `switchToSavedTheme`. Thus, we merge them into just one: `updateTheme`. This function contains all the logic for determining the correct theme, and is called in all circumstances where we need to set the theme: * The initial page load * If the browser preferred color scheme (i.e., light/dark mode) is changed * If the page is restored from bfcache * If the user updates the theme preferences (i.e., in `settings.js`) Fixes #94250. ¹bfcache: https://web.dev/bfcache/ The bfcache is used to sleep a page, if the user navigates away from it, and to restore it from cache if the user returns to it. ²Note that the browser preference that enables/disables cookies really controls many forms of storage. The same preference thus also affects localStorage. (This is so a normal browser user doesn't need to understand the distinction between "cookies" and "localStorage".)