Skip to content

Commit 40c3dfa

Browse files
Merge pull request #162 from StartAutomating/HelpingOut
HelpOut 0.5.1
2 parents 3b0eda8 + c10ca1b commit 40c3dfa

22 files changed

Lines changed: 57 additions & 927 deletions

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
### HelpOut 0.5.1:
2+
3+
* Save-MarkdownHelp - -OutputPath now handles relative paths (#159)
4+
* Markdown Help Formatting - Trimming Whitespace (#161) (rendering should be unchanged)
5+
6+
Thanks @PrzemyslawKlys !
7+
8+
---
9+
110
### HelpOut 0.5:
211

312
* Install-MAML - Adding -NoComment (#157)

Formatting/PowerShell.Markdown.Help.format.ps1

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ If the command sets a ```[ConfirmImpact("Medium")]``` which is lower than ```$co
208208
}
209209

210210
$descriptionLines = @($parameter.description | Out-String -Width 1mb) -split '(?>\r\n|\n)'
211-
$descriptionLines -replace '^-\s', '* ' -join [Environment]::NewLine
211+
$descriptionLines -replace '^-\s', '* ' -ne '' -join [Environment]::NewLine
212212

213213
if (-not $helpObject.NoValidValueEnumeration -and $helpCmd -and $helpCmd.Parameters.($parameter.Name)) {
214214
$parameterMetadata = $helpCmd.Parameters[$parameter.Name]
@@ -244,7 +244,7 @@ If the command sets a ```[ConfirmImpact("Medium")]``` which is lower than ```$co
244244

245245
Format-Markdown -MarkdownTable -InputObject ([PSCustomObject]$parameterTableInfo)
246246

247-
[Environment]::NewLine * 2
247+
[Environment]::NewLine
248248
}
249249
}
250250
}
@@ -434,14 +434,18 @@ If the command sets a ```[ConfirmImpact("Medium")]``` which is lower than ```$co
434434
& $MarkdownSections.$sectionName
435435
} else { $null }
436436
if ($sectionContent) {
437-
[Environment]::NewLine
437+
if ($sectionContent -notmatch '^[\r\n]') {
438+
[Environment]::NewLine
439+
}
438440
$sectionContent
439-
[Environment]::NewLine
441+
if ($sectionContent -notmatch '[\r\n]$') {
442+
[Environment]::NewLine
443+
}
440444
if ($sectionCounter -lt $orderOfSections.Length -and $sectionContent -notmatch '---\s{0,}$') {
441445
'---'
442446
}
443447
}
444448
}
445449

446-
) -join [Environment]::NewLine).Trim()
450+
) -join [Environment]::NewLine -replace "(?>\r\n|\n){3,}", ([Environment]::NewLine * 2)).Trim()
447451
}

HelpOut-Help.xml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<maml:description>
99
<maml:para>Gets MAML help</maml:para>
1010
</maml:description>
11-
<dev:version>0.5</dev:version>
11+
<dev:version>0.5.1</dev:version>
1212
</command:details>
1313
<maml:description>
1414
<maml:para>Gets help for a given command, as MAML (Microsoft Assistance Markup Language) xml.</maml:para>
@@ -400,7 +400,7 @@ This slightly reduces the size of the MAML file, and reduces the rate of changes
400400
<maml:description>
401401
<maml:para>Gets Markdown Help</maml:para>
402402
</maml:description>
403-
<dev:version>0.5</dev:version>
403+
<dev:version>0.5.1</dev:version>
404404
</command:details>
405405
<maml:description>
406406
<maml:para>Gets Help for a given command, in Markdown</maml:para>
@@ -703,7 +703,7 @@ Get-MarkdownHelp Get-Help # Get-MarkdownHelp is a wrapper for Get-Help </dev:cod
703703
<maml:description>
704704
<maml:para>Gets a script's references</maml:para>
705705
</maml:description>
706-
<dev:version>0.5</dev:version>
706+
<dev:version>0.5.1</dev:version>
707707
</command:details>
708708
<maml:description>
709709
<maml:para>Gets the external references of a given PowerShell command. These are the commands the script calls, and the types the script uses.</maml:para>
@@ -829,7 +829,7 @@ Get-MarkdownHelp Get-Help # Get-MarkdownHelp is a wrapper for Get-Help </dev:cod
829829
<maml:description>
830830
<maml:para>Gets a Script's story</maml:para>
831831
</maml:description>
832-
<dev:version>0.5</dev:version>
832+
<dev:version>0.5.1</dev:version>
833833
</command:details>
834834
<maml:description>
835835
<maml:para>Gets the Script's "Story"</maml:para>
@@ -992,7 +992,7 @@ Get-MarkdownHelp Get-Help # Get-MarkdownHelp is a wrapper for Get-Help </dev:cod
992992
<maml:description>
993993
<maml:para>Installs MAML into a module</maml:para>
994994
</maml:description>
995-
<dev:version>0.5</dev:version>
995+
<dev:version>0.5.1</dev:version>
996996
</command:details>
997997
<maml:description>
998998
<maml:para>Installs MAML into a module. </maml:para>
@@ -1428,7 +1428,7 @@ This slightly reduces the size of the MAML file, and reduces the rate of changes
14281428
<maml:description>
14291429
<maml:para>Determines the percentage of documentation</maml:para>
14301430
</maml:description>
1431-
<dev:version>0.5</dev:version>
1431+
<dev:version>0.5.1</dev:version>
14321432
</command:details>
14331433
<maml:description>
14341434
<maml:para>Determines the percentage of documentation in a given script</maml:para>
@@ -1571,7 +1571,7 @@ This slightly reduces the size of the MAML file, and reduces the rate of changes
15711571
<maml:description>
15721572
<maml:para>Saves a Module's MAML</maml:para>
15731573
</maml:description>
1574-
<dev:version>0.5</dev:version>
1574+
<dev:version>0.5.1</dev:version>
15751575
</command:details>
15761576
<maml:description>
15771577
<maml:para>Generates a Module's MAML file, and then saves it to the appropriate location.</maml:para>
@@ -1832,7 +1832,7 @@ This slightly reduces the size of the MAML file, and reduces the rate of changes
18321832
<maml:description>
18331833
<maml:para>Saves a Module's Markdown Help</maml:para>
18341834
</maml:description>
1835-
<dev:version>0.5</dev:version>
1835+
<dev:version>0.5.1</dev:version>
18361836
</command:details>
18371837
<maml:description>
18381838
<maml:para>Get markdown help for each command in a module and saves it to the appropriate location.</maml:para>

HelpOut.format.ps1xml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-16"?>
2-
<!-- Generated with EZOut 2.0.1: Install-Module EZOut or https://github.com/StartAutomating/EZOut -->
2+
<!-- Generated with EZOut 2.0.3: Install-Module EZOut or https://github.com/StartAutomating/EZOut -->
33
<Configuration>
44
<ViewDefinitions>
55
<View>
@@ -321,7 +321,7 @@ If the command sets a ```[ConfirmImpact("Medium")]``` which is lower than ```$co
321321
}
322322

