Skip to content

Get-SpectreEscapedText

Description

This function escapes text for use where Spectre Console accepts markup. It is intended to be used as a helper function for other functions that output text to the console using Spectre Console which contains special characters that need escaping. See https://spectreconsole.net/markup for more information about the markup language used in Spectre Console.


Examples

Example 1
This example demonstrates how to escape text for use in Spectre Console.

$data = "][[][red]]][[/][][]["
Format-SpectrePanel -Title "Unescaped data" -Data "I want escaped $($data | Get-SpectreEscapedText) [yellow]and[/] [red]unescaped[/] data"

Parameters

Text

The text to be escaped.

TypeRequiredPositionPipelineInput
[String]true1true (ByValue)

Syntax

Get-SpectreEscapedText [-Text] <String> [<CommonParameters>]