Helper for building markdown docs from PowerShell Command Help.
powershellgallery.com/packages/Build-Docs
Install-Module -Name Build-Docs or Install-PSResource -Name Build-Docs
This module will walk the properties and help for each command in a given module and add a .ToMD() ScriptMethod that applies some opinionated markdown formatting.
The is entirely based on the output of Get-Help so the help data can be XML-based or comment-based.
This module adds the .ToMD() method to the following command help properties.
Only properties that are defined are rendered into markdown so you won't have a bunch of empty sections if not defined.
DescriptionParameterSet(each): Adds an H3 header for each parameter set which contains a unordered list of parameters.Example(each): All of the text before an empty newline is considered part of the code and will be fenced in a code block. Text after an empty newline is considered the Remarks.Link(each): Format as a HREF link. If the link text is an existing command in the module it will link to{commandname}.md.NoteOutput
This is the basic snippet I use in my build.ps1 scripts to generate all the files under /docs.
$help=Get-HelpModuleData$module# docs/README.md$help|New-HelpDoc|Add-ModuleProperty Name -H1 |Add-ModuleProperty Description |Add-HelpDocText"Commands"-H2 |Add-ModuleCommand-AsLinks |Out-HelpDoc-Path 'docs/README.md'# Individual Commandsforeach ($commandin$help.Commands) {
$name=$command.Name$doc=New-HelpDoc-HelpModuleData $help$doc.Text=$command.ToMD()
$doc|Out-HelpDoc-Path "docs/$name.md"
}