platyPS icon indicating copy to clipboard operation
platyPS copied to clipboard

Rendering issue with Get-ChildItem -Include and -Exclude parameters

Open sdwheeler opened this issue 4 years ago • 1 comments

Here is the source markdown:

### -Exclude

Specifies an array of one or more string patterns to be matched as the cmdlet gets child items. Any
matching item is excluded from the output. Enter a path element or pattern, such as `*.txt` or `A*`.
Wildcard characters are accepted.

A trailing asterisk (`*`) in the **Path** parameter is optional. For example, `-Path C:\Test\Logs`
or `-Path C:\Test\Logs\*`. If a trailing asterisk (`*`) is included, the command recurses into the
**Path** parameter's subdirectories. Without the asterisk (`*`), the contents of the **Path**
parameter are displayed. More details are included in Example 5 and the Notes section.

The **Include** and **Exclude** parameters can be used together. However, the exclusions are applied
after the inclusions, which can affect the final output.

Here is the output from Get-Help. Notice that the asterisk characters are missing or misplaced.

    -Exclude <System.String[]>
        Specifies, as a string array, a property or property that this cmdlet excludes from the operation. The value
        of this parameter qualifies the Path parameter. Enter a path element or pattern, such as ` .txt` or `A `.
        Wildcard characters are accepted.

        A trailing asterisk (` `) in the Path * parameter is optional. For example, `-Path C:\Test\Logs` or `-Path
        C:\Test\Logs\ `. If a trailing asterisk (` `) is included, the command recurses into the Path parameter's
        subdirectories. Without the asterisk (` `), the contents of the Path * parameter are displayed. More details
        are included in Example 5 and the Notes section.

sdwheeler avatar Jun 08 '21 21:06 sdwheeler

I just checked the MAML that gets downloaded by Update-Help, it is as follows:

<command:parameter required="false" variableLength="true" globbing="true" pipelineInput="False" position="named" aliases="none">
          <maml:name>Exclude</maml:name>
          <maml:description>
            <maml:para>Specifies an array of one or more string patterns to be matched as the cmdlet gets child items. Any matching item is excluded from the output. Enter a path element or pattern, such as ` .txt` or `A `. Wildcard characters are accepted.</maml:para>
            <maml:para>A trailing asterisk (` `) in the Path * parameter is optional. For example, `-Path C:\Test\Logs` or `-Path C:\Test\Logs\ `. If a trailing asterisk (` `) is included, the command recurses into the Path parameter's subdirectories. Without the asterisk (` `), the contents of the Path * parameter are displayed. More details are included in Example 5 and the Notes section.</maml:para>
            <maml:para>The Include and Exclude parameters can be used together. However, the exclusions are applied after the inclusions, which can affect the final output.</maml:para>
          </maml:description>
          <command:parameterValue required="true" variableLength="false">System.String[]</command:parameterValue>
          <dev:type>
            <maml:name>System.String[]</maml:name>
            <maml:uri />
          </dev:type>
          <dev:defaultValue>None</dev:defaultValue>
        </command:parameter>

As you can see the asterisk is missing. It seems the issue could be in MAML generation instead. I will have a look at this when I work on New-ExternalHelp.

Update the MAML help by adding the * the generated MD file is correct.

adityapatwardhan avatar Nov 30 '21 00:11 adityapatwardhan

This may already be fixed in Microsoft.PowerShell.PlatyPS v1 due to the new markdown parsing and MAML conversion. Need to test before release.

sdwheeler avatar May 24 '24 15:05 sdwheeler

Retested. This is fixed in Microsoft.PowerShell.PlatyPS v1.

sdwheeler avatar May 24 '24 18:05 sdwheeler