platyPS
platyPS copied to clipboard
Update-MarkdownHelpModule always adds [<CommonParameters>] to Syntax even when [CmdletBinding()] is not there
I have following function (one of many). It doesn't have [CmdletBinding()].
function New-HTMLAnchor {
<#
.SYNOPSIS
Short description
.DESCRIPTION
Long description
.PARAMETER Name
Parameter description
.PARAMETER Target
Target options: "_blank|_self|_parent|_top|framename"
.PARAMETER Class
.PARAMETER HrefLink
Parameter description
.PARAMETER Text
Parameter description
.EXAMPLE
New-HTMLAnchor -Target _parent
Output:
<a target = "_parent" />
.NOTES
General notes
#>
param(
[alias('AnchorName')][string] $Name,
[string] $Target,
[string] $Class,
[alias('Url', 'Link', 'UrlLink')][string] $HrefLink,
[alias('AnchorText')][string] $Text
)
[System.Collections.IDictionary] $Anchor = [Ordered] @{
Tag = 'a'
Attributes = [ordered]@{
'name' = $Name
'class' = $Class
'target' = $Target
'href' = $HrefLink
}
Value = $Text # if value is blank it will not be used
}
$HTML = Set-Tag -HtmlObject $Anchor
return $HTML
}
Steps to reproduce
- New-MarkdownHelp -Module $ProjectName -WithModulePage -OutputFolder $DocumentationPath -ModulePagePath $ReadMePath
- Verify output - common parameters will not be there in Syntax and ### CommonParameters will not be there either
- Update-MarkdownHelpModule $DocumentationPath -RefreshModulePage -ModulePagePath $ReadMePath
- Verify output - common parameters are added in Syntax and whole section ###ComonParameters is added
Expected behavior
Update-MarkdownHelpModule should behave the same way as New-MarkdownHelp
Actual behavior
Adds common parameters regardless if those are there or not.
Environment data
v0.12.0
I saw this: https://github.com/PowerShell/platyPS/issues/223 but even thou I use the newest published version the problem occurs. So it's either incomplete or I am missing something.
@BernieWhite do you know from the top of your head, how we may regress after #323 is merged?
I just encountered this as well, glad it's already logged.
@vors sorry missed this one. Let me have a look.
Verified this is still a bug in 0.14.1
This is fixed in the data model used by Microsoft.PowerShell.PlatyPS v1.