Skip to content

Commit 21ac447

Browse files
author
James Brundage
committed
feat: MarkX.Sync improved Help ( Fixes #101 )
Adding Parameter help
2 parents 553a9ea + 694f66b commit 21ac447

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

‎MarkX.types.ps1xml‎

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,13 @@ $allMarkdown = @(:nextInput foreach ($md in $this.Input) {
662662
$codeBlock
663663
"~~~"
664664
}
665-
) -join [Environment]::NewLine
665+
) -join [Environment]::NewLine
666+
source =
667+
if ($this -is [ScriptBlock]) {
668+
$this.Ast.ToString()
669+
} elseif ($this.ScriptBlock) {
670+
"$($this.ScriptBlock.Ast.ToString())"
671+
}
666672
}
667673

668674
@(
@@ -674,26 +680,45 @@ $allMarkdown = @(:nextInput foreach ($md in $this.Input) {
674680

675681
if ($helpObject.description) {
676682
"### $($helpObject.description)"
683+
[Environment]::NewLine
677684
}
678685

679686
if ($helpObject.inputs) {
680687
"### Inputs"
688+
[Environment]::NewLine
681689
$helpObject.inputs
690+
[Environment]::NewLine
682691
}
683692

684693
if ($helpObject.outputs) {
685694
"### Outputs"
686695
$helpObject.outputs
696+
[Environment]::NewLine
687697
}
688698

689699
if ($helpObject.notes) {
690700
if (-not ($helpObject.inputs -or $helpObject.outputs)) {
691701
"### Notes"
692702
}
693703
$helpObject.notes
704+
[Environment]::NewLine
694705
}
695706

707+
[Environment]::NewLine
696708
$helpObject.examples
709+
[Environment]::NewLine
710+
711+
if ($helpObject.source -and
712+
-not ($helpObject.source -match '(?m)^(?>~~~|```)PowerShell')
713+
) {
714+
"<details><summary>View Source</summary>"
715+
""
716+
"~~~PowerShell"
717+
$helpObject.Source
718+
"~~~"
719+
"</details>"
720+
[Environment]::NewLine
721+
}
697722
) -join [Environment]::NewLine
698723

699724
$header = $this.Header

0 commit comments

Comments
 (0)