Fix PowerShell code blocks (#13511)

<!--
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: https://github.com/astral-sh/uv/pull/12520
This commit is contained in:
Reza Gharibi
2025-05-18 05:36:48 +03:30
committed by GitHub
parent 4b7f5f1103
commit d4e8df9b94
6 changed files with 25 additions and 25 deletions
+9 -9
View File
@@ -32,16 +32,16 @@ uv provides a standalone installer to download and install uv:
Use `irm` to download the script and execute it with `iex`:
```console
$ powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
```pwsh-session
PS> powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
```
Changing the [execution policy](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.4#powershell-execution-policies) allows running a script from the internet.
Request a specific version by including it in the URL:
```console
$ powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/0.7.5/install.ps1 | iex"
```pwsh-session
PS> powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/0.7.5/install.ps1 | iex"
```
!!! tip
@@ -56,8 +56,8 @@ uv provides a standalone installer to download and install uv:
=== "Windows"
```console
$ powershell -c "irm https://astral.sh/uv/install.ps1 | more"
```pwsh-session
PS> powershell -c "irm https://astral.sh/uv/install.ps1 | more"
```
Alternatively, the installer or binaries can be downloaded directly from [GitHub](#github-releases).
@@ -260,9 +260,9 @@ If you need to remove uv from your system, follow these steps:
=== "Windows"
```powershell
$ rm $HOME\.local\bin\uv.exe
$ rm $HOME\.local\bin\uvx.exe
```pwsh-session
PS> rm $HOME\.local\bin\uv.exe
PS> rm $HOME\.local\bin\uvx.exe
```
!!! note