Skip to content

Commit

Permalink
Markdown and PS Styles (#11715)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArieHein authored Jan 21, 2025
1 parent 574e6df commit ebd9e7f
Show file tree
Hide file tree
Showing 21 changed files with 248 additions and 194 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ the commands and variables that can be used.

For more information, see [about_Language_Modes][02].

Originally, localized data files were meant to be used to store string data that
could be translated into other languages. This allowed your scripts to import
the data to provide localized string output in other languages. However, you
aren't limited to storing string data and don't have to use the data for
Originally, localized data files were meant to be used to store string data
that could be translated into other languages. This allowed your scripts to
import the data to provide localized string output in other languages. However,
you aren't limited to storing string data and don't have to use the data for
localized output.

The data in the file isn't limited to hashtables. It can be in any format
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ DATA -supportedCommand Format-Xml

### Using a `DATA` Section

To use the content of a `DATA` section, assign it to a variable and use variable
notation to access the content.
To use the content of a `DATA` section, assign it to a variable and use
variable notation to access the content.

For example, the following `DATA` section contains a `ConvertFrom-StringData`
command that converts the here-string into a hash table. The hash table is
Expand Down Expand Up @@ -173,7 +173,7 @@ A single-quoted here-string that uses the `ConvertFrom-StringData` cmdlet:

```powershell
DATA {
ConvertFrom-StringData -stringdata @'
ConvertFrom-StringData -StringData @'
Text001 = Windows 7
Text002 = Windows Server 2008 R2
'@
Expand All @@ -184,7 +184,7 @@ A double-quoted here-string that uses the `ConvertFrom-StringData` cmdlet:

```powershell
DATA {
ConvertFrom-StringData -stringdata @"
ConvertFrom-StringData -StringData @"
Msg1 = To start, press any key.
Msg2 = To exit, type "quit".
"@
Expand All @@ -195,7 +195,7 @@ A data section that includes a user-written cmdlet that generates data:

```powershell
DATA -supportedCommand Format-XML {
Format-Xml -strings string1, string2, string3
Format-Xml -Strings string1, string2, string3
}
```

Expand Down
44 changes: 22 additions & 22 deletions reference/7.5/Microsoft.PowerShell.Core/About/about_Debuggers.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ For example, the following command gets the variables in the local (script)
scope:

```powershell
Get-Variable -scope 0
Get-Variable -Scope 0
```

This is a useful way to see only the variables that you defined in the script
Expand Down Expand Up @@ -225,17 +225,17 @@ For example:
```powershell
function test-cmdlet {
begin {
write-output "Begin"
Write-Output "Begin"
}
process {
write-output "Process"
Write-Output "Process"
}
end {
write-output "End"
Write-Output "End"
}
}
C:\PS> Set-PSBreakpoint -command test-cmdlet
C:\PS> Set-PSBreakpoint -Command test-cmdlet
C:\PS> test-cmdlet
Expand Down Expand Up @@ -285,7 +285,7 @@ identifying changes to the prompt:

```powershell
Enter-PSSession -Cn localhost
[localhost]: PS C:\psscripts> Set-PSBreakpoint .\ttest19.ps1 6,11,22,25
[localhost]: PS C:\psscripts> Set-PSBreakpoint .\ttest19.ps1 6, 11, 22, 25
ID Script Line Command Variable Action
-- ------ ---- ------- -------- ------
Expand Down Expand Up @@ -367,7 +367,7 @@ Start by creating a line breakpoint on the first line of the Test.ps1 script in
the current directory.

```powershell
PS C:\ps-test> Set-PSBreakpoint -line 1 -script test.ps1
PS C:\ps-test> Set-PSBreakpoint -Line 1 -Script test.ps1
```

The command returns a **System.Management.Automation.LineBreakpoint** object.
Expand Down Expand Up @@ -482,7 +482,7 @@ reuse the breakpoint, use the `Disable-PsBreakpoint` cmdlet instead of
`Remove-PsBreakpoint`.)

```powershell
PS C:\ps-test> Get-PSBreakpoint| Remove-PSBreakpoint
PS C:\ps-test> Get-PSBreakpoint | Remove-PSBreakpoint
```

You can abbreviate this command as:
Expand All @@ -501,13 +501,13 @@ function delbr { gbp | rbp }
Now, create a breakpoint on the `$scriptname` variable.

```powershell
PS C:\ps-test> Set-PSBreakpoint -variable scriptname -script test.ps1
PS C:\ps-test> Set-PSBreakpoint -Variable scriptname -Script test.ps1
```

You can abbreviate the command as:

```powershell
PS C:\ps-test> sbp -v scriptname -s test.ps1
PS C:\ps-test> sbp -V scriptname -S test.ps1
```

Now, start the script. The script reaches the variable breakpoint. The default
Expand Down Expand Up @@ -557,8 +557,8 @@ Have you run a background job today (start-job)?
test.ps1:13 "Done $scriptName"
```

The `StepOver` command executes the function, and it previews the next statement
in the script, which prints the final line.
The `StepOver` command executes the function, and it previews the next
statement in the script, which prints the final line.

Use a `Stop` command (`t`) to exit the debugger. The command prompt reverts to
the standard command prompt.
Expand All @@ -571,19 +571,19 @@ To delete the breakpoints, use the `Get-PsBreakpoint` and `Remove-PsBreakpoint`
cmdlets.

```powershell
PS C:\ps-test> Get-PSBreakpoint| Remove-PSBreakpoint
PS C:\ps-test> Get-PSBreakpoint | Remove-PSBreakpoint
```

Create a new command breakpoint on the `psversion` function.

```powershell
PS C:\ps-test> Set-PSBreakpoint -command psversion -script test.ps1
PS C:\ps-test> Set-PSBreakpoint -Command psversion -Script test.ps1
```

You can abbreviate this command to:

```powershell
PS C:\ps-test> sbp -c psversion -s test.ps1
PS C:\ps-test> sbp -C psversion -S test.ps1
```

Now, run the script.
Expand Down Expand Up @@ -612,7 +612,7 @@ Windows PowerShell 2.0
Have you run a background job today (start-job)?
Done C:\ps-test\test.ps1
PS C:\ps-test> Get-PSBreakpoint| Remove-PSBreakpoint
PS C:\ps-test> Get-PSBreakpoint | Remove-PSBreakpoint
PS C:\ps-test>
```

Expand All @@ -623,9 +623,9 @@ the action, execution doesn't stop. The backtick (`` ` ``) is the
line-continuation character.

```powershell
PS C:\ps-test> Set-PSBreakpoint -command psversion -script test.ps1 `
-action { add-content "The value of `$scriptName is $scriptName." `
-path action.log}
PS C:\ps-test> Set-PSBreakpoint -Command psversion -Script test.ps1 `
-Action { Add-Content "The value of `$scriptName is $scriptName." `
-Path action.log}
```

You can also add actions that set conditions for the breakpoint. In the
Expand All @@ -634,8 +634,8 @@ policy is set to RemoteSigned, the most restrictive policy that still permits
you to run scripts.

```powershell
PS C:\ps-test> Set-PSBreakpoint -script test.ps1 -command psversion `
-action { if ((Get-ExecutionPolicy) -eq "RemoteSigned") { break }}
PS C:\ps-test> Set-PSBreakpoint -Script test.ps1 -Command psversion `
-Action { if ((Get-ExecutionPolicy) -eq "RemoteSigned") { break }}
```

The `break` keyword in the action directs the debugger to execute the
Expand Down Expand Up @@ -700,7 +700,7 @@ features that you can use to debug scripts and functions.

<!-- link references -->
[01]: /powershell/scripting/dev-cross-plat/vscode/using-vscode#debugging-with-visual-studio-code
[02]: about_prompts.md
[02]: about_Prompts.md
[05]: xref:Microsoft.PowerShell.Utility.Disable-PSBreakpoint
[06]: xref:Microsoft.PowerShell.Utility.Enable-PSBreakpoint
[07]: xref:Microsoft.PowerShell.Utility.Get-PSBreakpoint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ Provides access to the Windows environment variables.

## Detailed description

The PowerShell **Environment** provider lets you get, add, change, clear, and delete environment
variables and values in PowerShell.
The PowerShell **Environment** provider lets you get, add, change, clear, and
delete environment variables and values in PowerShell.

**Environment** variables are dynamically named variables that describe the
environment in which your programs run. Windows and PowerShell use environment
Expand All @@ -42,19 +42,18 @@ have no child items.
The **Environment** provider supports the following cmdlets, which are covered
in this article.

- [Get-Location](xref:Microsoft.PowerShell.Management.Get-Location)
- [Set-Location](xref:Microsoft.PowerShell.Management.Set-Location)
- [Get-Item](xref:Microsoft.PowerShell.Management.Get-Item)
- [New-Item](xref:Microsoft.PowerShell.Management.New-Item)
- [Remove-Item](xref:Microsoft.PowerShell.Management.Remove-Item)
- [Clear-Item](xref:Microsoft.PowerShell.Management.Clear-Item)
- [Get-Location][01]
- [Set-Location][02]
- [Get-Item][03]
- [New-Item][04]
- [Remove-Item][05]
- [Clear-Item][06]

## Types exposed by this provider

Each environment variable is an instance of the
[System.Collections.DictionaryEntry](/dotnet/api/system.collections.dictionaryentry)
class. The name of the variable is the dictionary key. The value of the
environment variable is the dictionary value.
[System.Collections.DictionaryEntry][07] class. The name of the variable is the
dictionary key. The value of the environment variable is the dictionary value.

## Navigating the Environment drive

Expand All @@ -75,10 +74,11 @@ Set-Location C:
```

You can also work with the **Environment** provider from any other PowerShell
drive. To reference an environment variable from another location, use the drive name `Env:` in the path.
drive. To reference an environment variable from another location, use the
drive name `Env:` in the path.

The **Environment** provider also exposes environment variables using a variable
prefix of `$env:`. The following command views the contents of the
The **Environment** provider also exposes environment variables using a
variable prefix of `$env:`. The following command views the contents of the
**ProgramFiles** environment variable. The `$env:` variable prefix can
be used from any PowerShell drive.

Expand All @@ -94,9 +94,8 @@ session for as long as it is active.
> [!NOTE]
> PowerShell uses aliases to allow you a familiar way to work with provider
> paths. Commands such as `dir` and `ls` are now aliases for
> [Get-ChildItem](xref:Microsoft.PowerShell.Management.Get-ChildItem),
> `cd` is an alias for [Set-Location](xref:Microsoft.PowerShell.Management.Set-Location). and `pwd` is
> an alias for [Get-Location](xref:Microsoft.PowerShell.Management.Get-Location).
> [Get-ChildItem][08], `cd` is an alias for [Set-Location][02] and `pwd` is
> an alias for [Get-Location][01].
## Getting environment variables

Expand Down Expand Up @@ -203,8 +202,8 @@ Beginning in Windows PowerShell 3.0, you can get customized help topics for
provider cmdlets that explain how those cmdlets behave in a file system drive.

To get the help topics that are customized for the file system drive, run a
[Get-Help](xref:Microsoft.PowerShell.Core.Get-Help) command in a file system drive or use the `-Path`
parameter of [Get-Help](xref:Microsoft.PowerShell.Core.Get-Help) to specify a file system drive.
[Get-Help][09] command in a file system drive or use the `-Path` parameter of
[Get-Help][09] to specify a file system drive.

```powershell
Get-Help Get-ChildItem
Expand All @@ -216,4 +215,16 @@ Get-Help Get-ChildItem -Path env:

## See also

- [about_Providers](about_Providers.md)
- [about_Providers][10]

<!-- link references -->
[01]: xref:Microsoft.PowerShell.Management.Get-Location
[02]: xref:Microsoft.PowerShell.Management.Set-Location
[03]: xref:Microsoft.PowerShell.Management.Get-Item
[04]: xref:Microsoft.PowerShell.Management.New-Item
[05]: xref:Microsoft.PowerShell.Management.Remove-Item
[06]: xref:Microsoft.PowerShell.Management.Clear-Item
[07]: /dotnet/api/system.collections.dictionaryentry
[08]: xref:Microsoft.PowerShell.Management.Get-ChildItem
[09]: xref:Microsoft.PowerShell.Core.Get-Help
[10]: about_Providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ or `NO_COLOR` environment variables.

- `dumb` - sets `$Host.UI.SupportsVirtualTerminal = $false`
- `xterm-mono` - sets `$PSStyle.OutputRendering = PlainText`
- `xtermm` - sets `$PSStyle.OutputRendering = PlainText`
- `xterm` - sets `$PSStyle.OutputRendering = PlainText`

- `NO_COLOR`

Expand All @@ -563,12 +563,12 @@ or `NO_COLOR` environment variables.
[03]: #powershell-environment-variables
[04]: about_Environment_Provider.md
[05]: about_Execution_Policies.md
[06]: about_preference_variables.md
[07]: about_profiles.md
[06]: about_Preference_Variables.md
[07]: about_Profiles.md
[08]: about_PSModulePath.md
[09]: about_Telemetry.md
[10]: about_Update_Notifications.md
[11]: about_variables.md
[11]: about_Variables.md
[12]: https://no-color.org/
[13]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
[14]: xref:PowerShellGet.Install-Module
Loading

0 comments on commit ebd9e7f

Please sign in to comment.