This module contains an HTML-like DSL for dynamically constructing documents using PowerShell. The same template can be rendered to any one of the following formats which render as similarly as possible.
Formats supported:
- Markdown (GitHub-flavored)
- Confluence Storage Format
- Html (with Bootstrap class decorations)
You can use this to automatically maintain and synchronize documentation in multiple formats such as READMEs and Confluence Wiki.
powershellgallery.com/packages/Format-Document
Install-Module -Name Format-Document or Install-PSResource -Name Format-Document
Generate a document in Markdown. Each element accepts either a ScriptBlock or a String. Use a ScriptBlock if you want more powerful text generation. Unenclosed text will be passed through as is.
New-Document-Type Markdown {
H1 "My Text"
H2 { "Heading 2" }
P { Get-Date }
P {
"normal text"
B "bold text cmdlet""."
Link "link Text""https://google.com"
}
Table {
TR {
TH "Heading 1","Heading 2"
}
TR {
TD -Text "Fun"
TD -Text "Moar Fun"
}
TR {
TD "Item 1","Item 2"
}
}
}Using the same template and changing -Type parameter to Confluence renders the document in Confluence Storage Format.
You can use ConfluencePS to publish the content.
$page=Get-ConfluencePage-PageID 123456789$doc=New-Document-Type Confluence { ... }
$page.Body=$doc$page|Set-ConfluencePage
