Skip to content

Comments

Update installation.md#12520

Open
copeland3300 wants to merge 2 commits intoastral-sh:mainfrom
copeland3300:patch-1
Open

Update installation.md#12520
copeland3300 wants to merge 2 commits intoastral-sh:mainfrom
copeland3300:patch-1

Conversation

@copeland3300
Copy link

Fixed command blocks to copy to clipboard correctly

Summary

Test Plan

Fixed command blocks
@zanieb
Copy link
Member

zanieb commented Mar 28, 2025

Why does this fix things?

@copeland3300
Copy link
Author

copeland3300 commented Mar 28, 2025

As it stands right now, if you click "copy to clipboard" for 1. Clean up stored data, you will paste the following:

uv cache clean
rm -r "$(uv python dir)"
rm -r "$(uv tool dir)"

Great, this is easy to drop into a terminal.

The section 2. Remove the uv and uvx binaries will give the following for Windows:
$ rm $HOME.local\bin\uv.exe
$ rm $HOME.local\bin\uvx.exe

The $ at the beginning of lines breaks copy and paste.

I believe this change will fix.

EDIT: testing is showing this change isn't sufficient to fix the problem, so I'm playing with additional changes.

@copeland3300
Copy link
Author

It seems there is no good solution that I can easily find to keep the $ on the webpage but have to copy/paste function correctly.

I think we could remove the $, as other examples of powershell do not have lines starting with $. Updating the PR to reflect this suggestion.

@zanieb
Copy link
Member

zanieb commented Apr 1, 2025

The leading $ works elsewhere, we have some JS to strip it on copy. The solution is probably to find out why that's not working here instead of just removing it from this one spot.

@copeland3300
Copy link
Author

copeland3300 commented Apr 2, 2025

I've tried to copy in Firefox, Chrome (fresh install) and Edge, and in all cases the Windows lines were copied with the $

image

Are we thinking there's something going on with the JS?

@zanieb
Copy link
Member

zanieb commented Apr 2, 2025

That's my thinking, yeah

zanieb pushed a commit that referenced this pull request May 18, 2025
<!--
Thank you for contributing to uv! To help us out with reviewing, please
consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary

The PowerShell prompt is not `$`, so it is not detected as a
`Generic.Prompt` token by Pygments lexers. Therefore, the JavaScript
code does not strip the prompt when copying from PowerShell code blocks,
such as
[here](https://docs.astral.sh/uv/getting-started/installation/#__tabbed_5_2).

Other places in the docs have removed the prompt completely to address
this issue:
* https://docs.astral.sh/uv/guides/projects/#__tabbed_1_2
* https://docs.astral.sh/uv/guides/integration/jupyter/#__tabbed_1_2

This PR updates the PowerShell prompt to `PS>` and changes the code
fence language to `pwsh-session` to match the lexer name from
[Pygments](https://pygments.org/docs/lexers/#pygments.lexers.shell.PowerShellSessionLexer).
This allows the prompt to be correctly detected as a `Generic.Prompt`
token and is stripped during copy.

Related: #12520
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants