podman-desktop icon indicating copy to clipboard operation
podman-desktop copied to clipboard

Site: When doing copy/paste, we should ignore the `$` at the beginning

Open cdrage opened this issue 3 weeks ago • 3 comments

Is your feature request related to a problem? Please describe

When going to the site and pressing the copy/paste button, the $ is included.

Which isn't ideal for multi-line copy/pastes when inputting it into the terminal.

Describe the solution you'd like

Image

When I press the copy-pasta button, I want to get:

podman run rust-hello-world-wasm

Not

$ podman run rust-hello-world-wasm

Describe alternatives you've considered

No response

Additional context

No response

cdrage avatar Dec 05 '25 01:12 cdrage

Thanks for opening this issue and moving discussion over here! To give some background, I opened https://github.com/podman-desktop/podman-desktop/pull/15228 because I was getting tired of having to either manually highlight a code block or remove the shell prompt if I used the copy button. I also looked into whether Docusaurus has a feature for disabling the inclusion of shell prompts when code blocks are copied, and it doesn't seem like they do. For reference, I took a look at https://github.com/facebook/docusaurus/issues/1745 and https://github.com/facebook/docusaurus/discussions/5227. Based on the discussions there, it seems that removing the shell prompt from all the code blocks in our docs is the simplest option at this time.

juliapaluch avatar Dec 05 '25 02:12 juliapaluch

there is an override of the function that should remove the shell prompt when copying it

https://github.com/podman-desktop/podman-desktop/blob/main/website/src/theme/CodeBlock/CopyButton/index.js

maybe it's no longer working or it works only for some cases but there was something to mitigate that

benoitf avatar Dec 08 '25 09:12 benoitf

The correct file path to the swizzle is now /theme/CodeBlock/Buttons/CopyButton/index.js as per Docusaurus. In the new location it loads the override at least, but seems like the logic also changed.

Generally I think we should keep $ and # visually for consistency, so I'd propose closing #15228 and fix this copy behavior instead.

jiridostal avatar Dec 08 '25 11:12 jiridostal