about summary refs log tree commit diff
path: root/src/librustdoc/html/static
AgeCommit message (Collapse)AuthorLines
2023-04-12rustdoc: use CSS `overscroll-behavior` instead of JavaScriptMichael Howell-56/+8
Fixes the desktop scrolling weirdness mentioned in https://github.com/rust-lang/rust/pull/98775#issuecomment-1182575603 As described in the MDN page for this property: * The current Firefox ESR is 102, and the first Firefox version to support this feature is 59. * The current Chrome version 112, and the first version to support this is 63. * Edge is described as having a minor bug in `none` mode, but we use `contain` mode anyway, so it doesn't matter. * Safari 16, released September 2022, is the last browser to add this feature, and is also the oldest version we officially support.
2023-04-12rustdoc: make settings radio and checks thicker, less contrastMichael Howell-1/+5
This is very dependent on subjectivity and what screen you use, but this change makes the radio buttons' outer circle less ugly. This is because I could see the pixels very clearly, thanks to the very thin line and high contrast. This change makes both less severe, giving your browser's antialiasing algorithm more to work with. Since it's thicker, lowering the contrast shouldn't impact visibility.
2023-04-10rustdoc: remove redundant expandSection code from main.jsMichael Howell-14/+5
This functionality is already tested in `hash-item-expansion.goml`, and was implemented twice: * First, in code that ran at load time and at hash change: 917cdd295d2eed213c135d6f984c650f016ee3d6 * Later, the hash change event handler was itself run at load time, and the code handling both cases diverged in implementation, though their behavior still matches pretty well: f66a331335f3ac931afabca6f927a9d7dc17db3e
2023-04-08Rollup merge of #110037 - notriddle:notriddle/theme-default, r=GuillaumeGomezNilstrieb-0/+1
rustdoc: add test and bug fix for theme defaults Part of https://github.com/rust-lang/rust/issues/66181
2023-04-06rustdoc: add test and bug fix for theme defaultsMichael Howell-0/+1
2023-04-06rustdoc: clean up JSMichael Howell-28/+9
* Stop checking `func` in `onEach`. It's always hard-coded right at the call site, so there's no point. * Use the ternary operator in a few spots where it makes sense. * No point in making `onEach` store `arr.length` in a variable if it's only used once anyway.
2023-04-06Rollup merge of #109977 - notriddle:notriddle/data-nosnippet, r=jsha,the8472Matthias Krüger-7/+7
rustdoc: avoid including line numbers in Google SERP snippets ![image](https://user-images.githubusercontent.com/1593513/230141184-9171c8e0-de92-48e6-85b6-8baee35e6d86.png)
2023-04-05rustdoc: avoid including line numbers in Google SERP snippetsMichael Howell-7/+7
2023-04-05Improve display of logo on very small screensGuillaume Gomez-1/+6
2023-04-04Move scrollbar on the <main> element rather than only on the code block to ↵Guillaume Gomez-0/+4
improve UX
2023-03-31rustdoc-search: update docs for comma in `?` help popoverMichael Howell-3/+1
2023-03-27Rollup merge of #109633 - GuillaumeGomez:fix-go-to-only-setting, r=notriddleMatthias Krüger-5/+1
Fix "Directly go to item in search if there is only one result" setting Part of #66181. The setting was actually broken, so I fixed it when I added the GUI test. r? `@notriddle`
2023-03-26Fix "Directly go to item in search if there is only one result" settingGuillaume Gomez-5/+1
2023-03-25Rollup merge of #109542 - notriddle:notriddle/storage-js, r=GuillaumeGomezMatthias Krüger-77/+19
rustdoc: clean up `storage.js`
2023-03-24Rollup merge of #108629 - notriddle:notriddle/item-type-advanced, ↵Matthias Krüger-53/+111
r=GuillaumeGomez rustdoc: add support for type filters in arguments and generics This makes sense, since the search index has the information in it, and it's more useful for function signature searches since a function signature search's item type is, by definition, some type of function (there's more than one, but not very many).
2023-03-23rustdoc: remove old `content` hack for theme switchingMichael Howell-47/+5
This is based on the compatibility data for `window.matchMedia` and `MediaQueryList`'s `EventTarget` implementation. https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList#browser_compatibility https://developer.mozilla.org/en-US/docs/Web/API/Window/matchMedia#browser_compatibility * EventTarget would require us to drop support for all Chrome versions before 39. However, we already require Chrome 49, because rustdoc requires [CSS variables]. * EventTarget would also limit us to Firefox 55, but since #106502 rustdoc only supports Firefox > 68. * EventTarget limits us to Mobile Safari version 14, but #102404 shows that our CSS is broken in Safari versions before 15.5. [CSS variables]: https://developer.mozilla.org/en-US/docs/Web/CSS/--*#browser_compatibility
2023-03-23rustdoc: clean up `storage.js`Michael Howell-30/+14
This converts a few functions to more compact versions of themselves, and moves `RUSTDOC_MOBILE_BREAKPOINT` to main.js where it's actually used.
2023-03-21rustdoc: remove redundant `.content` prefix from span/a colorsMichael Howell-21/+21
Reverts a1d4ebe4961c107272f9764d1908227a3cd04092, as well as fixing the problem it solved with links losing their color.
2023-03-20rustdoc: add support for type filters in arguments and genericsMichael Howell-53/+111
This makes sense, since the search index has the information in it, and it's more useful for function signature searches since a function signature search's item type is, by definition, some type of function (there's more than one, but not very many).
2023-03-19rustdoc: implement bag semantics for function parameter searchMichael Howell-26/+70
This tweak to the function signature search engine makes things so that, if a type is repeated in the search query, it'll only match if the function actually includes it that many times.
2023-03-12Rollup merge of #109009 - notriddle:notriddle/edit-distance, r=GuillaumeGomezMatthias Krüger-149/+223
rustdoc: use restricted Damerau-Levenshtein distance for search Based on https://github.com/rust-lang/rust/pull/108200, for the same rationale. > This replaces the existing Levenshtein algorithm with the Damerau-Levenshtein algorithm. This means that "ab" to "ba" is one change (a transposition) instead of two (a deletion and insertion). More specifically, this is a restricted implementation, in that "ca" to "abc" cannot be performed as "ca" → "ac" → "abc", as there is an insertion in the middle of a transposition. I believe that errors like that are sufficiently rare that it's not worth taking into account. Before this change, searching [`prinltn!`] listed `print!` first, followed by `println!`. With this change, `println!` matches more closely. [`prinltn!`]: https://doc.rust-lang.org/nightly/std/?search=prinltn!
2023-03-11rustdoc: collapse edit distance state into an objectMichael Howell-80/+86
2023-03-11Rollup merge of #107629 - pitaj:rustdoc-search-deprecated, r=jshaMatthias Krüger-4/+21
rustdoc: sort deprecated items lower in search closes #98759 ### Screenshots `i32::MAX` show sup above `std::i32::MAX` and `core::i32::MAX` ![image](https://user-images.githubusercontent.com/803701/216725619-40afb7b0-e984-4a2e-ab5b-a95b24736b0e.png) If just searching for `min`, the deprecated results show up far below other things: ![image](https://user-images.githubusercontent.com/803701/216725672-e4325d37-9bfe-47eb-a1fe-0e57092aa811.png) one page later ![image](https://user-images.githubusercontent.com/803701/216725932-cd1c4a42-d527-44fb-a4ab-5a6d243659cc.png) ~~And, as you can see, the "Deprecation planned" message shows up in the search results. The same is true for fully-deprecated items like `mem::uninitialized`: ![image](https://user-images.githubusercontent.com/803701/216726268-1657e77a-563f-45a0-85a7-3a0cf4d66d6f.png)~~ Edit: the deprecation message change was removed from this PR. Only the sorting is changed.
2023-03-10rustdoc: use restricted Damerau-Levenshtein distance for searchMichael Howell-147/+215
Based on https://github.com/rust-lang/rust/pull/108200, for the same rationale. > This replaces the existing Levenshtein algorithm with the > Damerau-Levenshtein algorithm. This means that "ab" to "ba" is one change > (a transposition) instead of two (a deletion and insertion). More > specifically, this is a restricted implementation, in that "ca" to "abc" > cannot be performed as "ca" → "ac" → "abc", as there is an insertion in the > middle of a transposition. I believe that errors like that are sufficiently > rare that it's not worth taking into account. Before this change, searching `prinltn!` listed `print!` first, followed by `println!`. With this change, `println!` matches more closely.
2023-03-11Auto merge of #104527 - ferrocene:pa-more-licenses, r=pnkfelixbors-0/+21
Add more license annotations This PR updates the `.reuse/dep5` file to include more accurate licensing data for everything in the repository (*excluding* submodules and dependencies). Some decisions were made in this PR: * The standard copyright attribution for files maintained by us is "The Rust Project Developers (see https://thanks.rust-lang.org)", to avoid having to maintain an in-tree `AUTHORS` file. * For files that have specific licensing terms, we added the terms to the `.reuse/dep5` rather than adding SPDX comments in the files themselves. * REUSE picks up any comment/text line with `Copyright` on it, so I had to sprinkle around `REUSE-IgnoreStart` and `REUSE-IgnoreEnd` comments. The rendered `COPYRIGHT` file is available at https://gist.github.com/pietroalbini/efb81103f69596d39758114f3f6a8688. r? `@pnkfelix`
2023-03-10rustdoc: sort deprecated items lower in searchPeter Jaszkowiak-4/+21
serialize `q` (`itemPaths`) sparsely overall 4% reduction in search index size
2023-03-09avoid reuse tripping over copyright noticesPietro Albini-0/+21
2023-03-08Update src/librustdoc/html/static/js/storage.jsMichael Howell-1/+1
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2023-03-08Fix eslint errorsGuillaume Gomez-0/+1
2023-03-08Only load one CSS theme by defaultMichael Howell-33/+52
To avoid generating a FOUC at startup, this commit uses `document.write` to load the stylesheet initially. Co-Authored-By: Guillaume Gomez <guillaume1.gomez@gmail.com>
2023-03-03Emit an error for unclosed genericGuillaume Gomez-1/+13
2023-03-02Put backtick content from rustdoc search errors into a <code> elementsGuillaume Gomez-40/+99
2023-03-01Rollup merge of #108143 - notriddle:notriddle/filter-exclamation-macro, ↵Dylan DPC-6/+26
r=GuillaumeGomez rustdoc: search by macro when query ends with `!` Related to #96399 Note: the `never` type alias is tested in [`/tests/rustdoc-js-std/alias-3.js`](https://github.com/notriddle/rust/blob/08ad401633037cc226b3806a3c5f48c2f34703bf/tests/rustdoc-js-std/alias-3.js) ## Before ![image](https://user-images.githubusercontent.com/1593513/219504192-54cc0753-ff97-4a37-ad4a-8ae915181325.png) ## After ![image](https://user-images.githubusercontent.com/1593513/219504251-589a7e11-1e7b-4b7b-879d-1b564080017c.png)
2023-02-26Clean up JS files code a bitGuillaume Gomez-13/+7
2023-02-25Update search eBNF with `!` movedMichael Howell-2/+2
Co-Authored-By: GuillaumeGomez <guillaume1.gomez@gmail.com>
2023-02-19Rollup merge of #107783 - notriddle:notriddle/item-table-ul, r=GuillaumeGomezDylan DPC-7/+9
rustdoc: simplify DOM for `.item-table` 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-16Correct eslint warningMichael Howell-1/+1
2023-02-16rustdoc: search by macro when query ends with `!`Michael Howell-4/+24
Related to #96399
2023-02-13rustdoc: use a string with one-character codes for search index typesMichael Howell-4/+5
$ wc -c search-index.old.js search-index.new.js 3940530 search-index.old.js 3843222 search-index.new.js ((3940530-3843222)/3940530)*100 = 2.47% $ wc -c search-index.old.js.gz search-index.new.js.gz 380251 search-index.old.js.gz 379434 search-index.new.js.gz ((380251-379434)/380251)*100 = 0.214%
2023-02-13Rollup merge of #107340 - notriddle:notriddle/simplify-doctest-tooltip, ↵Matthias Krüger-103/+69
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 #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-11Improve JS function itemTypeFromName code a bitGuillaume Gomez-6/+4
2023-02-11Rollup merge of #107490 - notriddle:notriddle/rm-sidebar-tooltip, ↵Dylan DPC-5/+1
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-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-07rustdoc: simplify DOM for `.item-table`Michael Howell-7/+9
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-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-0/+1
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