Skip to content

Commit 71c5f1e

Browse files
authored
Generate links to definition in source code pages on docs.rs and dev-docs.bevyengine.org (#12965)
# Objective - Fix issue #2611 ## Solution - Add `--generate-link-to-definition` to all the `rustdoc-args` arrays in the `Cargo.toml`s (for docs.rs) - Add `--generate-link-to-definition` to the `RUSTDOCFLAGS` environment variable in the docs workflow (for dev-docs.bevyengine.org) - Document all the workspace crates in the docs workflow (needed because otherwise only the source code of the `bevy` package will be included, making the argument useless) - I think this also fixes #3662, since it fixes the bug on dev-docs.bevyengine.org, while on docs.rs it has been fixed for a while on their side. --- ## Changelog - The source code viewer on docs.rs now includes links to the definitions.
1 parent 29e9f0a commit 71c5f1e

File tree

53 files changed

+59
-72
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+59
-72
lines changed

.github/workflows/docs.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,19 @@ jobs:
5858
- name: Build docs
5959
env:
6060
# needs to be in sync with [package.metadata.docs.rs]
61-
RUSTDOCFLAGS: -Zunstable-options --cfg=docsrs
62-
run: cargo doc --all-features --no-deps -p bevy -Zunstable-options -Zrustdoc-scrape-examples
61+
RUSTDOCFLAGS: -Zunstable-options --cfg=docsrs --generate-link-to-definition
62+
run: cargo doc \
63+
-Zunstable-options \
64+
-Zrustdoc-scrape-examples \
65+
--all-features \
66+
--workspace \
67+
--no-deps \
68+
--exclude ci \
69+
--exclude errors \
70+
--exclude bevy_mobile_example \
71+
--exclude build-wasm-example \
72+
--exclude build-templated-pages \
73+
--exclude example-showcase
6374

6475
# This adds the following:
6576
# - A top level redirect to the bevy crate documentation

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3339,6 +3339,6 @@ lto = "fat"
33393339
panic = "abort"
33403340

33413341
[package.metadata.docs.rs]
3342-
rustdoc-args = ["-Zunstable-options"]
3342+
rustdoc-args = ["-Zunstable-options", "--generate-link-to-definition"]
33433343
all-features = true
33443344
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]

crates/bevy_a11y/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ accesskit = "0.16"
2020
workspace = true
2121

2222
[package.metadata.docs.rs]
23-
rustdoc-args = ["-Zunstable-options"]
23+
rustdoc-args = ["-Zunstable-options", "--generate-link-to-definition"]
2424
all-features = true

crates/bevy_animation/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,5 @@ uuid = { version = "1.7", features = ["v4"] }
4242
workspace = true
4343

4444
[package.metadata.docs.rs]
45-
rustdoc-args = ["-Zunstable-options"]
45+
rustdoc-args = ["-Zunstable-options", "--generate-link-to-definition"]
4646
all-features = true

crates/bevy_app/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@ console_error_panic_hook = "0.1.6"
3838
workspace = true
3939

4040
[package.metadata.docs.rs]
41-
rustdoc-args = ["-Zunstable-options"]
41+
rustdoc-args = ["-Zunstable-options", "--generate-link-to-definition"]
4242
all-features = true

crates/bevy_asset/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,5 @@ bevy_log = { path = "../bevy_log", version = "0.15.0-dev" }
6767
workspace = true
6868

6969
[package.metadata.docs.rs]
70-
rustdoc-args = ["-Zunstable-options"]
70+
rustdoc-args = ["-Zunstable-options", "--generate-link-to-definition"]
7171
all-features = true

crates/bevy_asset/macros/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ quote = "1.0"
2222
workspace = true
2323

2424
[package.metadata.docs.rs]
25-
rustdoc-args = ["-Zunstable-options"]
25+
rustdoc-args = ["-Zunstable-options", "--generate-link-to-definition"]
2626
all-features = true

crates/bevy_audio/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,5 @@ android_shared_stdcxx = ["cpal/oboe-shared-stdcxx"]
5252
workspace = true
5353

5454
[package.metadata.docs.rs]
55-
rustdoc-args = ["-Zunstable-options"]
55+
rustdoc-args = ["-Zunstable-options", "--generate-link-to-definition"]
5656
all-features = true

crates/bevy_color/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ serialize = ["serde"]
2828
workspace = true
2929

3030
[package.metadata.docs.rs]
31-
rustdoc-args = ["-Zunstable-options"]
31+
rustdoc-args = ["-Zunstable-options", "--generate-link-to-definition"]
3232
all-features = true

crates/bevy_core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@ serde_test = "1.0"
3939
workspace = true
4040

4141
[package.metadata.docs.rs]
42-
rustdoc-args = ["-Zunstable-options"]
42+
rustdoc-args = ["-Zunstable-options", "--generate-link-to-definition"]
4343
all-features = true

0 commit comments

Comments
 (0)