You might want to insert formatted and colored code syntax (the colorized and formatted script code is easier to read on Web pages and stands out a lot more). This will help readers understand the syntax faster when they read it.
Inserting code into the Wiki-editor can be a little tricky if you want Windows PowerShell code syntax formatting. This article assumes that you are using Windows PowerShell ISE (that is a part of PowerShell V2) or PowerGUI Script Editor from Quest Software.
##################################################################### # Test-Me.ps1 # Version 0.63 # # This script just tests something # ##################################################################### #requires -Version 2.0 function Test-Me { [CmdletBinding()] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, Position = 0)] [string]$Argument ) Write-Host "You have passed the following argument to me:" Write-Host $Argument }
This article is also available in other languages
Before I learned how to do this, I would want to know WHY I would want to do this. Any insight?
I believe that colorized and formatted script code is more readable on web pages, rather unformatted and uncolored code.
Thanks for adding that info!
Useful information.
Do you know if such a method can be used for any other kind of script snippets?
> Do you know if such a method can be used for any other kind of script snippets?
if you are using one of these script editors — yes.
As a techie, I appreciate options when it comes to stuff like this, but I gotta say, the PowerGUI code coloring scheme just doesn't look right to me after using the PSISE for so long. As a standard, I would recommend anyone looking to post colored code to use the PowerShell ISE from Microsoft.
Good Article.