Share via


Show-Markdown

Shows a Markdown file or string in the console in a friendly way using VT100 escape sequences or in a browser using HTML.

Syntax

Show-Markdown
    [-Path] <String[]>
    [-UseBrowser]
    [<CommonParameters>]
Show-Markdown
    -InputObject <PSObject>
    [-UseBrowser]
    [<CommonParameters>]
Show-Markdown
    -LiteralPath <String[]>
    [-UseBrowser]
    [<CommonParameters>]

Description

The Show-Markdown cmdlet is used to render Markdown in a human readable format either in a terminal or in a browser.

Show-Markdown can return a string that includes the VT100 escape sequences which the terminal renders (if it supports VT100 escape sequences). This is primarily used for viewing Markdown files in a terminal. You can also get this string via the ConvertFrom-Markdown by specifying the AsVT100EncodedString parameter.

Show-Markdown also has the ability to open a browser and show you a rendered version of the Markdown. It renders the Markdown by turning it into HTML and opening the HTML file in your default browser.

You can change how Show-Markdown renders Markdown in a terminal by using Set-MarkdownOption.

This cmdlet was introduced in PowerShell 6.1.

Examples

Example 1: Simple example specifying a path

Show-Markdown -Path ./README.md

Example 2: Simple example specifying a string

@"
# Show-Markdown

## Markdown

You can now interact with Markdown via PowerShell!

*stars*
__underlines__
"@ | Show-Markdown

Example 2: Opening Markdown in a browser

Show-Markdown -Path ./README.md -UseBrowser

Parameters

-InputObject

A Markdown string that will be shown in the terminal. If you do not pass in a supported format, Show-Markdown will emit an error.

Type:PSObject
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-LiteralPath

Specifies the path to a Markdown file. Unlike the Path parameter, the value of LiteralPath is used exactly as it is typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell PowerShell not to interpret any characters as escape sequences.

Type:String[]
Aliases:PSPath, LP
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Path

Specifies the path to a Markdown file to be rendered.

Type:String[]
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:True

-UseBrowser

Compiles the Markdown input as HTML and opens it in your default browser.

Type:SwitchParameter
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

PSObject

String[]

Outputs

String