Get-MtSafeMarkdown
SYNOPSIS
Escapes text to be safe to use in markdown.
SYNTAX
Get-MtSafeMarkdown [[-Text] <String>] [-ProgressAction <ActionPreference>] [<CommonParameters>]
DESCRIPTION
Escapes text to be safe to use in markdown.
Use this for any value that comes from the tenant (display names, app names, policy names, etc.)
before inserting it into test result markdown.
Without it, a value such as an app registration
named '
' or 'Sign in again' would be
rendered by the report as a remote image or a clickable link, and a '|' would break table layout.
Characters with meaning in markdown are backslash-escaped and line breaks are replaced with spaces, so the value is displayed exactly as entered.
EXAMPLES
EXAMPLE 1
Get-MtSafeMarkdown -Text $tenantName
Converts the content of $tenantName into something safe to use in markdown.
EXAMPLE 2
"| [$(Get-MtSafeMarkdown $app.displayName)]($portalLink) |"
Uses a tenant-controlled app name as link text in a markdown table row.
PARAMETERS
-Text
The text to escape
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ProgressAction
Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by Write-Progress.
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.