323323
$descriptionLines = @($parameter.description | Out-String -Width 1mb) -split '(?&gt;\r\n|\n)'
324-
$descriptionLines -replace '^-\s', '* ' -join [Environment]::NewLine
324+
$descriptionLines -replace '^-\s', '* ' -ne '' -join [Environment]::NewLine
325325

326326
if (-not $helpObject.NoValidValueEnumeration -and $helpCmd -and $helpCmd.Parameters.($parameter.Name)) {
327327
$parameterMetadata = $helpCmd.Parameters[$parameter.Name]
@@ -357,7 +357,7 @@ If the command sets a ```[ConfirmImpact("Medium")]``` which is lower than ```$co
357357

358358
&amp; ${HelpOut_Format-Markdown} -MarkdownTable -InputObject ([PSCustomObject]$parameterTableInfo)
359359

360-
[Environment]::NewLine * 2
360+
[Environment]::NewLine
361361
}
362362
}
363363
}
@@ -547,16 +547,20 @@ If the command sets a ```[ConfirmImpact("Medium")]``` which is lower than ```$co
547547
&amp; $MarkdownSections.$sectionName
548548
} else { $null }
549549
if ($sectionContent) {
550-
[Environment]::NewLine
550+
if ($sectionContent -notmatch '^[\r\n]') {
551+
[Environment]::NewLine
552+
}
551553
$sectionContent
552-
[Environment]::NewLine
554+
if ($sectionContent -notmatch '[\r\n]$') {
555+
[Environment]::NewLine
556+
}
553557
if ($sectionCounter -lt $orderOfSections.Length -and $sectionContent -notmatch '---\s{0,}$') {
554558
'---'
555559
}
556560
}
557561
}
558562

