Syntax highlighting, rich Markdown and a built-in pager for PowerShell. Read source files in your terminal, choose a theme, or embed highlighted output in Spectre and Fullscreen applications.
- TextMate grammars for PowerShell, C#, Python, YAML, TOML and many more languages.
- Markdown with tables, links, highlighted code blocks and terminal images.
- An interactive pager with search, streaming output and resize support.
- Built-in text and HTML output, plus optional native Spectre and Fullscreen output.
Requires PowerShell 7.6 or newer. Works on Windows, Linux and macOS.
Install-Module TextMate
Import-Module TextMate# Highlight a file, with its language inferred from the extension.
Format-TextMate ./script.ps1 -LineNumbers
# Highlight a snippet with a theme.
'public class Demo { }' | Format-CSharp -Theme SolarizedLight
# Read Markdown in the pager.
Format-Markdown ./README.md -Page
# Highlight Markdown source instead of rendering it.
Format-Markdown ./README.md -Alternate
# Page ordinary PowerShell output too.
Get-Process | Out-PageNormal output needs no other PowerShell module. Image support depends on your terminal; some formats use the optional Sixel module. See the usage guide for images, output formats and custom themes.
| Cmdlet | Purpose |
|---|---|
| Format-TextMate | Highlight a file or snippet. |
| Format-CSharp | Highlight C# source. |
| Format-PowerShell | Highlight PowerShell source. |
| Format-Markdown | Render Markdown or highlight its source. |
| Out-Page | Browse output in the terminal pager. |
| Get-TextMateGrammar | Discover languages and file extensions. |
| Test-TextMate | Check language or file support. |
| Add-TextMateLanguage | Register a custom grammar. |
| Add-TextMateTheme | Register a custom theme. |
- Usage: files, Markdown images, paging, output formats and custom grammars/themes.
- Embedding: native application output, document APIs, composition and streaming.
- Building and contributing: source builds, validation and project structure.
Format cmdlets now return a HighlightedDocument and display without a UI module. If you pass their results into PwshSpectreConsole, request -OutputFormat Spectre or convert with .ToSpectre(). See migration examples.
