https://github.com/cdhunt/format-document
Helper for formatting web documents in Markdown, Html, or Confluence.
https://github.com/cdhunt/format-document
confluence devops-toolkit documentation-tool html markdown powershell powershell-module
Last synced: about 2 months ago
JSON representation
Helper for formatting web documents in Markdown, Html, or Confluence.
- Host: GitHub
- URL: https://github.com/cdhunt/format-document
- Owner: cdhunt
- License: apache-2.0
- Created: 2023-12-19T18:31:39.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-02T13:34:31.000Z (over 1 year ago)
- Last Synced: 2024-02-03T14:45:13.553Z (over 1 year ago)
- Topics: confluence, devops-toolkit, documentation-tool, html, markdown, powershell, powershell-module
- Language: PowerShell
- Homepage:
- Size: 85 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: Changelog.md
- License: LICENSE
Awesome Lists containing this project
README
# Format-Document
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](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax))
- [Confluence Storage Format](https://confluence.atlassian.com/doc/confluence-storage-format-790796544.html)
- Html (with [Bootstrap](https://getbootstrap.com/) class decorations)You can use this to automatically maintain and synchronize documentation in multiple formats such as READMEs and Confluence Wiki.
## CI Status

[](https://cdhunt.testspace.com/projects/67973/spaces)
[](https://www.powershellgallery.com/packages/Format-Document)
## Install
[powershellgallery.com/packages/Format-Document](https://www.powershellgallery.com/packages/Format-Document)
`Install-Module -Name Format-Document` or `Install-PSResource -Name Format-Document`

## Docs
[Full Docs](docs)
### Examples
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.```powershell
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](https://confluence.atlassian.com/doc/confluence-storage-format-790796544.html).

You can use [ConfluencePS](https://www.powershellgallery.com/packages/ConfluencePS) to publish the content.
```powershell
$page = Get-ConfluencePage -PageID 123456789
$doc = New-Document -Type Confluence { ... }$page.Body = $doc
$page | Set-ConfluencePage
```