Code Formatting Testing

In an effort to try and improve the code formatter, I’m using this thread to test samples folks send me. If you choose to post here, it’d help if I knew what browser you were trying to use, and if you pasted a plain-text (unformatted) copy of your script.

$tableAsString = $disks | ft @{Name=’Drive’;Expression={$.DeviceId}},@{Name=’Size(GB)’;Expression={‘{0:N2}’ -f ($.Size / 1GB)}} -AutoSize | Out-String

$tableAsString -replace ‘^\s+|\s+$’ -split “rn|r|n” | Select-Object -Skip 2

$tableAsString = $disks | ft @{Name=’Drive’;Expression={$_.DeviceId}},@{Name=’Size(GB)’;Expression={‘{0:N2}’ -f ($_.Size / 1GB)}} -AutoSize | Out-String

$tableAsString -replace ‘^\s+|\s+$’ -split “rn|r|n” | Select-Object -Skip 2

 

This is text

Write-Host “This is <code>r</code>n code”

Get-Service `

$services[0].that

[string[]]

 

Write-Host "This `n is code"
Get-Service `
$services[0].that
[string[]]

[sourcecode language=“powershell”]

Write-Host "This n is code" Get-Service
$services[0].that
[string[]]

[/sourcecode]

[sourcecode language=powershell]

backtick backtick`
nothing

[/sourcecode]

Get-Host "back`tick`y"
Do-Those
Then-These `
Or-That