diff --git a/CHANGELOG.md b/CHANGELOG.md index 910385bb..d1f2411c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ CHANGELOG ## Not released * New-ExternalHelp can log warnings and errors as JSON to file using new -ErrorLogFile parameter. The file can be used by CI systems to report warnings and errors to the build summary. +* Added a -MaxAboutWidth parameter to New-ExternalHelp, to allow controlling the wrapping boundary of "about" text files (default is 80). ## 0.8.2 diff --git a/docs/New-ExternalHelp.md b/docs/New-ExternalHelp.md index 8517ab35..8c8ca4ca 100644 --- a/docs/New-ExternalHelp.md +++ b/docs/New-ExternalHelp.md @@ -14,7 +14,7 @@ Creates external help file based on markdown supported by PlatyPS. ``` New-ExternalHelp -Path -OutputPath [-ApplicableTag ] [-Encoding ] - -ErrorLogFile [-Force] [] + [-MaxAboutWidth ] [-ErrorLogFile ] [-Force] [] ``` ## DESCRIPTION @@ -162,6 +162,26 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -MaxAboutWidth +Specifies the maximimum line length when generating "about" help text files. +(See New-MarkdownAboutHelp.) Other help file types are not affected by this +parameter. + +Lines inside code blocks are not wrapped at all and are not affected by the +MaxAboutWidth parameter. + +```yaml +Type: Int +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: 80 +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -ErrorLogFile The path where this cmdlet will save formatted results log file. diff --git a/src/platyPS/platyPS.psm1 b/src/platyPS/platyPS.psm1 index efb74c2d..982f6c4e 100644 --- a/src/platyPS/platyPS.psm1 +++ b/src/platyPS/platyPS.psm1 @@ -749,8 +749,11 @@ function New-ExternalHelp [System.Text.Encoding]$Encoding = [System.Text.Encoding]::UTF8, + [ValidateRange(80, [int]::MaxValue)] + [int] $MaxAboutWidth = 80, + [string]$ErrorLogFile, - + [switch]$Force ) @@ -855,7 +858,7 @@ function New-ExternalHelp # handle about topics if ($AboutFiles.Count -gt 0) { foreach ($About in $AboutFiles) { - $r = New-Object -TypeName 'Markdown.MAML.Renderer.TextRenderer' -ArgumentList(80) + $r = New-Object -TypeName 'Markdown.MAML.Renderer.TextRenderer' -ArgumentList($MaxAboutWidth) $Content = Get-Content -Raw $About.FullName $p = NewMarkdownParser $model = $p.ParseString($Content)