559-
) -join [Environment]::NewLine).Trim()
563+
) -join [Environment]::NewLine -replace "(?&gt;\r\n|\n){3,}", ([Environment]::NewLine * 2)).Trim()
560564
</ScriptBlock>
561565
</ExpressionBinding>
562566
</CustomItem>

HelpOut.psd1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@
77
ModuleToProcess='HelpOut.psm1'
88
FormatsToProcess='HelpOut.format.ps1xml'
99
TypesToProcess='HelpOut.types.ps1xml'
10-
ModuleVersion='0.5'
10+
ModuleVersion='0.5.1'
1111
PrivateData = @{
1212
PSData = @{
1313
ProjectURI = 'https://github.com/StartAutomating/HelpOut'
1414
LicenseURI = 'https://github.com/StartAutomating/HelpOut/blob/master/LICENSE'
1515

1616
Tags = 'Markdown', 'Help','PowerShell'
1717
ReleaseNotes = @'
18-
### HelpOut 0.5:
18+
### HelpOut 0.5.1:
1919
20-
* Install-MAML - Adding -NoComment (#157)
21-
* Install-MAML - Adding -Minify (#158)
20+
* Save-MarkdownHelp - -OutputPath now handles relative paths (#159)
21+
* Markdown Help Formatting - Trimming Whitespace (#161) (rendering should be unchanged)
2222
23-
Thanks @potatoqualitee !
23+
Thanks @PrzemyslawKlys !
2424
2525
---
2626

HelpOut.types.ps1xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-16"?>
2-
<!-- Generated with EZOut 2.0.1: Install-Module EZOut or https://github.com/StartAutomating/EZOut -->
2+
<!-- Generated with EZOut 2.0.3: Install-Module EZOut or https://github.com/StartAutomating/EZOut -->
33
<Types>
44
<Type>
55
<Name>PowerShell.Markdown.Help</Name>

Save-MarkdownHelp.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,9 @@
203203
} else {
204204
Join-Path $theModuleRoot "docs" # Otherwise, it's the docs subdirectory.
205205
}
206+
} else {
207+
# If -OutputPath was provided, we want to make sure it becomes an absolute path
208+
$OutputPath = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($OutputPath)
206209
}
207210

208211
# If the -OutputPath does not exist

allcommands.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,6 +1573,9 @@ function Save-MarkdownHelp
15731573
} else {
15741574
Join-Path $theModuleRoot "docs" # Otherwise, it's the docs subdirectory.
15751575
}
1576+
} else {
1577+
# If -OutputPath was provided, we want to make sure it becomes an absolute path
1578+
$OutputPath = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($OutputPath)
15761579
}
15771580

15781581
# If the -OutputPath does not exist

docs/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
### HelpOut 0.5.1:
2+
3+
* Save-MarkdownHelp - -OutputPath now handles relative paths (#159)
4+
* Markdown Help Formatting - Trimming Whitespace (#161) (rendering should be unchanged)
5+
6+
Thanks @PrzemyslawKlys !
7+
8+
---
9+
110
### HelpOut 0.5:
211

312
* Install-MAML - Adding -NoComment (#157)

0 commit comments

Comments
 (0)