Skip to content

Add -ExcludeDontShow switch to New-MarkdownCommandHelp to suppress [Parameter(DontShow)] parameters#846

Open
Copilot wants to merge 4 commits into
mainfrom
copilot/fix-dontshow-parameter-issue
Open

Add -ExcludeDontShow switch to New-MarkdownCommandHelp to suppress [Parameter(DontShow)] parameters#846
Copilot wants to merge 4 commits into
mainfrom
copilot/fix-dontshow-parameter-issue

Conversation

Copy link
Copy Markdown

Copilot AI commented May 26, 2026

Microsoft.PowerShell.PlatyPS 1.0.1 was emitting hidden parameters in generated markdown even when parameters were annotated with [Parameter(DontShow)]. This change adds an opt-in -ExcludeDontShow switch to New-MarkdownCommandHelp that aligns behavior with expected PowerShell metadata semantics by excluding hidden parameters from generated help when specified.

  • What changed

    • NewMarkdownHelpCommand now exposes an -ExcludeDontShow switch parameter. When provided, TransformSettings.ExcludeDontShow is set to true for that invocation.
    • TransformBase enforces ExcludeDontShow consistently in:
      • parameter collection (GetParameters)
      • syntax generation (GetSyntaxItem, both positional and named parameter passes)
  • Regression coverage

    • Added a focused Pester scenario in NewMarkdownHelp.Tests.ps1 that defines a function with:
      • one public parameter
      • two [Parameter(DontShow)] parameters
    • Asserts hidden parameters are absent from:
      • markdown parameter sections
      • imported command model parameter/syntax content
  • Example scenario covered

    function Test-DontShowParameter {
        [CmdletBinding()]
        param(
            [string]$Public,
            [Parameter(DontShow)][string]$Hidden,
            [Parameter(DontShow)][string]$Break
        )
    }
    
    New-MarkdownCommandHelp -Command (Get-Command Test-DontShowParameter) -OutputFolder $TestDrive -ExcludeDontShow
    # Expected: only -Public appears in generated help content

This change is


This change is Reviewable

Copilot AI changed the title [WIP] Fix Microsoft.PowerShell.PlatyPS not honoring [Parameter(DontShow)] Honor [Parameter(DontShow)] in New-MarkdownCommandHelp output May 26, 2026
Copilot AI requested a review from adityapatwardhan May 26, 2026 02:53
@adityapatwardhan
Copy link
Copy Markdown
Member

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@adityapatwardhan adityapatwardhan marked this pull request as ready for review May 28, 2026 19:13
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@adityapatwardhan
Copy link
Copy Markdown
Member

@copilot - change implementation to have a Switch parameter called ExcludeDontShow instead of defaulting to exclude it.

Copy link
Copy Markdown
Author

Copilot AI commented May 28, 2026

@copilot - change implementation to have a Switch parameter called ExcludeDontShow instead of defaulting to exclude it.

Done. Added -ExcludeDontShow as a SwitchParameter on New-MarkdownCommandHelp and wired it to TransformSettings.ExcludeDontShow instead of hard-coding true. The test now passes -ExcludeDontShow explicitly. Commit: Add -ExcludeDontShow switch to New-MarkdownCommandHelp instead of hard-coding true.

Copilot AI changed the title Honor [Parameter(DontShow)] in New-MarkdownCommandHelp output Add -ExcludeDontShow switch to New-MarkdownCommandHelp to suppress [Parameter(DontShow)] parameters May 28, 2026
Copilot AI requested a review from adityapatwardhan May 28, 2026 20:14
@adityapatwardhan
Copy link
Copy Markdown
Member

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Collaborator

@sdwheeler sdwheeler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown
Collaborator

@theJasonHelmick theJasonHelmick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Microsoft.PowerShell.PlatyPS 1.0.1 does not honor [Parameter(DontShow)]

5 participants