Write-ConsoleMarkup
Writes Spectre-compatible markup as styled text.
Syntax
Write-ConsoleMarkup [-NoNewLine] [-Text] <String> [<CommonParameters>]#All Parameter SetsDescription
Writes Spectre-compatible markup as styled text.
Supports [bold], [italic], [underline], the 256-colour palette names ([red], [cadetblue], [grey50], [deepskyblue3]; in markup [darkred] is the palette colour, [console.darkred] the ConsoleColor as Write-Host shows it), [#ff8800], [rgb(1,2,3)], [white on navy], links ([link=https://example.com]text[/] or [link]https://example.com[/], clickable in Windows Terminal and VS Code) and theme tokens ([pass], [fail], [warn], [muted], [accent]). Escape brackets by doubling them ([[ and ]]) or with [ConsoleMonster.Text.Markup]::Escape($value). A tag that is not a known style is removed and its text kept when a [/] closes it; an unclosed unknown tag stays literal. Colours degrade to 256 or 16 colours, or none, as the terminal requires.
Examples
EXAMPLE 1
Write-ConsoleMarkup -Text 'Value'Parameters
- -NoNewLine SwitchParameter
- Leaves the line open, as Write-Host -NoNewline does. Redirected output still gets plain text.
- -Text String
- The markup.
Common Parameters
This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
For more information, see about_CommonParameters.