Created
May 26, 2016 16:55
-
-
Save cdhunt/04372211e2f0f06045583ebbccb606c0 to your computer and use it in GitHub Desktop.
Use the Markdown.types.ps1xml to generate a help file in Markdown
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$help = Get-Help Get-Location | |
$help.Name.MarkdownHeader() | |
"Synopsis".MarkdownHeader(2) | |
$help.Synopsis | |
"Description".MarkdownHeader(2) | |
$help.description.text | |
"Syntax".MarkdownHeader(2) | |
$help.syntax | Foreach { | |
($help.syntax | out-string )-split "`n" | foreach {"$_ <br />".MarkdownQuote()} | |
} | |
"Parameters".MarkdownHeader(2) | |
$help.parameters.parameter | foreach { | |
$_.name.MarkdownHeader(3) | |
$_.description | |
if ($_.aliases) | |
{ | |
"Aliases".MarkdownHeader(4) | |
$_.aliases | foreach {$_.MarkdownUL()} | |
} | |
} | |
"Examples".MarkdownHeader(2) | |
$i = 1 | |
$help.examples.example | foreach { | |
"Example $i".MarkdownHeader(3) | |
$_.code.MarkdownCodeBlock("powershell") | |
$_.remarks | |
$i++ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment