| Age | Commit message (Collapse) | Author | Lines |
|
[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```
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
documentation
|
|
|
|
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.
|
|
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.
|
|
fixes https://github.com/rust-lang/rust/issues/133484
|
|
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>
|
|
Signed-off-by: ericlehong <193237094+ericlehong@users.noreply.github.com>
|
|
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`
|
|
|
|
|
|
|
|
[rustdoc] Change impl items indent
Fixes https://github.com/rust-lang/rust/issues/131704.
| before | after |
|-|-|
|  |  |
Can be tested [here](https://rustdoc.crud.net/imperio/impl-items-indent/bar/struct.Bar.html).
r? `@notriddle`
|
|
|
|
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
|
|
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
|
|
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
|
|
This is the "smartcase" behavior, described by vim and dtolnay.
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
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>
|
|
|
|
|
|
|
|
This reduces code size while still matching the common case
for plain, concrete types.
|
|
|
|
Fix code HTML items making big blocks if too long
Encountered this bug randomly where `code` item in docblocks would look like this:

With this fix it looks like this:

r? ``@notriddle``
|
|
|
|
rustdoc: adjust spacing and typography in header
Fixes #131589
Preview: https://notriddle.com/rustdoc-html-demo-12/spacing/std/index.html
| Before | After |
|--|--|
|  | 
|  | 
|  | 
|  | 
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.
|
|
|
|
|
|
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`
|
|
|
|
|
|
|
|
rustdoc: lists items that contain multiple paragraphs are more clear
fixes https://github.com/rust-lang/rust/issues/130622
before: 
after:

|
|
Copy correct path to clipboard for modules/keywords/primitives
Fixes #131021
|
|
|