PowerShell / platyPS

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

New-ExternalHelp removes specific carriage returns #508

Open chrisda opened 3 years ago

chrisda commented 3 years ago

It appears that if a line of text in the SYNOPSIS section of a markdown topic starts with bold formatting, the carriage returns around that line of text are not honored when running New-ExternalHelp.

Sample text in markdown topic (note that there are 4 distinct lines of text/paragraphs):

## SYNOPSIS
This cmdlet is available only in the cloud-based service.

Use the Get-HostedConnectionFilterPolicy cmdlet to view the settings of connection filter policies in your cloud-based organization.

**Note**: We recommend that you use the Exchange Online PowerShell V2 module to connect to Exchange Online PowerShell. For instructions, see [Connect to Exchange Online PowerShell](https://docs.microsoft.com/powershell/exchange/connect-to-exchange-online-powershell).

For information about the parameter sets in the Syntax section below, see [Exchange cmdlet syntax](https://docs.microsoft.com/powershell/exchange/exchange-cmdlet-syntax).

Result (note that there are only 3 paragraphs; the Note paragraph is munged together with the previous paragraph):

      <maml:description>
        <maml:para>This cmdlet is available only in the cloud-based service.</maml:para>
        <maml:para>Use the Get-HostedConnectionFilterPolicy cmdlet to view the settings of connection filter policies in your cloud-based organization. Note : We recommend that you use the Exchange Online PowerShell V2 module to connect to Exchange Online PowerShell. For instructions, see Connect to Exchange Online PowerShell (https://docs.microsoft.com/powershell/exchange/connect-to-exchange-online-powershell).</maml:para>
        <maml:para>For information about the parameter sets in the Syntax section below, see Exchange cmdlet syntax (https://docs.microsoft.com/powershell/exchange/exchange-cmdlet-syntax).</maml:para>
      </maml:description>

Attached is a topic and the resulting XML file for inspection. platyPSissue.zip

Steps to reproduce

  1. Take a markdown topic that contains a line of text in the SYNOPSIS section that contains a **Note** paragraph.
  2. Run the following command:

    New-ExternalHelp -Path "<Path to markdown topic"> -OutputPath "<Output folder>"

Expected behavior

The line of text that starts with **Note** should be contained within its own <maml:para></maml:para> tag.

Actual behavior

The line of text that starts with **Note** is not contained within its own <maml:para></maml:para> tag. It's treated as if it's a second sentence in the previous line of text

Environment data

sdwheeler commented 3 years ago

@chrisda Can you test this with https://github.com/PowerShell/platyPS/releases/tag/v2.0.0-preview1. They may have been fixed.

chrisda commented 3 years ago

@sdwheeler, no joy.

I updated to v2.0.0-Preivew1 that's available in the PSGallery, and the behavior is the same (see the attached XML file).

   <maml:description>
    <maml:para>This cmdlet is available only in the cloud-based service.</maml:para>
    <maml:para>Use the Get-HostedConnectionFilterPolicy cmdlet to view the settings of connection filter policies in your cloud-based organization. Note : We recommend that you use the Exchange Online PowerShell V2 module to connect to Exchange Online PowerShell. For instructions, see Connect to Exchange Online PowerShell (https://docs.microsoft.com/powershell/exchange/connect-to-exchange-online-powershell).</maml:para>
    <maml:para>For information about the parameter sets in the Syntax section below, see Exchange cmdlet syntax (https://docs.microsoft.com/powershell/exchange/exchange-cmdlet-syntax).</maml:para>
  </maml:description>
</command:details>
<maml:description>

Microsoft.Exchange.TransportMailflow-Help.xml.zip

chrisda commented 3 years ago

Also noting that this is related to Issue #429.

theJasonHelmick commented 3 years ago

Hey @chrisda! We plan on having this functionality working in Preview 3. #538

sdwheeler commented 4 months ago

Related to #429 Retested Microsoft.PowerShell.PlatyPS v1. Current conversion to MAML removes empty lines in examples. Newlines are correct for all other description fields.