Skip to content
Sponsor
3.0 preview2.3.0 stable

These docs describe the preview. Pick the version you run and every page marks what it doesn't have yet. Get the preview →
Maester 2.x docs (archived) →

Get-MtSafeMarkdown

Escapes text to be safe to use in markdown.

Get-MtSafeMarkdown [[-Text] <String>] [-ProgressAction <ActionPreference>] [<CommonParameters>]

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 'x' 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 so are the ones that make GFM turn text into a link on its own: a bare ‘https://host’, ‘ftp://host’, ‘www.host’, ‘a@b’ or ‘mailto:a@b’ is an autolink literal, not markdown syntax, and the report renders with ‘gfm: true’. Line breaks are replaced with spaces. Every backslash added here is consumed by the renderer, so the value is displayed exactly as entered.

Get-MtSafeMarkdown -Text $tenantName

Converts the content of $tenantName into something safe to use in markdown.

"| [$(Get-MtSafeMarkdown $app.displayName)]($portalLink) |"

Uses a tenant-controlled app name as link text in a markdown table row.

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

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

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

https://maester.dev/docs/commands/Get-MtSafeMarkdown