Closed willcrichton closed 1 week ago
Arf indeed. I think code unification will be needed for this feature with the other code blocks to prevent such regressions in the future. Gonna send a fix.
I decided to integrate the buttons with the existing code examples. For now it looks like this:
That looks great! Do the buttons have the same behavior where they only appear when you hover over the snippet?
Yes! I'm also planning to only generate them if they don't already exist on hover like the copy button (it is only created after you first hovered the code example), it'll reduce the HTML size quite a lot. I also simplified the HTML a bit (again, smaller). I almost didn't change anything in the scraped example JS code, which is quite nice. I expected more changes to be needed. Well done!
Rustdoc's copy code button introduced in 9946a68 conflicts with the UI for interacting with scraped code examples. I noticed this in the wild in Bevy's documentation: https://docs.rs/bevy/0.14.1/bevy/app/struct.App.html#scraped-examples-1
In the upper right corner is a button for expanding a snipper:
But hovering over the snippet shows the copy code button, obscuring the expand button:
cc @GuillaumeGomez