Skip to content

Commit 862dffb

Browse files
jazzdelightsmevors
authored andcommitted
Add a -MaxAboutWidth parameter to New-ExternalHelp. (#299)
1 parent 0fd2986 commit 862dffb

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ CHANGELOG
44
## Not released
55

66
* 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.
7+
* Added a -MaxAboutWidth parameter to New-ExternalHelp, to allow controlling the wrapping boundary of "about" text files (default is 80).
78

89
## 0.8.2
910

docs/New-ExternalHelp.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Creates external help file based on markdown supported by PlatyPS.
1414

1515
```
1616
New-ExternalHelp -Path <String[]> -OutputPath <String> [-ApplicableTag <String[]>] [-Encoding <Encoding>]
17-
-ErrorLogFile <String> [-Force] [<CommonParameters>]
17+
[-MaxAboutWidth <Int>] [-ErrorLogFile <String>] [-Force] [<CommonParameters>]
1818
```
1919

2020
## DESCRIPTION
@@ -162,6 +162,26 @@ Accept pipeline input: False
162162
Accept wildcard characters: False
163163
```
164164

165+
### -MaxAboutWidth
166+
Specifies the maximimum line length when generating "about" help text files.
167+
(See New-MarkdownAboutHelp.) Other help file types are not affected by this
168+
parameter.
169+
170+
Lines inside code blocks are not wrapped at all and are not affected by the
171+
MaxAboutWidth parameter.
172+
173+
```yaml
174+
Type: Int
175+
Parameter Sets: (All)
176+
Aliases:
177+
178+
Required: False
179+
Position: Named
180+
Default value: 80
181+
Accept pipeline input: False
182+
Accept wildcard characters: False
183+
```
184+
165185
### -ErrorLogFile
166186
The path where this cmdlet will save formatted results log file.
167187

src/platyPS/platyPS.psm1

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -749,8 +749,11 @@ function New-ExternalHelp
749749

750750
[System.Text.Encoding]$Encoding = [System.Text.Encoding]::UTF8,
751751

752+
[ValidateRange(80, [int]::MaxValue)]
753+
[int] $MaxAboutWidth = 80,
754+
752755
[string]$ErrorLogFile,
753-
756+
754757
[switch]$Force
755758
)
756759

@@ -855,7 +858,7 @@ function New-ExternalHelp
855858
# handle about topics
856859
if ($AboutFiles.Count -gt 0) {
857860
foreach ($About in $AboutFiles) {
858-
$r = New-Object -TypeName 'Markdown.MAML.Renderer.TextRenderer' -ArgumentList(80)
861+
$r = New-Object -TypeName 'Markdown.MAML.Renderer.TextRenderer' -ArgumentList($MaxAboutWidth)
859862
$Content = Get-Content -Raw $About.FullName
860863
$p = NewMarkdownParser
861864
$model = $p.ParseString($Content)

0 commit comments

Comments
 (0)