| Age | Commit message (Collapse) | Author | Lines |
|
Fix rust logo style
The style on the rust logo is currently broken:

With this fix, we're back to normal:

I also used a GUI test to prevent future silent regressions.
r? ```@jsha```
|
|
|
|
Make source links look cleaner
Change from syntaxy-looking [src] to the plain word "source".
Change the syntaxy-looking `[-]` at the top of the page to say "collapse".
Reduce opacity of rightside content.
Part of #59851
r? `@GuillaumeGomez`
Demo: https://rustdoc.crud.net/jsha/source-link-2/std/string/struct.String.html
[Discussed on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/display.20of.20source.20link).
|
|
Move crate drop-down to search results page
This reduces clutter on doc pages.
Part of #59840
r? ```@GuillaumeGomez```
Demo: https://rustdoc.crud.net/jsha/crates-in-results/std/index.html?search=str
|
|
Change from syntaxy-looking [src] to the plain word "source".
|
|
r=jsha
Create CSS class instead of using inline style for search results
I saw this change in the update you proposed in https://github.com/rust-lang/rust/pull/92404. :)
r? ``@jsha``
|
|
|
|
Fix font size for [src] links in headers
Fixes #90384.
cc `@jsha`
r? `@camelid`
|
|
Make Run button visible on hover
This slightly reduces the noisiness of doc pages, making them easier to read.
Demo: https://rustdoc.crud.net/jsha/run-on-hover/std/string/struct.String.html
[Discussed on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/.22Run.22.20button.20visible.20on.20hover).
Part of #59845
|
|
|
|
This reduces clutter on doc pages.
|
|
|
|
This slightly reduces the noisiness of doc pages, making them easier to
read.
|
|
According to MDN
(https://developer.mozilla.org/en-US/docs/Web/CSS/font-size),
> To maximize accessibility, it is generally best to use values that
> are relative to the user's default font size.
> Defining font sizes in px is not accessible, because the user cannot
> change the font size in some browsers.
Note that changing font size (in browser or OS settings) is distinct
from the zoom functionality triggered with Ctrl/Cmd-+. Zoom
functionality increases the size of everything on the page, effectively
applying a multiplier to all pixel sizes. Font size changes apply to
just text.
For relative font sizes, we could use `em`, as we do in several places
already. However that has a problem of "compounding" (see MDN article
for details). The compounding problem is nicely solved by `rem`, which
make font sizes relative to the root element, not the parent element.
Since we were using a hodge-podge of pixel sizes, em, rem, and
percentage sizes before, this change switching everything to rem, while
keeping the same size relative to our old default of 16px.
16px is still the default on most browsers, for users that haven't set a
larger or smaller font size.
|
|
Fix mobile toggles position
Before:

After:

r? `@jsha`
|
|
rustdoc: use smaller number of colors to distinguish items
This reduces visual distractions when reading method signatures.
As discussed in https://github.com/rust-lang/rust/issues/59845#issuecomment-974757191, this categorizes items into one of six colors (down from thirteen):
- method, function (ochre `#AD7C37`)
- trait, trait alias (dark slate blue `#6E4FC9`)
- enum, struct, type alias, union, primitive (maroon `#AD378A`)
- static, module, keyword, associated type, foreign type (steel blue `#3873AD`)
- macro (green `#068000`)
- generic params, self, Self (unmarked black `#000000`)
I slightly tweaked the actual color values so they'd have the same lightness (previously the trait color stood out much more than the others). And I made the color for links in general consistently use steel blue (previously there was a slightly different color for "search-failed").
The ayu and dark themes have been updated according to the same logic. I haven't changed any of the color values in those themes, just their assignment to types.
Demo:
https://rustdoc.crud.net/jsha/fewer-colors/std/string/struct.String.html
https://rustdoc.crud.net/jsha/fewer-colors/std/vec/struct.Vec.html
https://rustdoc.crud.net/jsha/fewer-colors/std/io/trait.Read.html
https://rustdoc.crud.net/jsha/fewer-colors/std/iter/trait.Iterator.html
|
|
|
|
Fix source code page sidebar on mobile
Current broken behaviour:
https://user-images.githubusercontent.com/3050060/145984316-35c82353-5bab-4dc6-9ac6-63ea7e5c27d8.mp4
Fixed:
https://user-images.githubusercontent.com/3050060/145984329-8be1127b-d707-424d-ac3c-c1fb3c48a093.mp4
r? `@jsha`
|
|
|
|
Add `-webkit-appearance: none` to search input
This fixes an issue when displaying on iPad, where the search box had no borders.
r? ``@GuillaumeGomez``
Demo https://rustdoc.crud.net/jsha/webkit-appearance-search-input/std/string/struct.String.html
|
|
This fixes an issue when displaying on iPad, where the search box had no
borders.
|
|
|
|
Make rustdoc headings black, and markdown blue
Demo:
https://rustdoc.crud.net/jsha/heading-color/std/string/index.html#structs
https://rustdoc.crud.net/jsha/heading-color/std/string/struct.String.html#examples
Fixes #91304
r? ```@camelid``` /cc ```@GuillaumeGomez```
(Note: we may want to make rustdoc headings and markdown headings the same color -- #90245 -- but we would want to do that intentionally; this is fixing up a change that did so accidentally)
|
|
|
|
|
|
This reduces visual distractions when reading method signatures.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rustdoc: Consolidate static-file replacement mechanism
There were a few places in rustdoc where we would take static JS or CSS and rewrite it at doc generation time to insert values. This consolidates all the CSS instances into one CSS file and replaces the JS examples with data- attributes on the rustdoc-vars div.
Demo https://rustdoc.crud.net/jsha/static-file-replace/test_docs/
r? ``@GuillaumeGomez``
|
|
heading of the top doc block
|
|
|
|
|
|
Fix more <a> color
Fixes #91175.
Another bug I saw is:

I fixed it as well.
r? ``@jsha``
|
|
Reduce prominence of item-infos
Fixes #59853
- Remove border.
- Reduce size of emoji slightly.
- Remove details disclosure for unstable reason. This was inconsistent with our other details disclosures, and the detail revealed was usually better explained by clicking on the issue link.
Demo: https://rustdoc.crud.net/jsha/chill-item-info/std/mem/union.MaybeUninit.html#method.slice_assume_init_ref
Compare vs: https://doc.rust-lang.org/nightly/std/mem/union.MaybeUninit.html#method.slice_assume_init_ref
<img src="https://user-images.githubusercontent.com/220205/142717815-09828c9e-6ff4-445a-8ccc-31e028fd4985.png" width=700>
|
|
|
|
Set color for <a> in a more straightforward way.
Previously, we set the default color for <a> tags to black, and then had an override with a bunch of not() clauses to set anchors in
docblocks to blue.
Instead, we should set the default color for <a> to blue (or equivalent in other themes), and override it for places like the sidebar or search results, where we don't want them to be styled as links.
Demo at https://rustdoc.crud.net/jsha/theme-anchor/std/string/struct.String.html. This should result in no visible changes.
r? `@GuillaumeGomez`
|
|
Remove styles for details.undocumented
The Rust code that generated tags with that class was deleted in
10bafe1975e53769180701508e2b8cd3a3b34a0e.
r? `@GuillaumeGomez`
|
|
Previously, we set the default color for <a> tags to black, and then
had an override with a bunch of not() clauses to set anchors in
docblocks to blue.
Instead, we should set the default color for <a> to blue (or equivalent
in other themes), and override it for places like the sidebar or search
results, where we don't want them to be styled as links.
|
|
The Rust code that generated tags with that class was deleted in
10bafe1975e53769180701508e2b8cd3a3b34a0e.
|
|
Make scrollbar in the sidebar always visible for visual consistency
Fixes #90943.
I had to add a background in `dark` and `ayu` themes, otherwise it was looking strange (like an invisible margin). So it looks like this:


Sadly, I wasn't able to add a GUI test to ensure that the scrollbar was always displayed because it seems not possible in puppeteer for whatever reason... I used this method: on small pages (like `lib2/sub_mod/index.html`), comparing `.navbar`'s `clientWidth` with `offsetWidth` (the first doesn't include the sidebar in the computed amount). When checking in the browser, it works fine but in puppeteer it almost never works...
In case anyone want to try to solve the bug, here is the puppeteer code:
<details>
More information about this: I tried another approach which was to get the element in `evaluate` directly (by calling it from `page.evaluate(() => { .. });` directly instead of `parseAssertElemProp.evaluate(e => {...});`.
```js
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto("file:///path/rust/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/doc/lib2/sub_mod/index.html");
await page.waitFor(".sidebar");
let parseAssertElemProp = await page.$(".sidebar");
if (parseAssertElemProp === null) { throw '".sidebar" not found'; }
await parseAssertElemProp.evaluate(e => {
const parseAssertElemPropDict = {"clientWidth": "192", "offsetWidth":"200"};
for (const [parseAssertElemPropKey, parseAssertElemPropValue] of Object.entries(parseAssertElemPropDict)) {
if (e[parseAssertElemPropKey] === undefined || String(e[parseAssertElemPropKey]) != parseAssertElemPropValue) {
throw 'expected `' + parseAssertElemPropValue + '` for property `' + parseAssertElemPropKey + '` for selector `.sidebar`, found `' + e[parseAssertElemPropKey] + '`';
}
}
}).catch(e => console.error(e));
await browser.close();
})();
```
</details>
r? ``@jsha``
|