Edit

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

Path (Default)

Show-Markdown
    [-Path] <String[]>
    [-UseBrowser]
    [<CommonParameters>]

InputObject

Show-Markdown
    -InputObject <PSObject>
    [-UseBrowser]
    [<CommonParameters>]

LiteralPath

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.

Parameter properties

Type:PSObject
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

InputObject
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments: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.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False
Aliases:PSPath, LP

Parameter sets

LiteralPath
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Path

Specifies the path to a Markdown file to be rendered.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:True
DontShow:False

Parameter sets

Path
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-UseBrowser

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

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

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

Inputs

PSObject

String

Outputs

String