Public/ConvertTo-JiraADF.ps1

function ConvertTo-JiraADF {
    <#
    .SYNOPSIS
        Wandelt einfachen Text in ein minimales Atlassian Document Format (ADF) Dokument um.
        Jira Cloud v3 erwartet für Felder wie "description" oder Kommentar-"body" ADF statt reinem Text/HTML.
    .PARAMETER InputText
        Der umzuwandelnde Text. Jede Zeile (getrennt durch `n) wird zu einem eigenen Absatz.
    .EXAMPLE
        ConvertTo-JiraADF -InputText "Erste Zeile`nZweite Zeile"
    #>

    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $true, ValueFromPipeline = $true)]
        [string]
        $InputText
    )

    process {
        $Lines = $InputText -split "`r?`n"

        $Paragraphs = foreach ($Line in $Lines) {
            if ([string]::IsNullOrEmpty($Line)) {
                @{ type = "paragraph"; content = @() }
            }
            else {
                @{
                    type    = "paragraph"
                    content = @(
                        @{ type = "text"; text = $Line }
                    )
                }
            }
        }

        return @{
            type    = "doc"
            version = 1
            content = @($Paragraphs)
        }
    }
}