Public/New-MarkdownSummary.ps1

function New-MarkdownSummary {
    [CmdletBinding(SupportsShouldProcess)]
    [OutputType([string])]
    param(
        [Parameter(Mandatory)]
        [psobject] $InputObject,

        [string] $Title = 'System Summary'
    )

    if (-not $PSCmdlet.ShouldProcess($Title, 'Create markdown summary text')) {
        return
    }

    $lines = @(
        "# $Title",
        '',
        '| Property | Value |',
        '|---|---|'
    )

    foreach ($property in $InputObject.PSObject.Properties) {
        $value = $property.Value

        if ($null -eq $value) {
            $displayValue = ''
        }
        elseif ($value -is [System.Collections.IEnumerable] -and $value -isnot [string]) {
            $displayValue = ($value -join ', ')
        }
        else {
            $displayValue = [string]$value
        }

        $displayValue = $displayValue.Replace('|', '\|')
        $lines += "| $($property.Name) | $displayValue |"
    }

    $lines -join [System.Environment]::NewLine
}