From 1f89c6d625e64217ad00ca18e7501af11329c953 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Sat, 28 Aug 2021 12:58:48 +0200 Subject: [PATCH] Update convert-ps2md.ps1 --- Scripts/convert-ps2md.ps1 | 48 ++++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/Scripts/convert-ps2md.ps1 b/Scripts/convert-ps2md.ps1 index 83816be5..a2b2908d 100644 --- a/Scripts/convert-ps2md.ps1 +++ b/Scripts/convert-ps2md.ps1 @@ -63,19 +63,28 @@ function GetRemark { } try { - $full = Get-Help $script -Full + $full = Get-Help $script -Full + "# $($full.Name)" + "$($full.Synopsis)" + + $Description = ($full.description | Out-String).Trim() + if ($Description -ne "") { + "" + "## Description" + "$Description" + } + + $Syntax = (($full.syntax | Out-String) -replace "`r`n", "`r`n`r`n").Trim() + if ($Syntax -ne "") { + "" + "## Syntax" + "``````powershell" + "$Syntax" + "``````" + } @" -# $($full.Name) -$($full.Synopsis) -## Description -$(($full.description | Out-String).Trim()) - -## Syntax -``````powershell -$((($full.syntax | Out-String) -replace "`r`n", "`r`n`r`n").Trim()) -`````` ## Parameters "@ + $(foreach ($parameter in $full.parameters.parameter) { @@ -105,16 +114,23 @@ $(GetCode $example) `````` $(GetRemark $example) -## Notes -$(($full.alertSet.alert | Out-String).Trim()) - -## Related Links -$(($full.relatedlinks | Out-String).Trim()) - "@ }) + @" "@ + $Notes = ($full.alertSet.alert | Out-String).Trim() + if ($Notes -ne "") { + "" + "## Notes" + "$Notes" + } + + $Links = ($full.relatedlinks | Out-String).Trim() + if ($Links -ne "") { + "" + "## Related Links" + "$Links" + } } finally { }