Skip to content

Commit

Permalink
Format-Markdown: Changes to -Heading/-HeadingSize (re #41)
Browse files Browse the repository at this point in the history
  • Loading branch information
StartAutomating committed Apr 17, 2022
1 parent f7a65f1 commit 54742c3
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Format-Markdown.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,18 @@ function Format-Markdown
if ($HeadingSize -or $Heading)
{
if (-not $HeadingSize) { $HeadingSize = 2} # If the -HeadingSize was not set, set it to 2.
("#"*$HeadingSize) + " $(if ($Heading) { $Heading} else { $inputObject | LinkInput})" # Output the -Heading or the -InputObject.
$headingContent = "$(if ($Heading) { $Heading} else { $inputObject | LinkInput})"
if ($HeadingSize -eq 1) {
$headingContent
'=' * [Math]::Max($headingContent.Length, 3)
}
elseif ($HeadingSize -eq 2) {
$headingContent
'-' * [Math]::Max($headingContent.Length, 3)
}
else {
("#"*$HeadingSize) + " $headingContent" # Output the -Heading or the -InputObject.
}
}
# If -Code or -CodeLanguage was provided, render a Markdown code block.
elseif ($Code -or $CodeLanguage)
Expand Down

0 comments on commit 54742c3

Please sign in to comment.