2022-01-21 13:41:47 -06:00
|
|
|
// Checks multiple things on the sidebar display (width of its elements, colors, etc).
|
2024-04-05 14:38:55 -05:00
|
|
|
include: "utils.goml"
|
2023-04-11 12:11:34 -05:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
|
2022-09-22 12:42:15 -05:00
|
|
|
assert-property: (".sidebar", {"clientWidth": "200"})
|
Simplify and unify rustdoc sidebar styles
This switches to just use size, weight, and spacing to distinguish
headings in the sidebar. We no longer use boxes, horizontal bars, or
centering to distinguish headings. This makes it much easier to
understand the hierarchy of headings, and reduces visual noise.
I also refactored how the mobile topbar works. Previously, we tried to
shift around elements from the sidebar to make the topbar. Now, the
topbar gets its own elements, which can be styled on their own. This
makes styling and reasoning about those elements simpler.
Because the heading font sizes are bigger, increase the sidebar width
slightly.
As a very minor change, removed version from the "All types" page. It's
now only on the crate page.
2022-01-06 18:48:24 -06:00
|
|
|
show-text: true
|
2022-12-27 14:59:00 -06:00
|
|
|
|
|
|
|
// First, check the sidebar colors.
|
|
|
|
define-function: (
|
|
|
|
"check-colors",
|
2024-04-01 14:11:22 -05:00
|
|
|
[theme, color, background_color],
|
2023-01-06 08:18:51 -06:00
|
|
|
block {
|
2024-04-05 14:38:55 -05:00
|
|
|
call-function: ("switch-theme", {"theme": |theme|})
|
2022-12-27 14:59:00 -06:00
|
|
|
// Checking results colors.
|
2023-01-06 08:18:51 -06:00
|
|
|
assert-css: (".sidebar", {
|
|
|
|
"color": |color|,
|
|
|
|
"background-color": |background_color|
|
|
|
|
}, ALL)
|
|
|
|
},
|
2022-12-27 14:59:00 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
call-function: (
|
2023-01-06 08:18:51 -06:00
|
|
|
"check-colors",
|
|
|
|
{
|
|
|
|
"theme": "ayu",
|
2023-09-02 14:00:23 -05:00
|
|
|
"color": "#c5c5c5",
|
|
|
|
"background_color": "#14191f",
|
2023-01-06 08:18:51 -06:00
|
|
|
}
|
2022-12-27 14:59:00 -06:00
|
|
|
)
|
|
|
|
call-function: (
|
2023-01-06 08:18:51 -06:00
|
|
|
"check-colors",
|
|
|
|
{
|
|
|
|
"theme": "dark",
|
2023-09-02 14:00:23 -05:00
|
|
|
"color": "#ddd",
|
|
|
|
"background_color": "#505050",
|
2023-01-06 08:18:51 -06:00
|
|
|
}
|
2022-12-27 14:59:00 -06:00
|
|
|
)
|
|
|
|
call-function: (
|
2023-01-06 08:18:51 -06:00
|
|
|
"check-colors",
|
|
|
|
{
|
|
|
|
"theme": "light",
|
2023-09-02 14:00:23 -05:00
|
|
|
"color": "black",
|
|
|
|
"background_color": "#f5f5f5",
|
2023-01-06 08:18:51 -06:00
|
|
|
}
|
2022-12-27 14:59:00 -06:00
|
|
|
)
|
|
|
|
|
2024-04-05 14:38:55 -05:00
|
|
|
call-function: ("switch-theme", {"theme": "light"})
|
Simplify and unify rustdoc sidebar styles
This switches to just use size, weight, and spacing to distinguish
headings in the sidebar. We no longer use boxes, horizontal bars, or
centering to distinguish headings. This makes it much easier to
understand the hierarchy of headings, and reduces visual noise.
I also refactored how the mobile topbar works. Previously, we tried to
shift around elements from the sidebar to make the topbar. Now, the
topbar gets its own elements, which can be styled on their own. This
makes styling and reasoning about those elements simpler.
Because the heading font sizes are bigger, increase the sidebar width
slightly.
As a very minor change, removed version from the "All types" page. It's
now only on the crate page.
2022-01-06 18:48:24 -06:00
|
|
|
|
rustdoc: show crate name beside small logo
This commit changes the layout to something a bit less "look at my logo!!!111"
gigantic, and makes it clearer where clicking the logo will actually take you.
It also means the crate name is persistently at the top of the sidebar, even
when in a sub-item page, and clicking that name takes you back to the root.
| | Short crate name | Long crate name |
|---------|------------------|-----------------|
| Root | ![short-root] | ![long-root]
| Subpage | ![short-subpage] | ![long-subpage]
[short-root]: https://github.com/rust-lang/rust/assets/1593513/fe2ce102-d4b8-44e6-9f7b-68636a907f56
[short-subpage]: https://github.com/rust-lang/rust/assets/1593513/29501663-56c0-4151-b7de-d2637e167125
[long-root]: https://github.com/rust-lang/rust/assets/1593513/f6a385c0-b4c5-4a9c-954b-21b38de4192f
[long-subpage]: https://github.com/rust-lang/rust/assets/1593513/97ec47b4-61bf-4ebe-b461-0d2187b8c6ca
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/image/index.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/index.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/adler/struct.Adler32.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/struct.Sender.html
This improves visual information density (the construct with the logo and
crate name is *shorter* than the logo on its own, because it's not
square) and navigation clarity (we can now see what clicking the Rust logo
does, specifically).
Compare this with the layout at [Phoenix's Hexdocs] (which is what this
proposal is closely based on), the old proposal on [Internals Discourse]
(which always says "Rust standard library" in the sidebar, but doesn't do the
side-by-side layout).
[Phoenix's Hexdocs]: https://hexdocs.pm/phoenix/1.7.7/overview.html
[Internals Discourse]: https://internals.rust-lang.org/t/poc-of-a-new-design-for-the-generated-rustdoc/11018
In newer versions of rustdoc, the crate name and version are always shown in
the sidebar, even in subpages. Clicking the crate name does the same thing
clicking the logo always did: return you to the crate root.
While this actually takes up less screen real estate than the old layout on
desktop, it takes up more HTML. It's also a bit more visually complex.
I could do what the Internals POC did and keep the vertically stacked layout
all the time, instead of doing a horizontal stack where possible. It would
take up more screen real estate, though.
This design is lifted almost verbatim from Hexdocs. It seems to work for them.
[`opentelemetry_process_propagator`], for example, has a long application name.
[`opentelemetry_process_propagator`]: https://hexdocs.pm/opentelemetry_process_propagator/OpentelemetryProcessPropagator.html
Has anyone written the rationale on why the Rust logo shows up on projects that
aren't the standard library? If we turned it off on non-standard crates by
default, it would line wrap crate names a lot less often.
Or maybe we should encourage crate authors to include their own logo more
often? It certainly helps give people a better sense of "place."
I'm not sure of anything that directly follows up this one. Plenty of other
changes could be made to improve the layout, like
* coming up with a less cluttered way to do disclosure (there's a lot of `[-]`
on the page)
* doing a better job of separating lateral navigation (vec::Vec links to
vec::IntoIter) and the table of contents (vec::Vec links to vec::Vec::new)
* giving readers more control of how much rustdoc hows them, and giving doc
authors more control of how much it generates
* better search that reduces the need to browse
But those are mostly orthogonal, not future possibilities unlocked by this change.
2023-09-18 13:59:49 -05:00
|
|
|
assert-text: (".sidebar > .sidebar-crate > h2 > a", "test_docs")
|
|
|
|
// Crate root has no "location" element
|
|
|
|
assert-count: (".sidebar .location", 0)
|
2022-10-18 13:14:01 -05:00
|
|
|
assert-count: (".sidebar h2", 1)
|
Simplify and unify rustdoc sidebar styles
This switches to just use size, weight, and spacing to distinguish
headings in the sidebar. We no longer use boxes, horizontal bars, or
centering to distinguish headings. This makes it much easier to
understand the hierarchy of headings, and reduces visual noise.
I also refactored how the mobile topbar works. Previously, we tried to
shift around elements from the sidebar to make the topbar. Now, the
topbar gets its own elements, which can be styled on their own. This
makes styling and reasoning about those elements simpler.
Because the heading font sizes are bigger, increase the sidebar width
slightly.
As a very minor change, removed version from the "All types" page. It's
now only on the crate page.
2022-01-06 18:48:24 -06:00
|
|
|
assert-text: ("#all-types", "All Items")
|
2023-09-02 14:00:23 -05:00
|
|
|
assert-css: ("#all-types", {"color": "#356da4"})
|
2021-05-02 11:59:31 -05:00
|
|
|
// We check that we have the crates list and that the "current" on is "test_docs".
|
2023-09-07 20:45:24 -05:00
|
|
|
assert-text: (".sidebar-elems ul.crate > li.current > a", "test_docs")
|
2021-05-02 11:59:31 -05:00
|
|
|
// And we're also supposed to have the list of items in the current module.
|
2022-05-05 14:56:40 -05:00
|
|
|
assert-text: (".sidebar-elems section ul > li:nth-child(1)", "Re-exports")
|
|
|
|
assert-text: (".sidebar-elems section ul > li:nth-child(2)", "Modules")
|
|
|
|
assert-text: (".sidebar-elems section ul > li:nth-child(3)", "Macros")
|
|
|
|
assert-text: (".sidebar-elems section ul > li:nth-child(4)", "Structs")
|
|
|
|
assert-text: (".sidebar-elems section ul > li:nth-child(5)", "Enums")
|
2022-10-19 10:15:11 -05:00
|
|
|
assert-text: (".sidebar-elems section ul > li:nth-child(6)", "Constants")
|
|
|
|
assert-text: (".sidebar-elems section ul > li:nth-child(7)", "Traits")
|
|
|
|
assert-text: (".sidebar-elems section ul > li:nth-child(8)", "Functions")
|
2023-08-21 18:20:00 -05:00
|
|
|
assert-text: (".sidebar-elems section ul > li:nth-child(9)", "Type Aliases")
|
2022-10-19 10:15:11 -05:00
|
|
|
assert-text: (".sidebar-elems section ul > li:nth-child(10)", "Unions")
|
|
|
|
assert-text: (".sidebar-elems section ul > li:nth-child(11)", "Keywords")
|
2023-02-07 20:00:18 -06:00
|
|
|
assert-text: ("#structs + .item-table .item-name > a", "Foo")
|
|
|
|
click: "#structs + .item-table .item-name > a"
|
2021-05-02 11:59:31 -05:00
|
|
|
|
|
|
|
// PAGE: struct.Foo.html
|
rustdoc: show crate name beside small logo
This commit changes the layout to something a bit less "look at my logo!!!111"
gigantic, and makes it clearer where clicking the logo will actually take you.
It also means the crate name is persistently at the top of the sidebar, even
when in a sub-item page, and clicking that name takes you back to the root.
| | Short crate name | Long crate name |
|---------|------------------|-----------------|
| Root | ![short-root] | ![long-root]
| Subpage | ![short-subpage] | ![long-subpage]
[short-root]: https://github.com/rust-lang/rust/assets/1593513/fe2ce102-d4b8-44e6-9f7b-68636a907f56
[short-subpage]: https://github.com/rust-lang/rust/assets/1593513/29501663-56c0-4151-b7de-d2637e167125
[long-root]: https://github.com/rust-lang/rust/assets/1593513/f6a385c0-b4c5-4a9c-954b-21b38de4192f
[long-subpage]: https://github.com/rust-lang/rust/assets/1593513/97ec47b4-61bf-4ebe-b461-0d2187b8c6ca
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/image/index.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/index.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/adler/struct.Adler32.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/struct.Sender.html
This improves visual information density (the construct with the logo and
crate name is *shorter* than the logo on its own, because it's not
square) and navigation clarity (we can now see what clicking the Rust logo
does, specifically).
Compare this with the layout at [Phoenix's Hexdocs] (which is what this
proposal is closely based on), the old proposal on [Internals Discourse]
(which always says "Rust standard library" in the sidebar, but doesn't do the
side-by-side layout).
[Phoenix's Hexdocs]: https://hexdocs.pm/phoenix/1.7.7/overview.html
[Internals Discourse]: https://internals.rust-lang.org/t/poc-of-a-new-design-for-the-generated-rustdoc/11018
In newer versions of rustdoc, the crate name and version are always shown in
the sidebar, even in subpages. Clicking the crate name does the same thing
clicking the logo always did: return you to the crate root.
While this actually takes up less screen real estate than the old layout on
desktop, it takes up more HTML. It's also a bit more visually complex.
I could do what the Internals POC did and keep the vertically stacked layout
all the time, instead of doing a horizontal stack where possible. It would
take up more screen real estate, though.
This design is lifted almost verbatim from Hexdocs. It seems to work for them.
[`opentelemetry_process_propagator`], for example, has a long application name.
[`opentelemetry_process_propagator`]: https://hexdocs.pm/opentelemetry_process_propagator/OpentelemetryProcessPropagator.html
Has anyone written the rationale on why the Rust logo shows up on projects that
aren't the standard library? If we turned it off on non-standard crates by
default, it would line wrap crate names a lot less often.
Or maybe we should encourage crate authors to include their own logo more
often? It certainly helps give people a better sense of "place."
I'm not sure of anything that directly follows up this one. Plenty of other
changes could be made to improve the layout, like
* coming up with a less cluttered way to do disclosure (there's a lot of `[-]`
on the page)
* doing a better job of separating lateral navigation (vec::Vec links to
vec::IntoIter) and the table of contents (vec::Vec links to vec::Vec::new)
* giving readers more control of how much rustdoc hows them, and giving doc
authors more control of how much it generates
* better search that reduces the need to browse
But those are mostly orthogonal, not future possibilities unlocked by this change.
2023-09-18 13:59:49 -05:00
|
|
|
assert-count: (".sidebar .sidebar-crate", 1)
|
2022-10-18 13:14:01 -05:00
|
|
|
assert-count: (".sidebar .location", 1)
|
rustdoc: show crate name beside small logo
This commit changes the layout to something a bit less "look at my logo!!!111"
gigantic, and makes it clearer where clicking the logo will actually take you.
It also means the crate name is persistently at the top of the sidebar, even
when in a sub-item page, and clicking that name takes you back to the root.
| | Short crate name | Long crate name |
|---------|------------------|-----------------|
| Root | ![short-root] | ![long-root]
| Subpage | ![short-subpage] | ![long-subpage]
[short-root]: https://github.com/rust-lang/rust/assets/1593513/fe2ce102-d4b8-44e6-9f7b-68636a907f56
[short-subpage]: https://github.com/rust-lang/rust/assets/1593513/29501663-56c0-4151-b7de-d2637e167125
[long-root]: https://github.com/rust-lang/rust/assets/1593513/f6a385c0-b4c5-4a9c-954b-21b38de4192f
[long-subpage]: https://github.com/rust-lang/rust/assets/1593513/97ec47b4-61bf-4ebe-b461-0d2187b8c6ca
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/image/index.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/index.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/adler/struct.Adler32.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/struct.Sender.html
This improves visual information density (the construct with the logo and
crate name is *shorter* than the logo on its own, because it's not
square) and navigation clarity (we can now see what clicking the Rust logo
does, specifically).
Compare this with the layout at [Phoenix's Hexdocs] (which is what this
proposal is closely based on), the old proposal on [Internals Discourse]
(which always says "Rust standard library" in the sidebar, but doesn't do the
side-by-side layout).
[Phoenix's Hexdocs]: https://hexdocs.pm/phoenix/1.7.7/overview.html
[Internals Discourse]: https://internals.rust-lang.org/t/poc-of-a-new-design-for-the-generated-rustdoc/11018
In newer versions of rustdoc, the crate name and version are always shown in
the sidebar, even in subpages. Clicking the crate name does the same thing
clicking the logo always did: return you to the crate root.
While this actually takes up less screen real estate than the old layout on
desktop, it takes up more HTML. It's also a bit more visually complex.
I could do what the Internals POC did and keep the vertically stacked layout
all the time, instead of doing a horizontal stack where possible. It would
take up more screen real estate, though.
This design is lifted almost verbatim from Hexdocs. It seems to work for them.
[`opentelemetry_process_propagator`], for example, has a long application name.
[`opentelemetry_process_propagator`]: https://hexdocs.pm/opentelemetry_process_propagator/OpentelemetryProcessPropagator.html
Has anyone written the rationale on why the Rust logo shows up on projects that
aren't the standard library? If we turned it off on non-standard crates by
default, it would line wrap crate names a lot less often.
Or maybe we should encourage crate authors to include their own logo more
often? It certainly helps give people a better sense of "place."
I'm not sure of anything that directly follows up this one. Plenty of other
changes could be made to improve the layout, like
* coming up with a less cluttered way to do disclosure (there's a lot of `[-]`
on the page)
* doing a better job of separating lateral navigation (vec::Vec links to
vec::IntoIter) and the table of contents (vec::Vec links to vec::Vec::new)
* giving readers more control of how much rustdoc hows them, and giving doc
authors more control of how much it generates
* better search that reduces the need to browse
But those are mostly orthogonal, not future possibilities unlocked by this change.
2023-09-18 13:59:49 -05:00
|
|
|
assert-count: (".sidebar h2", 3)
|
2024-07-18 14:06:21 -05:00
|
|
|
assert-text: (".sidebar-elems ul.block > li.current > a", "Foo")
|
2021-05-31 04:51:22 -05:00
|
|
|
// We check that there is no crate listed outside of the top level.
|
|
|
|
assert-false: ".sidebar-elems > .crate"
|
2022-01-11 16:39:51 -06:00
|
|
|
|
2022-02-08 10:05:00 -06:00
|
|
|
click: ".sidebar-elems section .block li > a"
|
Simplify and unify rustdoc sidebar styles
This switches to just use size, weight, and spacing to distinguish
headings in the sidebar. We no longer use boxes, horizontal bars, or
centering to distinguish headings. This makes it much easier to
understand the hierarchy of headings, and reduces visual noise.
I also refactored how the mobile topbar works. Previously, we tried to
shift around elements from the sidebar to make the topbar. Now, the
topbar gets its own elements, which can be styled on their own. This
makes styling and reasoning about those elements simpler.
Because the heading font sizes are bigger, increase the sidebar width
slightly.
As a very minor change, removed version from the "All types" page. It's
now only on the crate page.
2022-01-06 18:48:24 -06:00
|
|
|
assert-property-false: ("html", {"scrollTop": "0"})
|
2022-01-11 16:39:51 -06:00
|
|
|
|
Simplify and unify rustdoc sidebar styles
This switches to just use size, weight, and spacing to distinguish
headings in the sidebar. We no longer use boxes, horizontal bars, or
centering to distinguish headings. This makes it much easier to
understand the hierarchy of headings, and reduces visual noise.
I also refactored how the mobile topbar works. Previously, we tried to
shift around elements from the sidebar to make the topbar. Now, the
topbar gets its own elements, which can be styled on their own. This
makes styling and reasoning about those elements simpler.
Because the heading font sizes are bigger, increase the sidebar width
slightly.
As a very minor change, removed version from the "All types" page. It's
now only on the crate page.
2022-01-06 18:48:24 -06:00
|
|
|
click: ".sidebar h2.location a"
|
2022-01-11 16:39:51 -06:00
|
|
|
assert-property: ("html", {"scrollTop": "0"})
|
|
|
|
|
2021-05-31 05:11:05 -05:00
|
|
|
// We now go back to the crate page to click on the "lib2" crate link.
|
2023-04-11 12:11:34 -05:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
|
2022-09-22 12:42:15 -05:00
|
|
|
assert-property: (".sidebar", {"clientWidth": "200"})
|
2023-09-02 14:00:23 -05:00
|
|
|
assert-css: (".sidebar-elems ul.crate > li:first-child > a", {"color": "#356da4"})
|
2022-10-10 13:37:19 -05:00
|
|
|
click: ".sidebar-elems ul.crate > li:first-child > a"
|
2021-05-02 11:59:31 -05:00
|
|
|
|
|
|
|
// PAGE: lib2/index.html
|
2023-04-11 12:11:34 -05:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/lib2/index.html"
|
2022-09-22 12:42:15 -05:00
|
|
|
assert-property: (".sidebar", {"clientWidth": "200"})
|
rustdoc: show crate name beside small logo
This commit changes the layout to something a bit less "look at my logo!!!111"
gigantic, and makes it clearer where clicking the logo will actually take you.
It also means the crate name is persistently at the top of the sidebar, even
when in a sub-item page, and clicking that name takes you back to the root.
| | Short crate name | Long crate name |
|---------|------------------|-----------------|
| Root | ![short-root] | ![long-root]
| Subpage | ![short-subpage] | ![long-subpage]
[short-root]: https://github.com/rust-lang/rust/assets/1593513/fe2ce102-d4b8-44e6-9f7b-68636a907f56
[short-subpage]: https://github.com/rust-lang/rust/assets/1593513/29501663-56c0-4151-b7de-d2637e167125
[long-root]: https://github.com/rust-lang/rust/assets/1593513/f6a385c0-b4c5-4a9c-954b-21b38de4192f
[long-subpage]: https://github.com/rust-lang/rust/assets/1593513/97ec47b4-61bf-4ebe-b461-0d2187b8c6ca
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/image/index.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/index.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/adler/struct.Adler32.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/struct.Sender.html
This improves visual information density (the construct with the logo and
crate name is *shorter* than the logo on its own, because it's not
square) and navigation clarity (we can now see what clicking the Rust logo
does, specifically).
Compare this with the layout at [Phoenix's Hexdocs] (which is what this
proposal is closely based on), the old proposal on [Internals Discourse]
(which always says "Rust standard library" in the sidebar, but doesn't do the
side-by-side layout).
[Phoenix's Hexdocs]: https://hexdocs.pm/phoenix/1.7.7/overview.html
[Internals Discourse]: https://internals.rust-lang.org/t/poc-of-a-new-design-for-the-generated-rustdoc/11018
In newer versions of rustdoc, the crate name and version are always shown in
the sidebar, even in subpages. Clicking the crate name does the same thing
clicking the logo always did: return you to the crate root.
While this actually takes up less screen real estate than the old layout on
desktop, it takes up more HTML. It's also a bit more visually complex.
I could do what the Internals POC did and keep the vertically stacked layout
all the time, instead of doing a horizontal stack where possible. It would
take up more screen real estate, though.
This design is lifted almost verbatim from Hexdocs. It seems to work for them.
[`opentelemetry_process_propagator`], for example, has a long application name.
[`opentelemetry_process_propagator`]: https://hexdocs.pm/opentelemetry_process_propagator/OpentelemetryProcessPropagator.html
Has anyone written the rationale on why the Rust logo shows up on projects that
aren't the standard library? If we turned it off on non-standard crates by
default, it would line wrap crate names a lot less often.
Or maybe we should encourage crate authors to include their own logo more
often? It certainly helps give people a better sense of "place."
I'm not sure of anything that directly follows up this one. Plenty of other
changes could be made to improve the layout, like
* coming up with a less cluttered way to do disclosure (there's a lot of `[-]`
on the page)
* doing a better job of separating lateral navigation (vec::Vec links to
vec::IntoIter) and the table of contents (vec::Vec links to vec::Vec::new)
* giving readers more control of how much rustdoc hows them, and giving doc
authors more control of how much it generates
* better search that reduces the need to browse
But those are mostly orthogonal, not future possibilities unlocked by this change.
2023-09-18 13:59:49 -05:00
|
|
|
assert-text: (".sidebar > .sidebar-crate > h2 > a", "lib2")
|
|
|
|
assert-count: (".sidebar .location", 0)
|
2021-05-02 11:59:31 -05:00
|
|
|
// We check that we have the crates list and that the "current" on is now "lib2".
|
2023-09-07 20:45:24 -05:00
|
|
|
assert-text: (".sidebar-elems ul.crate > li.current > a", "lib2")
|
2021-05-02 11:59:31 -05:00
|
|
|
// We now go to the "foobar" function page.
|
2022-10-10 13:37:19 -05:00
|
|
|
assert-text: (".sidebar-elems > section ul.block > li:nth-child(1)", "Modules")
|
|
|
|
assert-text: (".sidebar-elems > section ul.block > li:nth-child(2)", "Structs")
|
|
|
|
assert-text: (".sidebar-elems > section ul.block > li:nth-child(3)", "Traits")
|
|
|
|
assert-text: (".sidebar-elems > section ul.block > li:nth-child(4)", "Functions")
|
2023-08-21 18:20:00 -05:00
|
|
|
assert-text: (".sidebar-elems > section ul.block > li:nth-child(5)", "Type Aliases")
|
2023-02-07 20:00:18 -06:00
|
|
|
assert-text: ("#functions + .item-table .item-name > a", "foobar")
|
|
|
|
click: "#functions + .item-table .item-name > a"
|
2021-05-02 11:59:31 -05:00
|
|
|
|
|
|
|
// PAGE: fn.foobar.html
|
2022-10-18 13:14:01 -05:00
|
|
|
// In items containing no items (like functions or constants) and in modules, we have no
|
2023-09-23 14:59:58 -05:00
|
|
|
// "location" elements. Only the crate and optional parent module.
|
|
|
|
// This page, being directly below the crate, only has its heading.
|
rustdoc: show crate name beside small logo
This commit changes the layout to something a bit less "look at my logo!!!111"
gigantic, and makes it clearer where clicking the logo will actually take you.
It also means the crate name is persistently at the top of the sidebar, even
when in a sub-item page, and clicking that name takes you back to the root.
| | Short crate name | Long crate name |
|---------|------------------|-----------------|
| Root | ![short-root] | ![long-root]
| Subpage | ![short-subpage] | ![long-subpage]
[short-root]: https://github.com/rust-lang/rust/assets/1593513/fe2ce102-d4b8-44e6-9f7b-68636a907f56
[short-subpage]: https://github.com/rust-lang/rust/assets/1593513/29501663-56c0-4151-b7de-d2637e167125
[long-root]: https://github.com/rust-lang/rust/assets/1593513/f6a385c0-b4c5-4a9c-954b-21b38de4192f
[long-subpage]: https://github.com/rust-lang/rust/assets/1593513/97ec47b4-61bf-4ebe-b461-0d2187b8c6ca
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/image/index.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/index.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/adler/struct.Adler32.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/struct.Sender.html
This improves visual information density (the construct with the logo and
crate name is *shorter* than the logo on its own, because it's not
square) and navigation clarity (we can now see what clicking the Rust logo
does, specifically).
Compare this with the layout at [Phoenix's Hexdocs] (which is what this
proposal is closely based on), the old proposal on [Internals Discourse]
(which always says "Rust standard library" in the sidebar, but doesn't do the
side-by-side layout).
[Phoenix's Hexdocs]: https://hexdocs.pm/phoenix/1.7.7/overview.html
[Internals Discourse]: https://internals.rust-lang.org/t/poc-of-a-new-design-for-the-generated-rustdoc/11018
In newer versions of rustdoc, the crate name and version are always shown in
the sidebar, even in subpages. Clicking the crate name does the same thing
clicking the logo always did: return you to the crate root.
While this actually takes up less screen real estate than the old layout on
desktop, it takes up more HTML. It's also a bit more visually complex.
I could do what the Internals POC did and keep the vertically stacked layout
all the time, instead of doing a horizontal stack where possible. It would
take up more screen real estate, though.
This design is lifted almost verbatim from Hexdocs. It seems to work for them.
[`opentelemetry_process_propagator`], for example, has a long application name.
[`opentelemetry_process_propagator`]: https://hexdocs.pm/opentelemetry_process_propagator/OpentelemetryProcessPropagator.html
Has anyone written the rationale on why the Rust logo shows up on projects that
aren't the standard library? If we turned it off on non-standard crates by
default, it would line wrap crate names a lot less often.
Or maybe we should encourage crate authors to include their own logo more
often? It certainly helps give people a better sense of "place."
I'm not sure of anything that directly follows up this one. Plenty of other
changes could be made to improve the layout, like
* coming up with a less cluttered way to do disclosure (there's a lot of `[-]`
on the page)
* doing a better job of separating lateral navigation (vec::Vec links to
vec::IntoIter) and the table of contents (vec::Vec links to vec::Vec::new)
* giving readers more control of how much rustdoc hows them, and giving doc
authors more control of how much it generates
* better search that reduces the need to browse
But those are mostly orthogonal, not future possibilities unlocked by this change.
2023-09-18 13:59:49 -05:00
|
|
|
assert-text: (".sidebar > .sidebar-crate > h2 > a", "lib2")
|
2022-10-18 13:14:01 -05:00
|
|
|
assert-count: (".sidebar .location", 0)
|
2023-09-23 14:59:58 -05:00
|
|
|
assert-count: (".sidebar h2", 1)
|
2024-07-18 14:06:21 -05:00
|
|
|
assert-text: (".sidebar-elems ul.block > li.current > a", "foobar")
|
2021-05-31 05:11:05 -05:00
|
|
|
// We check that we don't have the crate list.
|
|
|
|
assert-false: ".sidebar-elems > .crate"
|
|
|
|
|
2023-04-11 12:11:34 -05:00
|
|
|
go-to: "./module/index.html"
|
2022-09-22 12:42:15 -05:00
|
|
|
assert-property: (".sidebar", {"clientWidth": "200"})
|
rustdoc: show crate name beside small logo
This commit changes the layout to something a bit less "look at my logo!!!111"
gigantic, and makes it clearer where clicking the logo will actually take you.
It also means the crate name is persistently at the top of the sidebar, even
when in a sub-item page, and clicking that name takes you back to the root.
| | Short crate name | Long crate name |
|---------|------------------|-----------------|
| Root | ![short-root] | ![long-root]
| Subpage | ![short-subpage] | ![long-subpage]
[short-root]: https://github.com/rust-lang/rust/assets/1593513/fe2ce102-d4b8-44e6-9f7b-68636a907f56
[short-subpage]: https://github.com/rust-lang/rust/assets/1593513/29501663-56c0-4151-b7de-d2637e167125
[long-root]: https://github.com/rust-lang/rust/assets/1593513/f6a385c0-b4c5-4a9c-954b-21b38de4192f
[long-subpage]: https://github.com/rust-lang/rust/assets/1593513/97ec47b4-61bf-4ebe-b461-0d2187b8c6ca
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/image/index.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/index.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/adler/struct.Adler32.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/struct.Sender.html
This improves visual information density (the construct with the logo and
crate name is *shorter* than the logo on its own, because it's not
square) and navigation clarity (we can now see what clicking the Rust logo
does, specifically).
Compare this with the layout at [Phoenix's Hexdocs] (which is what this
proposal is closely based on), the old proposal on [Internals Discourse]
(which always says "Rust standard library" in the sidebar, but doesn't do the
side-by-side layout).
[Phoenix's Hexdocs]: https://hexdocs.pm/phoenix/1.7.7/overview.html
[Internals Discourse]: https://internals.rust-lang.org/t/poc-of-a-new-design-for-the-generated-rustdoc/11018
In newer versions of rustdoc, the crate name and version are always shown in
the sidebar, even in subpages. Clicking the crate name does the same thing
clicking the logo always did: return you to the crate root.
While this actually takes up less screen real estate than the old layout on
desktop, it takes up more HTML. It's also a bit more visually complex.
I could do what the Internals POC did and keep the vertically stacked layout
all the time, instead of doing a horizontal stack where possible. It would
take up more screen real estate, though.
This design is lifted almost verbatim from Hexdocs. It seems to work for them.
[`opentelemetry_process_propagator`], for example, has a long application name.
[`opentelemetry_process_propagator`]: https://hexdocs.pm/opentelemetry_process_propagator/OpentelemetryProcessPropagator.html
Has anyone written the rationale on why the Rust logo shows up on projects that
aren't the standard library? If we turned it off on non-standard crates by
default, it would line wrap crate names a lot less often.
Or maybe we should encourage crate authors to include their own logo more
often? It certainly helps give people a better sense of "place."
I'm not sure of anything that directly follows up this one. Plenty of other
changes could be made to improve the layout, like
* coming up with a less cluttered way to do disclosure (there's a lot of `[-]`
on the page)
* doing a better job of separating lateral navigation (vec::Vec links to
vec::IntoIter) and the table of contents (vec::Vec links to vec::Vec::new)
* giving readers more control of how much rustdoc hows them, and giving doc
authors more control of how much it generates
* better search that reduces the need to browse
But those are mostly orthogonal, not future possibilities unlocked by this change.
2023-09-18 13:59:49 -05:00
|
|
|
assert-text: (".sidebar > .sidebar-crate > h2 > a", "lib2")
|
2024-02-06 11:22:24 -06:00
|
|
|
assert-text: (".sidebar .location", "Module module")
|
rustdoc: show crate name beside small logo
This commit changes the layout to something a bit less "look at my logo!!!111"
gigantic, and makes it clearer where clicking the logo will actually take you.
It also means the crate name is persistently at the top of the sidebar, even
when in a sub-item page, and clicking that name takes you back to the root.
| | Short crate name | Long crate name |
|---------|------------------|-----------------|
| Root | ![short-root] | ![long-root]
| Subpage | ![short-subpage] | ![long-subpage]
[short-root]: https://github.com/rust-lang/rust/assets/1593513/fe2ce102-d4b8-44e6-9f7b-68636a907f56
[short-subpage]: https://github.com/rust-lang/rust/assets/1593513/29501663-56c0-4151-b7de-d2637e167125
[long-root]: https://github.com/rust-lang/rust/assets/1593513/f6a385c0-b4c5-4a9c-954b-21b38de4192f
[long-subpage]: https://github.com/rust-lang/rust/assets/1593513/97ec47b4-61bf-4ebe-b461-0d2187b8c6ca
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/image/index.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/index.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/adler/struct.Adler32.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/struct.Sender.html
This improves visual information density (the construct with the logo and
crate name is *shorter* than the logo on its own, because it's not
square) and navigation clarity (we can now see what clicking the Rust logo
does, specifically).
Compare this with the layout at [Phoenix's Hexdocs] (which is what this
proposal is closely based on), the old proposal on [Internals Discourse]
(which always says "Rust standard library" in the sidebar, but doesn't do the
side-by-side layout).
[Phoenix's Hexdocs]: https://hexdocs.pm/phoenix/1.7.7/overview.html
[Internals Discourse]: https://internals.rust-lang.org/t/poc-of-a-new-design-for-the-generated-rustdoc/11018
In newer versions of rustdoc, the crate name and version are always shown in
the sidebar, even in subpages. Clicking the crate name does the same thing
clicking the logo always did: return you to the crate root.
While this actually takes up less screen real estate than the old layout on
desktop, it takes up more HTML. It's also a bit more visually complex.
I could do what the Internals POC did and keep the vertically stacked layout
all the time, instead of doing a horizontal stack where possible. It would
take up more screen real estate, though.
This design is lifted almost verbatim from Hexdocs. It seems to work for them.
[`opentelemetry_process_propagator`], for example, has a long application name.
[`opentelemetry_process_propagator`]: https://hexdocs.pm/opentelemetry_process_propagator/OpentelemetryProcessPropagator.html
Has anyone written the rationale on why the Rust logo shows up on projects that
aren't the standard library? If we turned it off on non-standard crates by
default, it would line wrap crate names a lot less often.
Or maybe we should encourage crate authors to include their own logo more
often? It certainly helps give people a better sense of "place."
I'm not sure of anything that directly follows up this one. Plenty of other
changes could be made to improve the layout, like
* coming up with a less cluttered way to do disclosure (there's a lot of `[-]`
on the page)
* doing a better job of separating lateral navigation (vec::Vec links to
vec::IntoIter) and the table of contents (vec::Vec links to vec::Vec::new)
* giving readers more control of how much rustdoc hows them, and giving doc
authors more control of how much it generates
* better search that reduces the need to browse
But those are mostly orthogonal, not future possibilities unlocked by this change.
2023-09-18 13:59:49 -05:00
|
|
|
assert-count: (".sidebar .location", 1)
|
2024-07-18 14:06:21 -05:00
|
|
|
assert-text: (".sidebar-elems ul.block > li.current > a", "module")
|
2023-09-23 14:59:58 -05:00
|
|
|
// Module page requires three headings:
|
|
|
|
// - Presistent crate branding (name and version)
|
|
|
|
// - Module name, followed by TOC for module headings
|
|
|
|
// - "In crate [name]" parent pointer, followed by sibling navigation
|
|
|
|
assert-count: (".sidebar h2", 3)
|
2024-07-24 15:16:08 -05:00
|
|
|
assert-text: (".sidebar > .sidebar-elems > #rustdoc-modnav > h2", "In crate lib2")
|
|
|
|
assert-property: (".sidebar > .sidebar-elems > #rustdoc-modnav > h2 > a", {
|
2023-09-23 14:59:58 -05:00
|
|
|
"href": "/lib2/index.html",
|
|
|
|
}, ENDS_WITH)
|
2021-05-31 04:51:22 -05:00
|
|
|
// We check that we don't have the crate list.
|
|
|
|
assert-false: ".sidebar-elems > .crate"
|
2021-05-02 11:59:31 -05:00
|
|
|
|
2023-04-11 12:11:34 -05:00
|
|
|
go-to: "./sub_module/sub_sub_module/index.html"
|
2022-09-22 12:42:15 -05:00
|
|
|
assert-property: (".sidebar", {"clientWidth": "200"})
|
rustdoc: show crate name beside small logo
This commit changes the layout to something a bit less "look at my logo!!!111"
gigantic, and makes it clearer where clicking the logo will actually take you.
It also means the crate name is persistently at the top of the sidebar, even
when in a sub-item page, and clicking that name takes you back to the root.
| | Short crate name | Long crate name |
|---------|------------------|-----------------|
| Root | ![short-root] | ![long-root]
| Subpage | ![short-subpage] | ![long-subpage]
[short-root]: https://github.com/rust-lang/rust/assets/1593513/fe2ce102-d4b8-44e6-9f7b-68636a907f56
[short-subpage]: https://github.com/rust-lang/rust/assets/1593513/29501663-56c0-4151-b7de-d2637e167125
[long-root]: https://github.com/rust-lang/rust/assets/1593513/f6a385c0-b4c5-4a9c-954b-21b38de4192f
[long-subpage]: https://github.com/rust-lang/rust/assets/1593513/97ec47b4-61bf-4ebe-b461-0d2187b8c6ca
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/image/index.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/index.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/adler/struct.Adler32.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/struct.Sender.html
This improves visual information density (the construct with the logo and
crate name is *shorter* than the logo on its own, because it's not
square) and navigation clarity (we can now see what clicking the Rust logo
does, specifically).
Compare this with the layout at [Phoenix's Hexdocs] (which is what this
proposal is closely based on), the old proposal on [Internals Discourse]
(which always says "Rust standard library" in the sidebar, but doesn't do the
side-by-side layout).
[Phoenix's Hexdocs]: https://hexdocs.pm/phoenix/1.7.7/overview.html
[Internals Discourse]: https://internals.rust-lang.org/t/poc-of-a-new-design-for-the-generated-rustdoc/11018
In newer versions of rustdoc, the crate name and version are always shown in
the sidebar, even in subpages. Clicking the crate name does the same thing
clicking the logo always did: return you to the crate root.
While this actually takes up less screen real estate than the old layout on
desktop, it takes up more HTML. It's also a bit more visually complex.
I could do what the Internals POC did and keep the vertically stacked layout
all the time, instead of doing a horizontal stack where possible. It would
take up more screen real estate, though.
This design is lifted almost verbatim from Hexdocs. It seems to work for them.
[`opentelemetry_process_propagator`], for example, has a long application name.
[`opentelemetry_process_propagator`]: https://hexdocs.pm/opentelemetry_process_propagator/OpentelemetryProcessPropagator.html
Has anyone written the rationale on why the Rust logo shows up on projects that
aren't the standard library? If we turned it off on non-standard crates by
default, it would line wrap crate names a lot less often.
Or maybe we should encourage crate authors to include their own logo more
often? It certainly helps give people a better sense of "place."
I'm not sure of anything that directly follows up this one. Plenty of other
changes could be made to improve the layout, like
* coming up with a less cluttered way to do disclosure (there's a lot of `[-]`
on the page)
* doing a better job of separating lateral navigation (vec::Vec links to
vec::IntoIter) and the table of contents (vec::Vec links to vec::Vec::new)
* giving readers more control of how much rustdoc hows them, and giving doc
authors more control of how much it generates
* better search that reduces the need to browse
But those are mostly orthogonal, not future possibilities unlocked by this change.
2023-09-18 13:59:49 -05:00
|
|
|
assert-text: (".sidebar > .sidebar-crate > h2 > a", "lib2")
|
2024-02-06 11:22:24 -06:00
|
|
|
assert-text: (".sidebar .location", "Module sub_sub_module")
|
2024-07-24 15:16:08 -05:00
|
|
|
assert-text: (".sidebar > .sidebar-elems > #rustdoc-modnav > h2", "In lib2::module::sub_module")
|
|
|
|
assert-property: (".sidebar > .sidebar-elems > #rustdoc-modnav > h2 > a", {
|
2023-09-23 14:59:58 -05:00
|
|
|
"href": "/module/sub_module/index.html",
|
|
|
|
}, ENDS_WITH)
|
2024-07-18 14:06:21 -05:00
|
|
|
assert-text: (".sidebar-elems ul.block > li.current > a", "sub_sub_module")
|
2021-05-31 04:51:22 -05:00
|
|
|
// We check that we don't have the crate list.
|
2021-11-04 10:27:02 -05:00
|
|
|
assert-false: ".sidebar-elems .crate"
|
2022-02-08 10:05:00 -06:00
|
|
|
assert-text: (".sidebar-elems > section ul > li:nth-child(1)", "Functions")
|
2023-02-07 20:00:18 -06:00
|
|
|
assert-text: ("#functions + .item-table .item-name > a", "foo")
|
2022-01-24 22:19:09 -06:00
|
|
|
|
|
|
|
// Links to trait implementations in the sidebar should not wrap even if they are long.
|
2023-04-11 12:11:34 -05:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/lib2/struct.HasALongTraitWithParams.html"
|
2022-09-22 12:42:15 -05:00
|
|
|
assert-property: (".sidebar", {"clientWidth": "200"})
|
2022-02-08 10:05:00 -06:00
|
|
|
assert-property: (".sidebar-elems section .block li > a", {"offsetHeight": 29})
|
2022-02-04 00:50:32 -06:00
|
|
|
|
|
|
|
// Test that clicking on of the "In <module>" headings in the sidebar links to the
|
|
|
|
// appropriate anchor in index.html.
|
2023-04-11 12:11:34 -05:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
|
2022-09-22 12:42:15 -05:00
|
|
|
assert-property: (".sidebar", {"clientWidth": "200"})
|
2022-10-10 13:37:19 -05:00
|
|
|
click: "//ul[@class='block mod']/preceding-sibling::h3/a"
|
2022-02-04 00:50:32 -06:00
|
|
|
// PAGE: index.html
|
2023-09-02 14:00:23 -05:00
|
|
|
assert-css: ("#modules", {"background-color": "#fdffd3"})
|
2022-09-22 12:42:15 -05:00
|
|
|
|
rustdoc: redesign toolbar and disclosure widgets
This adds labels to the icons and moves them away from the search box.
These changes are made together, because they work together, but are based on
several complaints:
* The [+/-] thing are a Reddit-ism. They don't look like buttons, but look
like syntax
<https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/More.20visual.20difference.20for.20the.20.2B.2F-.20.20Icons>,
<https://github.com/rust-lang/rust/issues/59851>
(some of these are laundry lists with more suggestions, but they all
mention [+/-] looking wrong)
* The settings, help, and summary buttons are also too hard to recognize
<https://lwn.net/Articles/987070/>,
<https://github.com/rust-lang/rust/issues/90310>,
<https://github.com/rust-lang/rust/issues/14475#issuecomment-274241997>,
<https://internals.rust-lang.org/t/improve-rustdoc-design/12758>
("Not all functionality is self-explanatory, for example the [+] button in
the top right corner, the theme picker or the settings button.")
The toggle-all and toggle-individual buttons both need done at once, since we
want them to look like they go together. This changes them from both being
[+/-] to both being arrows.
Settings and Help are also migrated, so that the whole group can benefit from
being described using actual words.
Additionally, the Help button is only shown on SERPs, not all the time.
This is done for two major reasons:
* Most of what's in there is search-related. The things that aren't are
keyboard commands, and the search box tells you about that anyway.
Pressing <kbd>?</kbd> will temporarily show the button and its popover.
* I'm trading it off by showing the help button, even on mobile.
It's useful since you can use the search engine suggestions there.
* The three buttons were causing line wrapping on too many desktop layouts.
2024-08-25 01:11:30 -05:00
|
|
|
// Finally, assert that the Summary toggle doesn't affect sidebar width.
|
2022-09-22 12:42:15 -05:00
|
|
|
click: "#toggle-all-docs"
|
rustdoc: redesign toolbar and disclosure widgets
This adds labels to the icons and moves them away from the search box.
These changes are made together, because they work together, but are based on
several complaints:
* The [+/-] thing are a Reddit-ism. They don't look like buttons, but look
like syntax
<https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/More.20visual.20difference.20for.20the.20.2B.2F-.20.20Icons>,
<https://github.com/rust-lang/rust/issues/59851>
(some of these are laundry lists with more suggestions, but they all
mention [+/-] looking wrong)
* The settings, help, and summary buttons are also too hard to recognize
<https://lwn.net/Articles/987070/>,
<https://github.com/rust-lang/rust/issues/90310>,
<https://github.com/rust-lang/rust/issues/14475#issuecomment-274241997>,
<https://internals.rust-lang.org/t/improve-rustdoc-design/12758>
("Not all functionality is self-explanatory, for example the [+] button in
the top right corner, the theme picker or the settings button.")
The toggle-all and toggle-individual buttons both need done at once, since we
want them to look like they go together. This changes them from both being
[+/-] to both being arrows.
Settings and Help are also migrated, so that the whole group can benefit from
being described using actual words.
Additionally, the Help button is only shown on SERPs, not all the time.
This is done for two major reasons:
* Most of what's in there is search-related. The things that aren't are
keyboard commands, and the search box tells you about that anyway.
Pressing <kbd>?</kbd> will temporarily show the button and its popover.
* I'm trading it off by showing the help button, even on mobile.
It's useful since you can use the search engine suggestions there.
* The three buttons were causing line wrapping on too many desktop layouts.
2024-08-25 01:11:30 -05:00
|
|
|
assert-text: ("#toggle-all-docs", "Show all")
|
2022-09-22 12:42:15 -05:00
|
|
|
assert-property: (".sidebar", {"clientWidth": "200"})
|
|
|
|
click: "#toggle-all-docs"
|
rustdoc: redesign toolbar and disclosure widgets
This adds labels to the icons and moves them away from the search box.
These changes are made together, because they work together, but are based on
several complaints:
* The [+/-] thing are a Reddit-ism. They don't look like buttons, but look
like syntax
<https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/More.20visual.20difference.20for.20the.20.2B.2F-.20.20Icons>,
<https://github.com/rust-lang/rust/issues/59851>
(some of these are laundry lists with more suggestions, but they all
mention [+/-] looking wrong)
* The settings, help, and summary buttons are also too hard to recognize
<https://lwn.net/Articles/987070/>,
<https://github.com/rust-lang/rust/issues/90310>,
<https://github.com/rust-lang/rust/issues/14475#issuecomment-274241997>,
<https://internals.rust-lang.org/t/improve-rustdoc-design/12758>
("Not all functionality is self-explanatory, for example the [+] button in
the top right corner, the theme picker or the settings button.")
The toggle-all and toggle-individual buttons both need done at once, since we
want them to look like they go together. This changes them from both being
[+/-] to both being arrows.
Settings and Help are also migrated, so that the whole group can benefit from
being described using actual words.
Additionally, the Help button is only shown on SERPs, not all the time.
This is done for two major reasons:
* Most of what's in there is search-related. The things that aren't are
keyboard commands, and the search box tells you about that anyway.
Pressing <kbd>?</kbd> will temporarily show the button and its popover.
* I'm trading it off by showing the help button, even on mobile.
It's useful since you can use the search engine suggestions there.
* The three buttons were causing line wrapping on too many desktop layouts.
2024-08-25 01:11:30 -05:00
|
|
|
assert-text: ("#toggle-all-docs", "Summary")
|
2023-01-08 14:29:57 -06:00
|
|
|
assert-property: (".sidebar", {"clientWidth": "200"})
|
2023-03-02 19:21:26 -06:00
|
|
|
|
|
|
|
// Checks that all.html and index.html have their sidebar link in the same place.
|
2023-04-11 12:11:34 -05:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
|
rustdoc: show crate name beside small logo
This commit changes the layout to something a bit less "look at my logo!!!111"
gigantic, and makes it clearer where clicking the logo will actually take you.
It also means the crate name is persistently at the top of the sidebar, even
when in a sub-item page, and clicking that name takes you back to the root.
| | Short crate name | Long crate name |
|---------|------------------|-----------------|
| Root | ![short-root] | ![long-root]
| Subpage | ![short-subpage] | ![long-subpage]
[short-root]: https://github.com/rust-lang/rust/assets/1593513/fe2ce102-d4b8-44e6-9f7b-68636a907f56
[short-subpage]: https://github.com/rust-lang/rust/assets/1593513/29501663-56c0-4151-b7de-d2637e167125
[long-root]: https://github.com/rust-lang/rust/assets/1593513/f6a385c0-b4c5-4a9c-954b-21b38de4192f
[long-subpage]: https://github.com/rust-lang/rust/assets/1593513/97ec47b4-61bf-4ebe-b461-0d2187b8c6ca
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/image/index.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/index.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/adler/struct.Adler32.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/struct.Sender.html
This improves visual information density (the construct with the logo and
crate name is *shorter* than the logo on its own, because it's not
square) and navigation clarity (we can now see what clicking the Rust logo
does, specifically).
Compare this with the layout at [Phoenix's Hexdocs] (which is what this
proposal is closely based on), the old proposal on [Internals Discourse]
(which always says "Rust standard library" in the sidebar, but doesn't do the
side-by-side layout).
[Phoenix's Hexdocs]: https://hexdocs.pm/phoenix/1.7.7/overview.html
[Internals Discourse]: https://internals.rust-lang.org/t/poc-of-a-new-design-for-the-generated-rustdoc/11018
In newer versions of rustdoc, the crate name and version are always shown in
the sidebar, even in subpages. Clicking the crate name does the same thing
clicking the logo always did: return you to the crate root.
While this actually takes up less screen real estate than the old layout on
desktop, it takes up more HTML. It's also a bit more visually complex.
I could do what the Internals POC did and keep the vertically stacked layout
all the time, instead of doing a horizontal stack where possible. It would
take up more screen real estate, though.
This design is lifted almost verbatim from Hexdocs. It seems to work for them.
[`opentelemetry_process_propagator`], for example, has a long application name.
[`opentelemetry_process_propagator`]: https://hexdocs.pm/opentelemetry_process_propagator/OpentelemetryProcessPropagator.html
Has anyone written the rationale on why the Rust logo shows up on projects that
aren't the standard library? If we turned it off on non-standard crates by
default, it would line wrap crate names a lot less often.
Or maybe we should encourage crate authors to include their own logo more
often? It certainly helps give people a better sense of "place."
I'm not sure of anything that directly follows up this one. Plenty of other
changes could be made to improve the layout, like
* coming up with a less cluttered way to do disclosure (there's a lot of `[-]`
on the page)
* doing a better job of separating lateral navigation (vec::Vec links to
vec::IntoIter) and the table of contents (vec::Vec links to vec::Vec::new)
* giving readers more control of how much rustdoc hows them, and giving doc
authors more control of how much it generates
* better search that reduces the need to browse
But those are mostly orthogonal, not future possibilities unlocked by this change.
2023-09-18 13:59:49 -05:00
|
|
|
store-property: (".sidebar .sidebar-crate h2 a", {
|
2023-05-10 03:56:59 -05:00
|
|
|
"clientWidth": index_sidebar_width,
|
|
|
|
"clientHeight": index_sidebar_height,
|
|
|
|
"offsetTop": index_sidebar_y,
|
|
|
|
"offsetLeft": index_sidebar_x,
|
|
|
|
})
|
2023-04-11 12:11:34 -05:00
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/all.html"
|
rustdoc: show crate name beside small logo
This commit changes the layout to something a bit less "look at my logo!!!111"
gigantic, and makes it clearer where clicking the logo will actually take you.
It also means the crate name is persistently at the top of the sidebar, even
when in a sub-item page, and clicking that name takes you back to the root.
| | Short crate name | Long crate name |
|---------|------------------|-----------------|
| Root | ![short-root] | ![long-root]
| Subpage | ![short-subpage] | ![long-subpage]
[short-root]: https://github.com/rust-lang/rust/assets/1593513/fe2ce102-d4b8-44e6-9f7b-68636a907f56
[short-subpage]: https://github.com/rust-lang/rust/assets/1593513/29501663-56c0-4151-b7de-d2637e167125
[long-root]: https://github.com/rust-lang/rust/assets/1593513/f6a385c0-b4c5-4a9c-954b-21b38de4192f
[long-subpage]: https://github.com/rust-lang/rust/assets/1593513/97ec47b4-61bf-4ebe-b461-0d2187b8c6ca
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/image/index.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/index.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/adler/struct.Adler32.html
https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/struct.Sender.html
This improves visual information density (the construct with the logo and
crate name is *shorter* than the logo on its own, because it's not
square) and navigation clarity (we can now see what clicking the Rust logo
does, specifically).
Compare this with the layout at [Phoenix's Hexdocs] (which is what this
proposal is closely based on), the old proposal on [Internals Discourse]
(which always says "Rust standard library" in the sidebar, but doesn't do the
side-by-side layout).
[Phoenix's Hexdocs]: https://hexdocs.pm/phoenix/1.7.7/overview.html
[Internals Discourse]: https://internals.rust-lang.org/t/poc-of-a-new-design-for-the-generated-rustdoc/11018
In newer versions of rustdoc, the crate name and version are always shown in
the sidebar, even in subpages. Clicking the crate name does the same thing
clicking the logo always did: return you to the crate root.
While this actually takes up less screen real estate than the old layout on
desktop, it takes up more HTML. It's also a bit more visually complex.
I could do what the Internals POC did and keep the vertically stacked layout
all the time, instead of doing a horizontal stack where possible. It would
take up more screen real estate, though.
This design is lifted almost verbatim from Hexdocs. It seems to work for them.
[`opentelemetry_process_propagator`], for example, has a long application name.
[`opentelemetry_process_propagator`]: https://hexdocs.pm/opentelemetry_process_propagator/OpentelemetryProcessPropagator.html
Has anyone written the rationale on why the Rust logo shows up on projects that
aren't the standard library? If we turned it off on non-standard crates by
default, it would line wrap crate names a lot less often.
Or maybe we should encourage crate authors to include their own logo more
often? It certainly helps give people a better sense of "place."
I'm not sure of anything that directly follows up this one. Plenty of other
changes could be made to improve the layout, like
* coming up with a less cluttered way to do disclosure (there's a lot of `[-]`
on the page)
* doing a better job of separating lateral navigation (vec::Vec links to
vec::IntoIter) and the table of contents (vec::Vec links to vec::Vec::new)
* giving readers more control of how much rustdoc hows them, and giving doc
authors more control of how much it generates
* better search that reduces the need to browse
But those are mostly orthogonal, not future possibilities unlocked by this change.
2023-09-18 13:59:49 -05:00
|
|
|
assert-property: (".sidebar .sidebar-crate h2 a", {
|
2023-03-02 19:21:26 -06:00
|
|
|
"clientWidth": |index_sidebar_width|,
|
|
|
|
"clientHeight": |index_sidebar_height|,
|
2023-05-10 03:56:59 -05:00
|
|
|
"offsetTop": |index_sidebar_y|,
|
|
|
|
"offsetLeft": |index_sidebar_x|,
|
2023-03-02 19:21:26 -06:00
|
|
|
})
|
2024-07-16 12:04:40 -05:00
|
|
|
|
|
|
|
// Check that the sidebar links touch the left side of the box
|
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
|
|
|
|
assert-position: (".sidebar .block a", {"x": -4})
|
|
|
|
assert-position: (".sidebar-crate > h2 > a", {"x": -3})
|
|
|
|
|
|
|
|
// Check that the main sidebar links touch the left side of the box
|
|
|
|
// but the crate name doesn't, because the logo takes that space
|
|
|
|
go-to: "file://" + |DOC_PATH| + "/huge_logo/index.html"
|
|
|
|
assert-position: (".sidebar .block a", {"x": -4})
|
|
|
|
// when side-by-side, it's not line wrapped
|
|
|
|
assert-position-false: (".sidebar-crate > h2 > a", {"x": -3})
|
|
|
|
// when line-wrapped, see that it becomes flush-left again
|
|
|
|
drag-and-drop: ((205, 100), (108, 100))
|
|
|
|
assert-position: (".sidebar-crate > h2 > a", {"x": -3})
|
2024-02-06 19:21:48 -06:00
|
|
|
|
|
|
|
// Configuration option to show TOC in sidebar.
|
|
|
|
set-local-storage: {"rustdoc-hide-toc": "true"}
|
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/enum.WhoLetTheDogOut.html"
|
2024-07-24 15:16:08 -05:00
|
|
|
assert-css: ("#rustdoc-toc", {"display": "none"})
|
2024-02-06 19:21:48 -06:00
|
|
|
assert-css: (".sidebar .in-crate", {"display": "none"})
|
|
|
|
set-local-storage: {"rustdoc-hide-toc": "false"}
|
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/enum.WhoLetTheDogOut.html"
|
2024-07-24 15:16:08 -05:00
|
|
|
assert-css: ("#rustdoc-toc", {"display": "block"})
|
2024-02-06 19:21:48 -06:00
|
|
|
assert-css: (".sidebar .in-crate", {"display": "block"})
|
|
|
|
|
|
|
|
set-local-storage: {"rustdoc-hide-modnav": "true"}
|
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/enum.WhoLetTheDogOut.html"
|
2024-07-24 15:16:08 -05:00
|
|
|
assert-css: ("#rustdoc-modnav", {"display": "none"})
|
2024-02-06 19:21:48 -06:00
|
|
|
set-local-storage: {"rustdoc-hide-modnav": "false"}
|
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/enum.WhoLetTheDogOut.html"
|
2024-07-24 15:16:08 -05:00
|
|
|
assert-css: ("#rustdoc-modnav", {"display": "block"})
|
2024-02-06 19:21:48 -06:00
|
|
|
|
|
|
|
set-local-storage: {"rustdoc-hide-toc": "true"}
|
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
|
2024-07-24 15:16:08 -05:00
|
|
|
assert-css: ("#rustdoc-toc", {"display": "none"})
|
2024-02-06 19:21:48 -06:00
|
|
|
assert-false: ".sidebar .in-crate"
|
|
|
|
set-local-storage: {"rustdoc-hide-toc": "false"}
|
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
|
2024-07-24 15:16:08 -05:00
|
|
|
assert-css: ("#rustdoc-toc", {"display": "block"})
|
2024-02-06 19:21:48 -06:00
|
|
|
assert-false: ".sidebar .in-crate"
|
|
|
|
|
|
|
|
set-local-storage: {"rustdoc-hide-modnav": "true"}
|
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
|
2024-07-24 15:16:08 -05:00
|
|
|
assert-css: ("#rustdoc-modnav", {"display": "none"})
|
2024-02-06 19:21:48 -06:00
|
|
|
set-local-storage: {"rustdoc-hide-modnav": "false"}
|
|
|
|
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
|
2024-07-24 15:16:08 -05:00
|
|
|
assert-css: ("#rustdoc-modnav", {"display": "block"})
|