platyPS icon indicating copy to clipboard operation
platyPS copied to clipboard

[Markdown.MAML.Parser.MarkdownParser].ParseString does not process bullet points correctly.

Open jhoneill opened this issue 3 years ago • 0 comments

Prerequisites

  • [X] Write a descriptive title.
  • [X] Make sure you are able to repro it on the latest released version
  • [X] Search the existing issues.

Steps to reproduce

  1. As a test file I have download the MD help file for Get-Help from. https://github.com/MicrosoftDocs/PowerShell-Docs/blob/main/reference/7.2/Microsoft.PowerShell.Core/Get-Help.md
  2. In VS Code I have set a break point on new-externalHelp but the important part is in the function GetMamlModelImpl which has a line $model = $p.ParseString($mdText, $parseMode, $_) (1605 in the .PSM1 file for v 0.14.2 )
  3. After this line has run examine $model.children[-3].spans[10..14] | ft style,text -wrap

The markdown

The full view of help includes a table of information about the parameters. The table includes the
following fields:

- **Required**. Indicates whether the parameter is required (true) or optional (false).

- **Position**. Indicates whether the parameter is named or positional (numeric). Positional
  parameters must appear in a specified place in the command.

Translates to

 Style Text
 ----- ----
Normal .
       The full view of help includes a table of information about the parameters. The table includes the following fields:
       -
  Bold Required
Normal . Indicates whether the parameter is required (true) or optional (false).
       -
  Bold Position
Normal . Indicates whether the parameter is named or positional (numeric). Positional   parameters must appear in a specified place in the command.

Note in the last line the extras spaces between "positional" and parameters, because the carriage return has been removed but the indent to keep the bullet point together have not.

Expected behavior

The notes part of Get-Help Get-Help -full displays a notes section similar to what is displayed at https://docs.microsoft.com/en-gb/powershell/module/microsoft.powershell.core/get-help?view=powershell-7.2#notes i.e. 

        The full view of help includes a table of information about the parameters. The table includes the following fields:

        * Required . Indicates whether the parameter is required (true) or optional (false).       
        * Position . Indicates whether the parameter is named or positional (numeric). Positional parameters must appear in a specified place in the command.

Actual behavior

It displays like this 
        The full view of help includes a table of information about the parameters. The table includes the following fields:

        - Required . Indicates whether the parameter is required (true) or optional (false).
        
        - Position . Indicates whether the parameter is named or positional (numeric). Positional   parameters must appear in a specified place in the command.

Error details

No error message

Environment data

get-module platyps -list 

    Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Script     0.14.2                platyPS                             Desk      {New-MarkdownHelp, Get-MarkdownMetadata, New-ExternalHelp, New-YamlHelp…}



Name                           Value
----                           -----
PSVersion                      7.2.6
PSEdition                      Core
GitCommitId                    7.2.6
OS                             Microsoft Windows 10.0.22000
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

No response

jhoneill avatar Aug 16 '22 11:08 jhoneill