Skip to content

Commit 8fd908e

Browse files
authored
Markdown and PS Styles (#11782)
1 parent 368eaab commit 8fd908e

18 files changed

+113
-75
lines changed

reference/7.5/Microsoft.PowerShell.Utility/Add-Member.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ The third command uses dot notation to get the value of the **Status** property
8989
`$a`. As the output shows, the value is `Done`.
9090

9191
```powershell
92-
$A = Get-ChildItem c:\ps-test\test.txt
92+
$A = Get-ChildItem C:\ps-test\test.txt
9393
$A | Add-Member -NotePropertyName Status -NotePropertyValue Done
9494
$A.Status
9595
```
@@ -211,25 +211,35 @@ In this example we create a custom object that contains two **NoteProperty** mem
211211
property is a string.
212212

213213
```powershell
214-
PS> $obj = [pscustomobject]@{
215-
Name = 'Doris'
216-
Age = '20'
214+
$user = [pscustomobject]@{
215+
Name = 'Doris'
216+
Age = '20'
217+
}
218+
$addMemberSplat = @{
219+
MemberType = 'AliasProperty'
220+
Name = 'intAge'
221+
Value = 'Age'
222+
SecondValue = 'UInt32'
217223
}
218-
PS> $obj | Add-Member -MemberType AliasProperty -Name 'intAge' -Value age -SecondValue uint32
219-
PS> $obj | Get-Member
224+
$user | Add-Member @addMemberSplat
225+
$user | Get-Member
226+
```
220227

228+
```Output
221229
TypeName: System.Management.Automation.PSCustomObject
222230
223231
Name MemberType Definition
224232
---- ---------- ----------
225-
intAge AliasProperty intAge = (System.UInt32)age
233+
intAge AliasProperty intAge = (System.UInt32)Age
226234
Equals Method bool Equals(System.Object obj)
227235
GetHashCode Method int GetHashCode()
228236
GetType Method type GetType()
229237
ToString Method string ToString()
230238
Age NoteProperty string Age=20
231239
Name NoteProperty string Name=Doris
240+
```
232241

242+
```powershell
233243
PS> $obj
234244
235245
Name Age intAge
@@ -561,7 +571,7 @@ Accept wildcard characters: False
561571
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
562572
-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose,
563573
-WarningAction, and -WarningVariable. For more information, see
564-
[about_CommonParameters](../Microsoft.PowerShell.Core/About/about_CommonParameters.md).
574+
[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
565575

566576
## INPUTS
567577

@@ -611,4 +621,4 @@ methods are being added. For more information about the `$this` variable, see
611621

612622
[about_Automatic_Variables](../Microsoft.PowerShell.Core/About/about_Automatic_Variables.md)
613623

614-
[System.Type.GetMethod()](/dotnet/api/system.type.getmethod)
624+
[System.Type.GetMethod()](xref:System.Type.GetMethod%2a)

reference/7.5/Microsoft.PowerShell.Utility/Add-Type.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ Adds a Microsoft .NET class to a PowerShell session.
1818
### FromSource (Default)
1919

2020
```
21-
Add-Type [-TypeDefinition] <String> [-Language <Language>] [-ReferencedAssemblies <String[]>]
22-
[-OutputAssembly <String>] [-OutputType <OutputAssemblyType>] [-PassThru] [-IgnoreWarnings]
21+
Add-Type [-TypeDefinition] <String> [-Language <Language>]
22+
[-ReferencedAssemblies <String[]>] [-OutputAssembly <String>]
23+
[-OutputType <OutputAssemblyType>] [-PassThru] [-IgnoreWarnings]
2324
[-CompilerOptions <String[]>] [<CommonParameters>]
2425
```
2526

@@ -28,24 +29,24 @@ Add-Type [-TypeDefinition] <String> [-Language <Language>] [-ReferencedAssemblie
2829
```
2930
Add-Type [-Name] <String> [-MemberDefinition] <String[]> [-Namespace <String>]
3031
[-UsingNamespace <String[]>] [-Language <Language>] [-ReferencedAssemblies <String[]>]
31-
[-OutputAssembly <String>] [-OutputType <OutputAssemblyType>] [-PassThru] [-IgnoreWarnings]
32-
[-CompilerOptions <String[]>] [<CommonParameters>]
32+
[-OutputAssembly <String>] [-OutputType <OutputAssemblyType>] [-PassThru]
33+
[-IgnoreWarnings] [-CompilerOptions <String[]>] [<CommonParameters>]
3334
```
3435

3536
### FromPath
3637

3738
```
3839
Add-Type [-Path] <String[]> [-ReferencedAssemblies <String[]>] [-OutputAssembly <String>]
39-
[-OutputType <OutputAssemblyType>] [-PassThru] [-IgnoreWarnings] [-CompilerOptions <String[]>]
40-
[<CommonParameters>]
40+
[-OutputType <OutputAssemblyType>] [-PassThru] [-IgnoreWarnings]
41+
[-CompilerOptions <String[]>] [<CommonParameters>]
4142
```
4243

4344
### FromLiteralPath
4445

4546
```
46-
Add-Type -LiteralPath <String[]> [-ReferencedAssemblies <String[]>] [-OutputAssembly <String>]
47-
[-OutputType <OutputAssemblyType>] [-PassThru] [-IgnoreWarnings] [-CompilerOptions <String[]>]
48-
[<CommonParameters>]
47+
Add-Type -LiteralPath <String[]> [-ReferencedAssemblies <String[]>]
48+
[-OutputAssembly <String>] [-OutputType <OutputAssemblyType>] [-PassThru]
49+
[-IgnoreWarnings] [-CompilerOptions <String[]>] [<CommonParameters>]
4950
```
5051

5152
### FromAssemblyName
@@ -451,7 +452,7 @@ Accept wildcard characters: True
451452
Specifies the output type of the output assembly. By default, no output type is specified. This
452453
parameter is valid only when an output assembly is specified in the command. For more information
453454
about the values, see
454-
[OutputAssemblyType Enumeration](/dotnet/api/microsoft.powershell.commands.outputassemblytype).
455+
[OutputAssemblyType Enumeration](xref:Microsoft.PowerShell.Commands.OutputAssemblyType).
455456

456457
The acceptable values for this parameter are as follows:
457458

@@ -541,7 +542,7 @@ Accept wildcard characters: False
541542

542543
Specifies the source code that contains the type definitions. Enter the source code in a string or
543544
here-string, or enter a variable that contains the source code. For more information about
544-
here-strings, see [about_Quoting_Rules](../Microsoft.PowerShell.Core/about/about_Quoting_Rules.md).
545+
here-strings, see [about_Quoting_Rules](../Microsoft.PowerShell.Core/About/about_Quoting_Rules.md).
545546

546547
Include a namespace declaration in your type definition. If you omit the namespace declaration, your
547548
type might have the same name as another type or the shortcut for another type, causing an
@@ -628,15 +629,15 @@ arbitrary path requires `Add-Type`, since those assemblies can't not be loaded a
628629

629630
## RELATED LINKS
630631

631-
[about_Profiles](../Microsoft.PowerShell.Core/About/about_profiles.md)
632+
[about_Profiles](../Microsoft.PowerShell.Core/About/about_Profiles.md)
632633

633634
[about_Quoting_Rules](../Microsoft.PowerShell.Core/About/about_Quoting_Rules.md)
634635

635636
[Add-Member](Add-Member.md)
636637

637638
[New-Object](New-Object.md)
638639

639-
[OutputAssemblyType](/dotnet/api/microsoft.powershell.commands.outputassemblytype)
640+
[OutputAssemblyType](xref:Microsoft.PowerShell.Commands.OutputAssemblyType)
640641

641642
[Platform Invoke (P/Invoke)](/dotnet/standard/native-interop/pinvoke)
642643

reference/7.5/Microsoft.PowerShell.Utility/Clear-Variable.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Deletes the value of a variable.
1616
## SYNTAX
1717

1818
```
19-
Clear-Variable [-Name] <String[]> [-Include <String[]>] [-Exclude <String[]>] [-Force] [-PassThru]
20-
[-Scope <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
19+
Clear-Variable [-Name] <String[]> [-Include <String[]>] [-Exclude <String[]>] [-Force]
20+
[-PassThru] [-Scope <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
2121
```
2222

2323
## DESCRIPTION
@@ -39,7 +39,7 @@ This command removes the value of global variables that have names that begin wi
3939
### Example 2: Clear a variable in a child scope but not the parent scope
4040

4141
```powershell
42-
$a=3
42+
$a = 3
4343
&{ Clear-Variable a }
4444
$a
4545
```
@@ -163,7 +163,8 @@ The acceptable values for this parameter are:
163163
- `Script`
164164

165165
You can also use a number relative to the current scope (0 through the number of scopes, where 0 is
166-
the current scope and 1 is its parent). Local is the default. For more information, see [about_Scopes](../Microsoft.PowerShell.Core/About/about_Scopes.md).
166+
the current scope and 1 is its parent). Local is the default. For more information, see
167+
[about_Scopes](../Microsoft.PowerShell.Core/About/about_Scopes.md).
167168

168169
```yaml
169170
Type: System.String
@@ -213,7 +214,8 @@ Accept wildcard characters: False
213214

214215
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
215216
-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose,
216-
-WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
217+
-WarningAction, and -WarningVariable. For more information, see
218+
[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
217219

218220
## INPUTS
219221

reference/7.5/Microsoft.PowerShell.Utility/Compare-Object.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ Compares two sets of objects.
1717

1818
```
1919
Compare-Object [-ReferenceObject] <PSObject[]> [-DifferenceObject] <PSObject[]>
20-
[-SyncWindow <Int32>] [-Property <Object[]>] [-ExcludeDifferent] [-IncludeEqual] [-PassThru]
21-
[-Culture <String>] [-CaseSensitive] [<CommonParameters>]
20+
[-SyncWindow <Int32>] [-Property <Object[]>] [-ExcludeDifferent] [-IncludeEqual]
21+
[-PassThru] [-Culture <String>] [-CaseSensitive] [<CommonParameters>]
2222
```
2323

2424
## DESCRIPTION
@@ -56,7 +56,11 @@ The output displays only the lines that are different between the files. `Testfi
5656
content that appear in both files aren't displayed.
5757

5858
```powershell
59-
Compare-Object -ReferenceObject (Get-Content -Path C:\Test\Testfile1.txt) -DifferenceObject (Get-Content -Path C:\Test\Testfile2.txt)
59+
$objects = @{
60+
ReferenceObject = (Get-Content -Path C:\Test\Testfile1.txt)
61+
DifferenceObject = (Get-Content -Path C:\Test\Testfile2.txt)
62+
}
63+
Compare-Object @objects
6064
```
6165

6266
```Output
@@ -174,7 +178,12 @@ output displayed by the default format for **System.Boolean** objects didn't dis
174178
In this example, we compare two different string that have the same length.
175179

176180
```powershell
177-
Compare-Object -ReferenceObject 'abc' -DifferenceObject 'xyz' -Property Length -IncludeEqual
181+
$objects = @{
182+
ReferenceObject = 'abc'
183+
DifferenceObject = 'xyz'
184+
Property = 'Length'
185+
}
186+
Compare-Object @objects -IncludeEqual
178187
```
179188

180189
```Output

reference/7.5/Microsoft.PowerShell.Utility/ConvertFrom-Csv.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ ConvertFrom-Csv [[-Delimiter] <Char>] [-InputObject] <PSObject[]> [-Header <Stri
2525
### UseCulture
2626

2727
```
28-
ConvertFrom-Csv -UseCulture [-InputObject] <PSObject[]> [-Header <String[]>] [<CommonParameters>]
28+
ConvertFrom-Csv -UseCulture [-InputObject] <PSObject[]> [-Header <String[]>]
29+
[<CommonParameters>]
2930
```
3031

3132
## DESCRIPTION
@@ -89,7 +90,7 @@ $Header = 'State', 'MoreData', 'StatusMessage', 'Location', 'Command',
8990
'BeginTime', 'EndTime', 'JobType', 'Output', 'Error', 'Progress',
9091
'Verbose', 'Debug', 'Warning', 'Information'
9192
# Delete the default header from $J
92-
$J = $J[1..($J.count - 1)]
93+
$J = $J[1..($J.Count - 1)]
9394
$J | ConvertFrom-Csv -Header $Header
9495
```
9596

reference/7.5/Microsoft.PowerShell.Utility/ConvertFrom-Json.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Converts a JSON-formatted string to a custom object or a hash table.
1616
## SYNTAX
1717

1818
```
19-
ConvertFrom-Json [-InputObject] <String> [-AsHashtable] [-DateKind <JsonDateKind>] [-Depth <Int32>]
20-
[-NoEnumerate] [<CommonParameters>]
19+
ConvertFrom-Json [-InputObject] <String> [-AsHashtable] [-DateKind <JsonDateKind>]
20+
[-Depth <Int32>] [-NoEnumerate] [<CommonParameters>]
2121
```
2222

2323
## DESCRIPTION
@@ -91,7 +91,8 @@ that can be managed in PowerShell.
9191
```powershell
9292
# Ensures that Invoke-WebRequest uses TLS 1.2
9393
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
94-
$j = Invoke-WebRequest 'https://api.github.com/repos/PowerShell/PowerShell/issues' | ConvertFrom-Json
94+
$j = Invoke-WebRequest 'https://api.github.com/repos/PowerShell/PowerShell/issues' |
95+
ConvertFrom-Json
9596
```
9697

9798
You can also use the `Invoke-RestMethod` cmdlet, which automatically converts JSON content to
@@ -128,8 +129,10 @@ This command shows an example where the `-NoEnumerate` switch is used to round-t
128129
JSON array.
129130

130131
```powershell
131-
Write-Output "With -NoEnumerate: $('[1]' | ConvertFrom-Json -NoEnumerate | ConvertTo-Json -Compress)"
132-
Write-Output "Without -NoEnumerate: $('[1]' | ConvertFrom-Json | ConvertTo-Json -Compress)"
132+
Write-Output "With -NoEnumerate: $('[1]' | ConvertFrom-Json -NoEnumerate |
133+
ConvertTo-Json -Compress)"
134+
Write-Output "Without -NoEnumerate: $('[1]' | ConvertFrom-Json |
135+
ConvertTo-Json -Compress)"
133136
```
134137

135138
```Output

reference/7.5/Microsoft.PowerShell.Utility/ConvertFrom-Markdown.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ title: ConvertFrom-Markdown
1111
# ConvertFrom-Markdown
1212

1313
## SYNOPSIS
14-
Convert the contents of a string or a file to a **MarkdownInfo**
15-
object.
14+
Convert the contents of a string or a file to a **MarkdownInfo** object.
1615

1716
## SYNTAX
1817

@@ -161,7 +160,8 @@ Accept wildcard characters: True
161160
162161
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
163162
-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose,
164-
-WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
163+
-WarningAction, and -WarningVariable. For more information, see
164+
[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
165165
166166
## INPUTS
167167

reference/7.5/Microsoft.PowerShell.Utility/ConvertFrom-SddlString.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ Converts a SDDL string to a custom object.
1818
### All
1919

2020
```
21-
ConvertFrom-SddlString [-Sddl] <String> [-Type <AccessRightTypeNames>] [<CommonParameters>]
21+
ConvertFrom-SddlString [-Sddl] <String> [-Type <AccessRightTypeNames>]
22+
[<CommonParameters>]
2223
```
2324

2425
## DESCRIPTION
@@ -57,7 +58,7 @@ ConvertFrom-SddlString -Sddl $acl.Sddl -Type RegistryRights
5758
```
5859

5960
The first command uses the `Get-Acl` cmdlet to get the security descriptor for the
60-
HKLM:\SOFTWARE\Microsoft\ key and saves it in the variable.
61+
`HKLM:\SOFTWARE\Microsoft\` key and saves it in the variable.
6162

6263
The second command uses the `ConvertFrom-SddlString` cmdlet to get the text representation of the
6364
SDDL string, contained in the Sddl property of the object representing the security descriptor.
@@ -70,16 +71,22 @@ It uses the `-Type` parameter to specify that SDDL string represents a registry
7071
$acl = Get-Acl -Path HKLM:\SOFTWARE\Microsoft\
7172
7273
ConvertFrom-SddlString -Sddl $acl.Sddl | Foreach-Object {$_.DiscretionaryAcl[0]}
74+
```
7375

76+
```Output
7477
BUILTIN\Administrators: AccessAllowed (ChangePermissions, CreateDirectories, Delete, ExecuteKey, FullControl, GenericExecute, GenericWrite, ListDirectory, ReadExtendedAttributes, ReadPermissions, TakeOwnership, Traverse, WriteData, WriteExtendedAttributes, WriteKey)
78+
```
7579

80+
```powershell
7681
ConvertFrom-SddlString -Sddl $acl.Sddl -Type RegistryRights | Foreach-Object {$_.DiscretionaryAcl[0]}
82+
```
7783

84+
```Output
7885
BUILTIN\Administrators: AccessAllowed (ChangePermissions, CreateLink, CreateSubKey, Delete, EnumerateSubKeys, ExecuteKey, FullControl, GenericExecute, GenericWrite, Notify, QueryValues, ReadPermissions, SetValue, TakeOwnership, WriteKey)
7986
```
8087

8188
The first command uses the `Get-Acl` cmdlet to get the security descriptor for the
82-
HKLM:\SOFTWARE\Microsoft\ key and saves it in the variable.
89+
`HKLM:\SOFTWARE\Microsoft\` key and saves it in the variable.
8390

8491
The second command uses the `ConvertFrom-SddlString` cmdlet to get the text representation of the
8592
SDDL string, contained in the Sddl property of the object representing the security descriptor.

reference/7.5/Microsoft.PowerShell.Utility/ConvertFrom-StringData.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ string must conform to the rules for a **DATA** section. For more information, s
3434
`ConvertFrom-StringData` supports escape character sequences that are allowed by conventional
3535
machine translation tools. That is, the cmdlet can interpret backslashes (`\`) as escape characters
3636
in the string data by using the
37-
[Regex.Unescape Method](/dotnet/api/system.text.regularexpressions.regex.unescape), instead of the
37+
[Regex.Unescape Method](xref:System.Text.RegularExpressions.Regex.Unescape%2a), instead of the
3838
PowerShell backtick character (`` ` ``) that would normally signal the end of a line in a script.
3939
Inside the here-string, the backtick character doesn't work. You can also preserve a literal
4040
backslash in your results by escaping it with a preceding backslash, like this: `\\`. Unescaped
@@ -288,7 +288,7 @@ Accept wildcard characters: False
288288
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
289289
-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose,
290290
-WarningAction, and -WarningVariable. For more information, see
291-
[about_CommonParameters](../Microsoft.PowerShell.Core/About/about_CommonParameters.md).
291+
[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
292292

293293
## INPUTS
294294

reference/7.5/Microsoft.PowerShell.Utility/ConvertTo-Csv.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ ConvertTo-Csv [-InputObject] <PSObject> [[-Delimiter] <Char>] [-IncludeTypeInfor
2626
### UseCulture
2727

2828
```
29-
ConvertTo-Csv [-InputObject] <PSObject> [-UseCulture] [-IncludeTypeInformation] [-NoTypeInformation]
30-
[-QuoteFields <String[]>] [-UseQuotes <QuoteKind>] [-NoHeader] [<CommonParameters>]
29+
ConvertTo-Csv [-InputObject] <PSObject> [-UseCulture] [-IncludeTypeInformation]
30+
[-NoTypeInformation] [-QuoteFields <String[]>] [-UseQuotes <QuoteKind>] [-NoHeader]
31+
[<CommonParameters>]
3132
```
3233

3334
## DESCRIPTION
@@ -89,7 +90,8 @@ This example converts the Windows event log for PowerShell to a series of CSV st
8990

9091
```powershell
9192
(Get-Culture).TextInfo.ListSeparator
92-
Get-WinEvent -LogName 'PowerShellCore/Operational' | ConvertTo-Csv -UseCulture -NoTypeInformation
93+
Get-WinEvent -LogName 'PowerShellCore/Operational' |
94+
ConvertTo-Csv -UseCulture -NoTypeInformation
9395
```
9496

9597
```Output

0 commit comments

Comments
 (0)