PowerShell / platyPS

Write PowerShell External Help in Markdown
MIT License
771 stars 150 forks source link

Prompt is being removed from first line of a multiple line example #503

Open wsmelton opened 3 years ago

wsmelton commented 3 years ago

Reference #180

Steps to reproduce

Function with help example:

    .EXAMPLE
    PS> $session = New-TssSession -SecretServer https://alpha -Credential $ssCred
    PS> Disable-TssSecret -TssSession $session -Id 93

    Disables secret 93

Generated markdown picks up both lines properly now after fixes merged from #180 but the first line is having the prompt removed:

### EXAMPLE 1
'''
$session = New-TssSession -SecretServer https://alpha -Credential $ssCred
PS> Disable-TssSecret -TssSession $session -Id 93
'''

Disables secret 93

Expected behavior

Both example lines to be formatted with the PS> prompt prefix.

### EXAMPLE 1
'''
PS> $session = New-TssSession -SecretServer https://alpha -Credential $ssCred
PS> Disable-TssSecret -TssSession $session -Id 93
'''

Disables secret 93

Actual behavior

The prompt prefix is being removed on the first line of the example

Environment data

0.14.1

wsmelton commented 3 years ago

I submitted issue #14656 to the PowerShell repo around Get-Help because it is removing the space on the first line after the prompt. I'm not sure if that may be what is interfering with generating the markdown properly or not.

theJasonHelmick commented 3 years ago

We need to further investigate, but we believe this might be resolved with the Markdig engine

sdwheeler commented 4 months ago

This need further investigation. This may be a problem with the interaction with the PowerShell help system (Get-Help). Need to test this for GA and decide.

sdwheeler commented 4 months ago

Restested with Microsoft.PowerShell.PlatyPS v1. It's not importing the comment-based help properly for examples. Get-Help is also altering the propmt text in the example, but v1 is skipping the code entirely. See attached test function in zip file. test.zip