diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2024-07-28 20:07:44 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-28 20:07:44 +0200 |
| commit | a8cc24a1abd4327002ae67d981fd3830f002b49e (patch) | |
| tree | f29d4a09dbb44bbac53e7781ceeea7919649e7e8 /tests/rustdoc-js-std/macro-check.js | |
| parent | 78c857394ec8c01f06cb1df260c51178180a40e5 (diff) | |
| parent | 26d72512e0c7e9077134173aa60d77ba08ac3e9a (diff) | |
| download | rust-a8cc24a1abd4327002ae67d981fd3830f002b49e.tar.gz rust-a8cc24a1abd4327002ae67d981fd3830f002b49e.zip | |
Rollup merge of #125779 - GuillaumeGomez:copy-code, r=rustdoc-team
[rustdoc] Add copy code feature This PR adds a "copy code" to code blocks. Since this is a JS only feature, the HTML is generated with JS when the user hovers the code block to prevent generating DOM unless needed. Two things to note: 1. I voluntarily kept the current behaviour of the run button (only when hovering a code block with a mouse) so it doesn't do anything on mobile. I plan to send a follow-up where the buttons would "expandable" or something. Still need to think which approach would be the best. 2. I used a picture and not text like the run button to remain consistent with the "copy path" button. I'd also prefer for the run button to use a picture (like what is used in mdbook) but again, that's something to be discussed later on. The rendering looks like this:   It can be tested [here](https://guillaume-gomez.fr/rustdoc/bar/struct.Bar.html) (without the run button) and [here](https://guillaume-gomez.fr/rustdoc/foo/struct.Bar.html) (with the run button). Fixes #86851. r? ``@notriddle``
Diffstat (limited to 'tests/rustdoc-js-std/macro-check.js')
0 files changed, 0 insertions, 0 deletions
