Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
22 changes: 21 additions & 1 deletion docs/New-ExternalHelp.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Creates external help file based on markdown supported by PlatyPS.

```
New-ExternalHelp -Path <String[]> -OutputPath <String> [-ApplicableTag <String[]>] [-Encoding <Encoding>]
-ErrorLogFile <String> [-Force] [<CommonParameters>]
[-MaxAboutWidth <Int>] [-ErrorLogFile <String>] [-Force] [<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -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.

Expand Down
7 changes: 5 additions & 2 deletions src/platyPS/platyPS.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down Expand Up @@ -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)
Expand Down