| external help file | Module Name | online version | schema |
|---|---|---|---|
PSTextMate.dll-Help.xml |
TextMate |
2.0.0 |
Renders PowerShell code using TextMate grammars and returns a PSTextMate.Core.HighlightedText result for display or programmatic use.
Format-PowerShell [-InputObject] <psobject> [-Theme <ThemeName>] [-LineNumbers] [<CommonParameters>]
This cmdlet has the following aliases, fps
Format-PowerShell highlights PowerShell source and script files. Input can be provided as pipeline text or via file contents. The resulting HighlightedText can be used with console renderers or further processed. Use -Theme and -LineNumbers to adjust output.
'Get-Process | Where-Object { $_.CPU -gt 1 }' | Format-PowerShell
Get-Content .\scripts\deploy.ps1 -Raw | Format-PowerShell -LineNumbers
Get-ChildItem .\scripts\*.ps1 | Format-PowerShell -Theme Monokai
Accepts a string or object containing PowerShell source text.
Typically used with Get-Content -Raw or piping literal strings.
Accepts FileInfo objects
Type: PSObject
DefaultValue: ''
SupportsWildcards: false
Aliases:
- FullName
- Path
ParameterSets:
- Name: (All)
Position: 0
IsRequired: true
ValueFromPipeline: true
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''When present, include line numbers in the rendered output.
Type: SwitchParameter
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''Chooses a TextMateSharp.Grammars.ThemeName for styling the highlighted output.
Type: TextMateSharp.Grammars.ThemeName
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Accepts textual input representing PowerShell source.
Returns the highlighted representation of the input source as a HighlightedText object.
The cmdlet uses the PowerShell grammar shipped with the module. For very large scripts consider chunking input to avoid high memory usage.
See Format-CSharp and Format-Markdown for other language renderers.