summary refs log tree commit diff
path: root/src/librustdoc/html/static
AgeCommit message (Collapse)AuthorLines
2024-08-31Rollup merge of #129824 - GuillaumeGomez:code-example-buttons-mobile, ↵Matthias Krüger-2/+8
r=notriddle Fix code examples buttons not appearing on click on mobile When browsing docs on mobile today, I realized that the buttons didn't appear when I tapped on the code example. One issue: I have no idea how to add a regression test for this case... r? ``@notriddle``
2024-08-31Fix code examples buttons not appearing on click on mobileGuillaume Gomez-2/+8
2024-08-29Separate core search logic with search uiFolyd-2277/+2316
2024-08-24Rollup merge of #129430 - lolbinarycat:rustdoc-search-exact-case, r=notriddleTrevor Gross-0/+8
rustdoc: show exact case-sensitive matches first fixes #119480
2024-08-23rustdoc: show exact case-sensitive matches firstbinarycat-0/+8
fixes #119480
2024-08-22rustdoc-search: use tighter json for names and parentsMichael Howell-7/+10
File size --------- ```console $ du -hs doc.old/search-index1.82.0.js doc/search-index1.82.0.js 3.2M doc.old/search-index1.82.0.js 2.8M doc/search-index1.82.0.js $ gzip doc/search-index1.82.0.js $ gzip doc.old/search-index1.82.0.js $ du -hs doc.old/search-index1.82.0.js.gz doc/search-index1.82.0.js.gz 464K doc.old/search-index1.82.0.js.gz 456K doc/search-index1.82.0.js.gz $ du -hs compiler-doc.old/search-index.js compiler-doc/search-index.js 8.5M compiler-doc.old/search-index.js 6.5M compiler-doc/search-index.js $ gzip compiler-doc/search-index1.82.0.js $ gzip compiler-doc.old/search-index1.82.0.js $ du -hs compiler-doc.old/search-index.js.gz compiler-doc/search-index.js.gz 1.4M compiler-doc.old/search-index.js.gz 1.4M compiler-doc/search-index.js.gz ```
2024-08-19rustdoc: animate the `:target` highlightMichael Howell-0/+13
This approach is, roughly, based on how Discourse does it. It came up while discussing some other possible sidebar changes, as a design that made rapid scanning easier while avoiding the inherent trade-offs in summarizing.
2024-08-12Rollup merge of #128394 - GuillaumeGomez:run-button, r=t-rustdocGuillaume Gomez-43/+27
Unify run button display with "copy code" button and with mdbook buttons Follow-up of https://github.com/rust-lang/rust/pull/128339. It looks like this (coherency++, yeay!): ![Screenshot from 2024-07-30 15-16-31](https://github.com/user-attachments/assets/5e262e5b-f338-4085-94ca-e223033a43db) Can be tested [here](https://rustdoc.crud.net/imperio/run-button/foo/struct.Bar.html). r? `@notriddle`
2024-08-06rustdoc-search: account for numeric disambiguators on implsMichael Howell-6/+12
Fixes #128676
2024-08-05Prevent clicking on a link or on a button to toggle the code example buttons ↵Guillaume Gomez-2/+6
visibility
2024-08-05Unify run button display with "copy code" button and with mdbook buttonsGuillaume Gomez-41/+21
2024-08-04Rollup merge of #128615 - notriddle:notriddle/anchor-a11y, r=GuillaumeGomezMatthias Krüger-1/+1
rustdoc: make the hover trail for doc anchors a bit bigger https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/Weird.20markdown.20heading.20rendering.3F r? ```@GuillaumeGomez``` ### Screenshots (the purple part is the padding, which the mouse can pass through to hover over it) | Before | After | |--|--| | ![image](https://github.com/user-attachments/assets/5070eebe-84ac-4f5d-8950-58664370191c) | ![image](https://github.com/user-attachments/assets/55340161-ad8a-41bd-a120-8cdab11f4af0)
2024-08-03rustdoc: make the hover trail for doc anchors a bit biggerMichael Howell-1/+1
https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/Weird.20markdown.20heading.20rendering.3F
2024-08-03Rollup merge of #128573 - GuillaumeGomez:simplify-body, r=notriddleMatthias Krüger-5/+3
Simplify `body` usage in rustdoc No changes, just a little less code. r? `@notriddle`
2024-08-03Simplify `body` usage in rustdocGuillaume Gomez-5/+3
2024-08-01rustdoc: Remove dead opaque_tys rendering logicAlona Enraght-Moony-1/+0
2024-07-30Rollup merge of #128339 - GuillaumeGomez:click-code-example, r=notriddleMatthias Krüger-3/+37
[rustdoc] Make the buttons remain when code example is clicked Follow-up of https://github.com/rust-lang/rust/pull/125779. One current issue we have with "run" button and the newly added copy code button is that if you're on mobile devices, you can't use them. I took a look at how `mdbook` is handling it and when you click on a code example, they show the buttons. I think it's a really good idea as if you want to copy the code on your mobile device, you will click on it, showing the buttons. Feature can be tested [here](https://rustdoc.crud.net/imperio/click-code-example/foo/struct.Bar.html). r? `@notriddle`
2024-07-29Make the buttons remain when code example is clickedGuillaume Gomez-3/+37
2024-07-29rustdoc: properly handle path wrappingMichael Howell-1/+4
2024-07-28Rollup merge of #125779 - GuillaumeGomez:copy-code, r=rustdoc-teamGuillaume Gomez-48/+135
[rustdoc] Add copy code feature This PR adds a "copy code" to code blocks. Since this is a JS only feature, the HTML is generated with JS when the user hovers the code block to prevent generating DOM unless needed. Two things to note: 1. I voluntarily kept the current behaviour of the run button (only when hovering a code block with a mouse) so it doesn't do anything on mobile. I plan to send a follow-up where the buttons would "expandable" or something. Still need to think which approach would be the best. 2. I used a picture and not text like the run button to remain consistent with the "copy path" button. I'd also prefer for the run button to use a picture (like what is used in mdbook) but again, that's something to be discussed later on. The rendering looks like this: ![Screenshot from 2024-06-03 21-29-48](https://github.com/rust-lang/rust/assets/3050060/a0b18f9c-b3dd-4a65-89a7-5a7a303b5c2b) ![Screenshot from 2024-06-03 21-30-20](https://github.com/rust-lang/rust/assets/3050060/b3b084ff-2716-4160-820b-d4774681a961) It can be tested [here](https://guillaume-gomez.fr/rustdoc/bar/struct.Bar.html) (without the run button) and [here](https://guillaume-gomez.fr/rustdoc/foo/struct.Bar.html) (with the run button). Fixes #86851. r? ``@notriddle``
2024-07-25use double quotesbinarycat-1/+1
2024-07-25rustdoc: change title of search resultsbinarycat-1/+1
the current title is too similar to that of the page for std::result::Result, which is a problem both for navigating to the Result docs via browser autocomplete, and for being able to tell which tab is which when the width of tabs is small.
2024-07-21rustdoc: revert spacing change in item-tableMichael Howell-1/+0
It really wasn't necessary for the bug fix, and could reasonably be considered a functional regression.
2024-07-21Rollup merge of #128023 - Kijewski:pr-table-width, r=notriddleJubilee-0/+1
rustdoc: short descriptions cause word-breaks in tables The `.item-table` class is used to display name+description lists, e.g. the exported functions, as a table. If the names are long and the descriptions are short, then the width of the table does not expand to the whole size, but only uses a fraction. This causes a some names to break inside a word. This change makes the table always use 100% of its parent width. The `.width-limiter` wrapper already ensures that the used width still does not become excessive. See e.g. <https://docs.rs/mathlab/0.3.0/mathlab/fun/vec_num/index.html> or <https://docs.rs/cw-events/0.0.9/cw_events/> (random choices out of the list of the recent releases). [![](https://i.imgur.com/XnH4eeT.png)](https://imgur.com/XnH4eeT) [![](https://i.imgur.com/7iQ9xE2.png)](https://imgur.com/7iQ9xE2) The problem occurs (at least) in Firefox 130, Falkon 24, and Konqueror 22. It does not occur in Chrome 126.
2024-07-21rustdoc: short descr. cause word-breaks in tablesRené Kijewski-0/+1
The `.item-table` class is used to display name+description lists, e.g. the exported functions, as a table. If the names are long and the descriptions are short, then the width of the table does not expand to the whole size, but only uses a fraction. This causes a some names to break inside a word. This change makes the table always use 100% of its parent width. The `.width-limiter` wrapper already ensures that the used width still does not become excessive. Signed-off-by: René Kijewski <rene.kijewski@fu-berlin.de>
2024-07-20Fix stab display in doc blocksGuillaume Gomez-0/+4
2024-07-19Auto merge of #127969 - matthiaskrgr:rollup-nhxmwhn, r=matthiaskrgrbors-1/+0
Rollup of 7 pull requests Successful merges: - #112328 (Feat. adding ext that returns change_time) - #126199 (Add `isqrt` to `NonZero<uN>`) - #127856 (interpret: add sanity check in dyn upcast to double-check what codegen does) - #127934 (Improve error when a compiler/library build fails in `checktools.sh`) - #127960 (Cleanup dll/exe filename calculations in `run_make_support`) - #127963 (Fix display of logo "border") - #127967 (Disable run-make/split-debuginfo test for RISC-V 64) r? `@ghost` `@rustbot` modify labels: rollup
2024-07-19Rollup merge of #127963 - GuillaumeGomez:fix-logo-display, r=notriddleMatthias Krüger-1/+0
Fix display of logo "border" Before: ![Screenshot from 2024-07-19 13-32-17](https://github.com/user-attachments/assets/381bb9c8-0ae0-408b-8476-9785ef1b5fd4) After: ![Screenshot from 2024-07-19 13-37-46](https://github.com/user-attachments/assets/19cdb71f-3912-4fcd-95de-99b9f86a8293) r? `@notriddle`
2024-07-19Fix display of logo "border"Guillaume Gomez-1/+0
2024-07-19Rollup merge of #127932 - notriddle:notriddle/current, r=GuillaumeGomezMatthias Krüger-3/+5
rustdoc: fix `current` class on sidebar modnav | Before | After | | -- | -- | | ![image](https://github.com/user-attachments/assets/35866be8-5a58-41eb-9169-b2bb403fe7cd) | ![image](https://github.com/user-attachments/assets/89b087ea-82bf-49f5-9c87-20162880eb32)
2024-07-18Rearrange sidebar modnav builder to more logical orderMichael Howell-2/+2
2024-07-18rustdoc: fix `current` class on sidebar modnavMichael Howell-3/+5
2024-07-18Wrap too long item name and improve the item list display a bitGuillaume Gomez-0/+8
2024-07-18Unify UI between code block buttons and top buttonsGuillaume Gomez-7/+14
2024-07-18Make "copy code" button the same size as the "copy path" buttonGuillaume Gomez-23/+11
2024-07-18Add copy code buttonGuillaume Gomez-40/+132
2024-07-17Rollup merge of #127229 - notriddle:notriddle/mile-wide-bar, r=GuillaumeGomezMatthias Krüger-4/+51
rustdoc: click target for sidebar items flush left This change adjusts the clickable area of sidebar links to touch the leftmost edge of the canvas, making them [much easier](https://www.nngroup.com/articles/fitts-law/) to click (when the browser window is maximized or tiled left, but those cases are common enough to matter). [Screencast from 2024-07-15 15-31-07.webm](https://github.com/user-attachments/assets/1e952d3a-e9e7-476b-b211-44a17c190b38) <details><summary>old screencast</summary> [Screencast from 2024-07-01 17-23-34.webm](https://github.com/rust-lang/rust/assets/1593513/dc6f9c2e-5904-403d-b353-d233e6e1afbc) </details>
2024-07-15rustdoc: make sidebar highlight cover whole click targetMichael Howell-2/+41
2024-07-05rustdoc-search: stop constructing pointless arrays in decodeMichael Howell-11/+7
I'm not sure why I ever thought that would be okay. This is clearly hot code, and should avoid Array.prototype.map when it's not needed. In any case, it shows up in the profiler. rustdoc-js-profiler: https://notriddle.com/rustdoc-html-demo-11/decode-opt-1/index.html Firefox profiler: [Before](https://share.firefox.dev/3RRH2fR) [After](https://share.firefox.dev/3Wblcq8)
2024-07-01rustdoc: click target for sidebar items flush leftMichael Howell-4/+12
2024-06-09rustdoc-search: use lowercase, non-normalized name for type searchMichael Howell-4/+8
The type name ID map has underscores in its names, so the query element should have them, too.
2024-06-07Update testsSunshine-2/+3
2024-06-07Follow ESLint instructions.Sunshine-4/+7
2024-06-07Other EcmaScript version bumpSunshine-1/+1
2024-06-07Bump the EcmaScript version in the eslint configuration.Sunshine-1/+1
2024-06-07TidyingSunshine-2/+4
2024-06-07Add test for PR #126057Sunshine-1/+2
2024-06-06Make html rendered by rustdoc allow searching non-English identifier / ↵Sunshine-70/+78
alias. Fix alias search result showing `undefined` description.
2024-05-07Rollup merge of #124738 - notriddle:notriddle/search-form-js, r=GuillaumeGomezMatthias Krüger-0/+43
rustdoc: dedup search form HTML This change constructs the search form HTML using JavaScript, instead of plain HTML. It uses a custom element because - the [parser]'s insert algorithm runs the connected callback synchronously, so we won't get layout jank - it requires very little HTML, so it's a real win in size [parser]: https://html.spec.whatwg.org/multipage/parsing.html#create-an-element-for-the-token This shrinks the standard library by about 60MiB, by my test. There should be no visible changes. Just use less disk space.
2024-05-06Rollup merge of #124765 - GuillaumeGomez:fix-wrong-cog-colotr, r=notriddleMatthias Krüger-0/+5
[rustdoc] Fix bad color for setting cog in ayu theme Before: ![Screenshot from 2024-05-05 19-29-36](https://github.com/rust-lang/rust/assets/3050060/e1f078e5-7fb3-472d-91e7-b4bde551d411) After: ![image](https://github.com/rust-lang/rust/assets/3050060/0aa115ac-dd69-48e1-b93e-067a39cf25d2) r? ````@notriddle````