Skip to content

Commit a1c4943

Browse files
RodhlannTim Pepper
andauthored
3d Shapes Example Doc Fix (#21842)
# Objective Resolve formatting issue in [3D Shapes Example](https://bevy.org/examples/3d-rendering/3d-shapes/) page on the Bevy Website, where an unwrapped `Assets<A>` is breaking the HTML rendering on the page. This fix follows the standard set forth by other `Assets<A>` instances on the page. Fixes bevy-website issue: bevyengine/bevy-website#2302 ## Solution Wrap `Assets<A>` as a code snippet to resolve HTML rendering issues. Wrapping the code properly encodes the characters so they are not interpreted as an HTML `<a>` tag. ## Testing ~~I am still working on setting up the bevy-website locally to render the Bevy examples, so I have been unable to test this directly, but I have set up a Zola demo project in my local environment where I was able to reproduce and fix the behavior using the same strategy.~~ I have been able to render the examples locally with the fix, see examples below --- ## Showcase ### Issue In Live Site <img width="1396" height="155" alt="image" src="https://github.com/user-attachments/assets/19fd22b0-691f-48dc-8a1e-69667a9e60f3" /> <img width="744" height="257" alt="image" src="https://github.com/user-attachments/assets/829629fe-fd53-4e74-862f-112b0baa1a20" /> ### Issue Resolve In Local Site <img width="1384" height="165" alt="image" src="https://github.com/user-attachments/assets/15ca531f-acf3-448c-b3ee-89b0e61ea46a" /> <img width="739" height="240" alt="image" src="https://github.com/user-attachments/assets/98c49993-072e-4c8b-91cf-298934bf2114" /> ### Issue Reproduced In Local Zola Project <img width="1653" height="104" alt="image" src="https://github.com/user-attachments/assets/14582277-2ece-4aba-84ad-05df1cee7aeb" /> <img width="704" height="94" alt="image" src="https://github.com/user-attachments/assets/0d223645-cd2f-4623-90c2-3f6ad98c874f" /> ### Issue Resolved In Local Zola Project <img width="1646" height="108" alt="image" src="https://github.com/user-attachments/assets/7c707402-8da9-4ae3-a409-16cee0c3feea" /> <img width="720" height="113" alt="image" src="https://github.com/user-attachments/assets/3c96e520-9d20-48aa-8a21-8c63067263ee" /> Co-authored-by: Tim Pepper <[email protected]>
1 parent 453b24c commit a1c4943

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/3d/3d_shapes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//!
33
//! "Shape primitives" here are just the mathematical definition of certain shapes, they're not meshes on their own! A sphere with radius `1.0` can be defined with [`Sphere::new(1.0)`][Sphere::new] but all this does is store the radius. So we need to turn these descriptions of shapes into meshes.
44
//!
5-
//! While a shape is not a mesh, turning it into one in Bevy is easy. In this example we call [`meshes.add(/* Shape here! */)`][Assets<A>::add] on the shape, which works because the [`Assets<A>::add`] method takes anything that can be turned into the asset type it stores. There's an implementation for [`From`] on shape primitives into [`Mesh`], so that will get called internally by [`Assets<A>::add`].
5+
//! While a shape is not a mesh, turning it into one in Bevy is easy. In this example we call [`meshes.add(/* Shape here! */)`][`Assets<A>::add`] on the shape, which works because the [`Assets<A>::add`] method takes anything that can be turned into the asset type it stores. There's an implementation for [`From`] on shape primitives into [`Mesh`], so that will get called internally by [`Assets<A>::add`].
66
//!
77
//! [`Extrusion`] lets us turn 2D shape primitives into versions of those shapes that have volume by extruding them. A 1x1 square that gets wrapped in this with an extrusion depth of 2 will give us a rectangular prism of size 1x1x2, but here we're just extruding these 2d shapes by depth 1.
88
//!

0 commit comments

Comments
 (0)