| external help file | PSTextMate.dll-Help.xml |
|---|---|
| Module Name | TextMate |
| online version | https://github.com/trackd/TextMate/blob/main/docs/en-us |
| schema | 2.0.0 |
Displays syntax-highlighted text using TextMate grammars. Accepts strings or file input and returns a HighlightedText object for rendering.
Format-TextMate [-InputObject] <psobject> [-Language <string>] [-Alternate] [-Theme <ThemeName>]
[-LineNumbers] [<CommonParameters>]
This cmdlet has the following aliases, ftm, Show-TextMate
Format-TextMate renders textual input using an appropriate TextMate grammar.
When -Language is provided it forces that language;
when omitted the cmdlet may infer language from file extension or default to powershell.
Use -Alternate to force the standard renderer for Markdown files.
Example: highlight a snippet with an explicit language
"print('hello')" | Format-TextMate -Language python
Example: render a file and let the cmdlet infer language from extension
Format-TextMate -InputObject (Get-Content scripts\deploy.ps1 -Raw)
Example: preview a Markdown file
Get-Content README.md -Raw | Format-TextMate -Theme SolarizedDark
Forces the standard (non-markdown-specialized) renderer. Useful for previewing how code blocks will appear under the generic renderer.
Type: SwitchParameter
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''Accepts a string or object containing textual content.
Use Get-Content -Raw to pass file contents.
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: ''Hint to force a particular TextMate language ID (for example powershell, csharp, python).
When provided it overrides extension-based inference.
Type: String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''Include line numbers in the output when specified.
Type: SwitchParameter
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''Select a TextMateSharp.Grammars.ThemeName used for styling 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 or objects containing text; commonly used with Get-Content -Raw or pipeline strings or FileInfo objects.
Returns a HighlightedText object representing the rendered tokens and styling metadata.
If language cannot be inferred and -Language is not provided, the cmdlet defaults to powershell for string input. Use -Language to override detection.
See Get-SupportedTextMate to discover available language IDs and Format-* cmdlets for language-specific formatting.