about summary refs log tree commit diff
path: root/src/librustdoc/html/static
AgeCommit message (Collapse)AuthorLines
2025-01-30Rollup merge of #133636 - GuillaumeGomez:sans-serif, r=rustdocMatthias Krüger-3/+64
[rustdoc] Add sans-serif font setting Fixes https://github.com/rust-lang/rust/issues/52449. This PR adds a new setting introducing the possibility to switch to a sans-serif font (`Fira Sans`) for the text. Can be tested [here](https://rustdoc.crud.net/imperio/sans-serif/std/index.html). cc ```@rust-lang/rustdoc-frontend``` r? ```@notriddle```
2025-01-29Add SemiBold for SourceSerif4Guillaume Gomez-3/+11
2025-01-29Add italic for newly added sans serif fontsGuillaume Gomez-2/+18
2025-01-29Add new setting allowing to switch to sans serif fontsGuillaume Gomez-2/+39
2025-01-27rustdoc: add nobuild typescript checking to our JSMichael Howell-680/+1655
By nobuild, I mean that the type annotations are all in comments, not in the "native" typescript syntax. This is a bit uglier, but it lets you rapid-prototype without tsc, works with all the native browser debugging tools, and keeps Node out of Rust's bootstrap chain. This pull request mostly just adds ts-ignore annotations and type declarations. To actually take good advantage of typescript, we'll want to "burn down" this pile of unsafe code until we eventually have a version with almost none of these. This PR also adds tsc to the mingw-check Dockerfile, so that it can't fall out of date like the Closure annotations did. https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/typescript
2025-01-25Remove extra whitespace from rustdoc breadcrumbs for copypastingKornel-6/+3
2025-01-24Fix indent of trait items on mobileGuillaume Gomez-3/+7
2025-01-19Remove unused `item-row` CSS classGuillaume Gomez-1/+1
2025-01-18Remove more CSS classesGuillaume Gomez-11/+11
2025-01-17Handle reexports items list a bit differently since they cannot have ↵Guillaume Gomez-1/+1
documentation
2025-01-17Replace ul/li list with dl/dd/dt elementsGuillaume Gomez-14/+18
2025-01-16Treat other items as functions for the purpose of type-based searchbinarycat-0/+16
constants and statics are nullary functions, and struct fields are unary functions. functions (along with methods and trait methods) are prioritized over other items, like fields and constants.
2025-01-14Rollup merge of #135499 - lolbinarycat:rustdoc-link-underline-133484, ↵Jubilee-0/+2
r=GuillaumeGomez fix underlining of hovered intra-doc links. fixes https://github.com/rust-lang/rust/issues/133484 i'm not sure how to create a test case for this, or if that is even possible.
2025-01-14fix underlining of hovered intra-doc links.binarycat-0/+2
fixes https://github.com/rust-lang/rust/issues/133484
2025-01-13for purely return-type based searches, deprioritize clone-like functionsbinarycat-0/+46
A clone-like function in a function that takes as an argument the type that it returns. However, functions that return a type variable are not counted as clone-line. Because we're not unifying the whole function at once, a function like `U -> T` would otherwise be counted as "clone-like" because the generics will just unify with anything when done seperatly. Co-authored-by: Michael Howell <michael@notriddle.com>
2024-12-31Fix typosericlehong-2/+2
Signed-off-by: ericlehong <193237094+ericlehong@users.noreply.github.com>
2024-12-13rustdoc-search: show `impl Trait` inline when unhighlightedMichael Howell-1/+6
While normal generics can be skipped in this case, no-names need something to show here. Before: `TyCtxt, , Symbol -> bool` After: `TyCtxt, Into<DefId>, Symbol -> bool`
2024-12-05Improve positioning of "..." in collapsed impl blockGuillaume Gomez-3/+8
2024-12-05Use text ellipsis instead of bottom blurringGuillaume Gomez-11/+16
2024-12-05Always display first line of impl blocks even when collapsedGuillaume Gomez-0/+23
2024-11-29Rollup merge of #131718 - GuillaumeGomez:impl-items-indent, r=rustdocMatthias Krüger-15/+35
[rustdoc] Change impl items indent Fixes https://github.com/rust-lang/rust/issues/131704. | before | after | |-|-| | ![image](https://github.com/user-attachments/assets/67679827-6aef-4bdb-93dd-e1a4784566b3) | ![image](https://github.com/user-attachments/assets/8a0e9fbc-794a-4b98-abc6-bbbe178736b1) | Can be tested [here](https://rustdoc.crud.net/imperio/impl-items-indent/bar/struct.Bar.html). r? `@notriddle`
2024-11-18rustdoc-search: add descriptive comments to bitmap classMichael Howell-0/+23
2024-11-18rustdoc-search: use smart binary search in bitmapsMichael Howell-10/+32
Addresses a comment from [jsha's benchmarking], where the `contains` function showed up in the profiler. This commit pulls it from about 5% of the runtime to about 0.5%. [jsha's benchmarking]: https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/search.20profiling/near/481868761
2024-11-15rustdoc search: allow queries to end in an empty path segmentbinarycat-5/+15
fixes https://github.com/rust-lang/rust/issues/129707 this can be used to show all items in a module, or all associated items for a type. currently sufferes slightly due to case insensitivity, so `Option::` will also show items in the `option::` module. it disables the checking of the last path element, otherwise only items with short names will be shown
2024-11-14Auto merge of #133047 - matthiaskrgr:rollup-9se1vth, r=matthiaskrgrbors-4/+7
Rollup of 4 pull requests Successful merges: - #128197 (Skip locking span interner for some syntax context checks) - #133040 ([rustdoc] Fix handling of footnote reference in footnote definition) - #133043 (rustdoc-search: case-sensitive only when capitals are used) - #133046 (Clippy subtree update) r? `@ghost` `@rustbot` modify labels: rollup
2024-11-14rustdoc-search: case-sensitive only when capitals are usedMichael Howell-4/+7
This is the "smartcase" behavior, described by vim and dtolnay.
2024-11-13Add descriptive comment for NameTrieMichael Howell-0/+19
2024-11-13Remove console.logMichael Howell-3/+0
2024-11-13rustdoc: use a trie for name-based searchMichael Howell-104/+695
Preview and profiler results ---------------------------- Here's some quick profiling in Firefox done on the rust compiler docs: - Before: https://share.firefox.dev/3UPm3M8 - After: https://share.firefox.dev/40LXvYb Here's the results for the node.js profiler: - https://notriddle.com/rustdoc-html-demo-15/trie-perf/index.html Here's a copy that you can use to try it out. Compare it with [the nightly]. Try typing `typecheckercontext` one character at a time, slowly. - https://notriddle.com/rustdoc-html-demo-15/compiler-doc-trie/index.html [the nightly]: https://doc.rust-lang.org/nightly/nightly-rustc/ The fuzzy match algo is based on [Fast String Correction with Levenshtein-Automata] and the corresponding implementation code in [moman] and [Lucene]; the bit-packing representation comes from Lucene, but the actual matcher is more based on `fsc.py`. As suggested in the paper, a trie is used to represent the FSA dictionary. The same trie is used for prefix matching. Substring matching is done with a side table of three-character[^1] windows that point into the trie. [Fast String Correction with Levenshtein-Automata]: https://github.com/tpn/pdfs/blob/master/Fast%20String%20Correction%20with%20Levenshtein-Automata%20(2002)%20(10.1.1.16.652).pdf [Lucene]: https://fossies.org/linux/lucene/lucene/core/src/java/org/apache/lucene/util/automaton/Lev1TParametricDescription.java [moman]: https://gitlab.com/notriddle/moman-rustdoc User-visible changes -------------------- I don't expect anybody to notice anything, but it does cause two changes: - Substring matches, in the middle of a name, only apply if there's three or more characters in the search query. - Levenshtein distance limit now maxes out at two. In the old version, the limit was w/3, so you could get looser matches for queries with 9 or more characters[^1] in them. [^1]: technically utf-16 code units
2024-11-13Align impl doc block with `impl` keywordGuillaume Gomez-1/+1
2024-11-12Increase impl items indent and decrease documentation indent for impl blockGuillaume Gomez-15/+35
2024-10-31Adjust ranking so that duplicates count against rankMichael Howell-14/+11
2024-10-30rustdoc-search: simplify rules for generics and type paramsMichael Howell-79/+273
This commit is a response to feedback on the displayed type signatures results, by making generics act stricter. Generics are tightened by making order significant. This means `Vec<Allocator>` now matches only with a true vector of allocators, instead of matching the second type param. It also makes unboxing within generics stricter, so `Result<A, B>` only matches if `B` is in the error type and `A` is in the success type. The top level of the function search is unaffected. Find the discussion on: * <https://rust-lang.zulipchat.com/#narrow/stream/393423-t-rustdoc.2Fmeetings/topic/meeting.202024-07-08/near/449965149> * <https://github.com/rust-lang/rust/pull/124544#issuecomment-2204272265> * <https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/deciding.20on.20semantics.20of.20generics.20in.20rustdoc.20search/near/476841363>
2024-10-30rustdoc-search: show types signatures in resultsMichael Howell-85/+627
2024-10-30rustdoc-search: use correct type annotationsMichael Howell-2/+2
2024-10-30rustdoc-search: pass original names through ASTMichael Howell-20/+26
2024-10-30rustdoc-search: simplify the checkTypes fast pathMichael Howell-26/+11
This reduces code size while still matching the common case for plain, concrete types.
2024-10-28Unify variant struct fields margins with struct fieldsGuillaume Gomez-1/+1
2024-10-26Rollup merge of #132183 - GuillaumeGomez:code-in-docblock, r=notriddleJubilee-1/+1
Fix code HTML items making big blocks if too long Encountered this bug randomly where `code` item in docblocks would look like this: ![Screenshot from 2024-10-26 15-44-46](https://github.com/user-attachments/assets/a9c1df9d-5007-49eb-a7dd-a2c381b2511e) With this fix it looks like this: ![image](https://github.com/user-attachments/assets/ea918595-5434-4781-b68c-6abd38689365) r? ``@notriddle``
2024-10-26Fix code HTML items making big blocks if too longGuillaume Gomez-1/+1
2024-10-24Rollup merge of #131906 - notriddle:notriddle/spacing, r=GuillaumeGomezMatthias Krüger-2/+8
rustdoc: adjust spacing and typography in header Fixes #131589 Preview: https://notriddle.com/rustdoc-html-demo-12/spacing/std/index.html | Before | After | |--|--| | ![image](https://github.com/user-attachments/assets/b5c5132d-1e5e-402e-ba19-1dea9e70ea6f) | ![image](https://github.com/user-attachments/assets/72570b93-bb16-4553-9da7-fc4f29b98873) | ![image](https://github.com/user-attachments/assets/264983f0-5aec-4120-8a03-f62e52d4360d) | ![image](https://github.com/user-attachments/assets/b6925945-95e6-4858-8e91-4cfd90c164f0) | ![image](https://github.com/user-attachments/assets/df96bfe7-195d-4aaf-97f1-a45ade34cab2) | ![image](https://github.com/user-attachments/assets/c6fe2d57-bd8a-42aa-b3cf-4f635809b9b4) | ![image](https://github.com/user-attachments/assets/7519faa5-d6b2-41ba-9d95-6000d1dd89d1) | ![image](https://github.com/user-attachments/assets/7233c2d6-82d9-4820-bb63-dc4776a34601) First of all, we put 4px additional margin below the search box, and 4px margin below the header to balance it out. The bigger problem we have to solve is making the lines look logically spaced. This is troublesome, because Fira Sans (the typeface we use here) wants to look good on average, and to avoid breaking, with text that uses [ascenders and descenders](https://www.w3.org/TR/css-inline-3/images/text-edge.png). If the text we're putting in happens to not have any, things look weird (strictly speaking, there’s hand-tuning here, because the Copy Path button messes with stuff, but the overall point is that there is no true, one perfect layout). In order to play nicely with the font, I've tweaked the text to use that space. The word "Source" for the link is now capitalized, and the Since version number now uses oldstyle nums with descenders.
2024-10-23rustdoc: adjust spacing and typography in headerMichael Howell-2/+8
2024-10-19rustdoc: Switch from FxHash to sha256 for static file hashing.Alona Enraght-Moony-9/+9
2024-10-11Rollup merge of #131394 - ↵Matthias Krüger-0/+3
ismailarilik:fix/rustdoc/add-space-between-struct-fields-and-their-descriptions, r=GuillaumeGomez fix(rustdoc): add space between struct fields and their descriptions Stolen from #128541. Fixes #128260. <table> <thead> <tr> <th scope="col">Before</th> <th scope="col">After</th> </tr> </thead> <tbody> <tr> <td scope="row"> <img src="https://github.com/user-attachments/assets/b1d3cb47-77c9-4897-a5d2-2192b11cb8a3" /> </td> <td> <img src="https://github.com/user-attachments/assets/0b104672-d2be-49f4-ac9b-3506526fe2f1" /> </td> </tr> </tbody> </table> <table> <thead> <tr> <th scope="col">Before</th> <th scope="col">After</th> </tr> </thead> <tbody> <tr> <td scope="row"> <img src="https://github.com/user-attachments/assets/650c3e74-a067-492a-9ba3-557f9214f875" /> </td> <td> <img src="https://github.com/user-attachments/assets/413ef9b0-8fca-4e16-978a-7b88d05299dc" /> </td> </tr> </tbody> </table> Unlike original PR, I didn't add space between field headers; I put it between headers and descriptions. So if there are only headers, the space is not changed. Otherwise, I put a space like the space between paragraphs (.75em) which makes sense for me but feel free to adjust it or ask me to do so. r? `@GuillaumeGomez`
2024-10-09Fix methods alignment on mobileGuillaume Gomez-1/+1
2024-10-08fix(rustdoc): add space between struct fields and their descriptionsismailarilik-0/+3
2024-10-04Fix list marginsGuillaume Gomez-3/+6
2024-10-01Rollup merge of #130933 - lolbinarycat:rustdoc-li-p, r=GuillaumeGomez,notriddleMatthias Krüger-0/+7
rustdoc: lists items that contain multiple paragraphs are more clear fixes https://github.com/rust-lang/rust/issues/130622 before: ![before](https://github.com/user-attachments/assets/fe54d8ee-8a1a-45fc-9434-2737c5c6f4d5) after: ![after](https://github.com/user-attachments/assets/095be365-1bfc-4001-8664-59bc4125bb05)
2024-09-30Rollup merge of #131023 - clubby789:doc-item-path, r=notriddleMatthias Krüger-5/+9
Copy correct path to clipboard for modules/keywords/primitives Fixes #131021
2024-09-29Copy correct path to clipboard for modules/keywords/primitivesclubby789-5/+9