From 7ef976ebe1834c29967dc46252d8f1d24d4f9b57 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 26 May 2026 02:45:40 +0000 Subject: [PATCH 1/3] Initial plan From 90434a9b24e0659e4892125dcbe3f4177428f65c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 26 May 2026 02:52:18 +0000 Subject: [PATCH 2/3] Honor DontShow in New-MarkdownCommandHelp --- src/Command/NewMarkdownHelpCommand.cs | 2 +- src/Transform/TransformBase.cs | 14 ++++++++++++++ test/Pester/NewMarkdownHelp.Tests.ps1 | 26 ++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/src/Command/NewMarkdownHelpCommand.cs b/src/Command/NewMarkdownHelpCommand.cs index e0327438..5342b2c5 100644 --- a/src/Command/NewMarkdownHelpCommand.cs +++ b/src/Command/NewMarkdownHelpCommand.cs @@ -132,7 +132,7 @@ protected override void EndProcessing() { CreateModulePage = WithModulePage, DoubleDashList = false, - ExcludeDontShow = false, + ExcludeDontShow = true, FwLink = HelpInfoUri, HelpVersion = HelpVersion.ToString(), Locale = Locale is null ? CultureInfo.CurrentCulture : new CultureInfo(Locale), diff --git a/src/Transform/TransformBase.cs b/src/Transform/TransformBase.cs index e1fa9b78..eb7f5068 100644 --- a/src/Transform/TransformBase.cs +++ b/src/Transform/TransformBase.cs @@ -212,6 +212,10 @@ protected IEnumerable GetParameters(CommandInfo cmdletInfo, dynamic? } var paramAttribInfo = GetParameterAtributeInfo(parameterMetadata.Value.Attributes); + if (Settings.ExcludeDontShow.GetValueOrDefault() && paramAttribInfo.DontShow) + { + continue; + } string typeName = GetParameterTypeName(parameterMetadata.Value.ParameterType); Parameter param = new(parameterMetadata.Value.Name, typeName); @@ -365,6 +369,11 @@ protected IEnumerable GetSyntaxItem(CommandInfo? cmdletInfo, dynamic // Take the positional parameters first, and order them by position. foreach (CommandParameterInfo paramInfo in parameterSetInfo.Parameters.Where(p => p.Position != int.MinValue).OrderBy(p => p.Position)) { + if (Settings.ExcludeDontShow.GetValueOrDefault() && GetParameterAtributeInfo(paramInfo.Attributes).DontShow) + { + continue; + } + if (IsNotCommonParameter(paramInfo.Name)) { syn.SyntaxParameters.Add( new SyntaxParameter( @@ -383,6 +392,11 @@ protected IEnumerable GetSyntaxItem(CommandInfo? cmdletInfo, dynamic // now take the named parameters. foreach (CommandParameterInfo paramInfo in parameterSetInfo.Parameters.Where(p => p.Position == int.MinValue)) { + if (Settings.ExcludeDontShow.GetValueOrDefault() && GetParameterAtributeInfo(paramInfo.Attributes).DontShow) + { + continue; + } + if (IsNotCommonParameter(paramInfo.Name)) { var sParm = new SyntaxParameter( paramInfo.Name, diff --git a/test/Pester/NewMarkdownHelp.Tests.ps1 b/test/Pester/NewMarkdownHelp.Tests.ps1 index cf5bb195..658c6540 100644 --- a/test/Pester/NewMarkdownHelp.Tests.ps1 +++ b/test/Pester/NewMarkdownHelp.Tests.ps1 @@ -657,4 +657,30 @@ Write-Host 'Hello World!' $file | Should -FileContentMatch 'Runs the command in a mode that only reports what would happen without performing the actions.' } } + + Context 'DontShow attribute tests' { + BeforeAll { + function global:Test-DontShowParameter { + [CmdletBinding()] + param ( + [string] $Public, + [Parameter(DontShow)] [string] $Hidden, + [Parameter(DontShow)] [string] $Break + ) + } + + $file = New-MarkdownCommandHelp -Command (Get-Command 'Test-DontShowParameter') -OutputFolder "$TestDrive/NewMarkDownHelp" + $commandHelp = Import-MarkdownCommandHelp $file + } + + It 'does not emit hidden parameters in markdown output' { + $file | Should -Not -FileContentMatch '### -Hidden' + $file | Should -Not -FileContentMatch '### -Break' + } + + It 'does not include hidden parameters in the command model' { + $commandHelp.Parameters.Name | Should -Be @('Public') + $commandHelp.Syntax[0].ToString() | Should -Not -Match 'Hidden|Break' + } + } } From 729cb8eac5981ca74d3db61cc57b07e17b1bd2f8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 28 May 2026 20:13:45 +0000 Subject: [PATCH 3/3] Add -ExcludeDontShow switch to New-MarkdownCommandHelp instead of hard-coding true --- src/Command/NewMarkdownHelpCommand.cs | 5 ++++- test/Pester/NewMarkdownHelp.Tests.ps1 | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Command/NewMarkdownHelpCommand.cs b/src/Command/NewMarkdownHelpCommand.cs index 5342b2c5..9591d635 100644 --- a/src/Command/NewMarkdownHelpCommand.cs +++ b/src/Command/NewMarkdownHelpCommand.cs @@ -63,6 +63,9 @@ public sealed class NewMarkdownHelpCommand : PSCmdlet [Parameter] public SwitchParameter AbbreviateParameterTypeName { get; set; } + [Parameter] + public SwitchParameter ExcludeDontShow { get; set; } + #endregion List cmdCollection = new(); @@ -132,7 +135,7 @@ protected override void EndProcessing() { CreateModulePage = WithModulePage, DoubleDashList = false, - ExcludeDontShow = true, + ExcludeDontShow = ExcludeDontShow, FwLink = HelpInfoUri, HelpVersion = HelpVersion.ToString(), Locale = Locale is null ? CultureInfo.CurrentCulture : new CultureInfo(Locale), diff --git a/test/Pester/NewMarkdownHelp.Tests.ps1 b/test/Pester/NewMarkdownHelp.Tests.ps1 index 658c6540..20e242be 100644 --- a/test/Pester/NewMarkdownHelp.Tests.ps1 +++ b/test/Pester/NewMarkdownHelp.Tests.ps1 @@ -669,7 +669,7 @@ Write-Host 'Hello World!' ) } - $file = New-MarkdownCommandHelp -Command (Get-Command 'Test-DontShowParameter') -OutputFolder "$TestDrive/NewMarkDownHelp" + $file = New-MarkdownCommandHelp -Command (Get-Command 'Test-DontShowParameter') -OutputFolder "$TestDrive/NewMarkDownHelp" -ExcludeDontShow $commandHelp = Import-MarkdownCommandHelp $file }