Markdown Cmdlets
Edit on GitHubPSWriteOffice cmdlets and DSL aliases for generating Markdown files from PowerShell.
Markdown Cmdlets
PSWriteOffice includes a Markdown surface for generating reports, READMEs, changelogs, and automation output from PowerShell. The cmdlets are especially useful when you already have structured objects in a script and want clean Markdown without hand-building strings.
Core workflow
- Start a document with
New-OfficeMarkdown. - Add headings, paragraphs, tables, code blocks, or task lists.
- Save the
.mdoutput as a report, repository artifact, or generated documentation file.
Quick start
$summary = @(
[pscustomobject]@{ Metric = 'Uptime'; Value = '99.97%' }
[pscustomobject]@{ Metric = 'Latency'; Value = '42 ms' }
)
New-OfficeMarkdown -Path .\report.md {
MarkdownHeading -Level 1 -Text 'Summary'
MarkdownParagraph -Text 'Generated automatically from the nightly validation run.'
MarkdownTable -InputObject $summary
MarkdownCode -Language 'powershell' -Content 'Get-Service | Select-Object -First 5'
}Multi-section report pattern
$summary = Get-Process | Select-Object -First 5 Name, Id, CPU
$details = Get-Service | Select-Object -First 5 Name, Status, StartType
New-OfficeMarkdown -Path .\operations-report.md {
MarkdownHeading -Level 1 -Text 'Operations Report'
MarkdownTableOfContents -Title 'Contents' -MinLevel 2 -MaxLevel 2 -PlaceAtTop
MarkdownHeading -Level 2 -Text 'Processes'
MarkdownTable -InputObject $summary
MarkdownHeading -Level 2 -Text 'Services'
MarkdownTable -InputObject $details
MarkdownCallout -Kind note -Title 'Next step' -Body 'Review the failed services before publishing.'
}Useful commands
New-OfficeMarkdownstarts a document and can save immediately or return the document for further piping.Add-OfficeMarkdownHeadingandAdd-OfficeMarkdownParagraphbuild the narrative structure.Add-OfficeMarkdownTableturns PowerShell objects into Markdown tables quickly.Add-OfficeMarkdownCodeandAdd-OfficeMarkdownCalloutare useful for README-style and operational documentation.Add-OfficeMarkdownTaskListandAdd-OfficeMarkdownTableOfContentshelp when the file needs to be actionable or navigable.
When to use it
- Generate release notes, status reports, and inventory summaries from scheduled jobs.
- Produce README fragments or docs artifacts during CI.
- Emit Markdown that can later be consumed by
OfficeIMO.Markdownor site generation workflows.
Related guides
- PSWriteOffice overview -- Module-level installation and command map.
- Markdown overview -- .NET package concepts and rendering pipeline.
- OfficeIMO.Markdown product page -- Install command and package positioning.