Skip to content

Commit

Permalink
Updated MDAlert to begin-process block to match module style
Browse files Browse the repository at this point in the history
Removed non-functional changes mentioned in CHANGELOG
  • Loading branch information
belibug committed Jun 6, 2024
1 parent e348999 commit 5a3b50f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
**v1.10** *20240605*
**v1.10** *In progress*
- Fixed issue with GH-33 where the `New-MDQuote` would output extra `> ` between quote lines
- GH-28 Added new command `New-MDAlert` for GFM Alerts - thanks to @belibug
- Updated tests from Pester v4 to v5

**v1.9** *20200227*
- Based on GH-20 the default output of `New-MDTable` has a cell length alignment per column. New parameter `-Shrink` is added to reduce the overall size and each cell is not padded. Thanks to @al-cheb
Expand Down
17 changes: 8 additions & 9 deletions Src/Modules/MarkdownPS/Public/New-MDAlert.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
.EXAMPLE
@("Line 1","Line 2") | New-MDAlert -Style Caution
>> [!CAUTION]
>> Line 1
>> Line 2
> [!CAUTION]
> Line 1
> Line 2
.LINK
Refer "https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts" for more details.
Expand Down Expand Up @@ -77,19 +77,18 @@ function New-MDAlert {

Begin {
$output = ''
$admonition = '[!{0}]' -f $Style.ToUpper()
$output += New-MDQuote -Lines $admonition -Level 1 -NoNewLine
$newLine = [System.Environment]::NewLine
}

Process {
$lines | ForEach-Object {
$output += New-MDQuote -Lines $_ -Level 1 -NoNewLine
}
$output += New-MDQuote -Lines $Lines -Level 1 -NoNewLine
}

End {
$admonition = '> [!{0}]' -f $Style.ToUpper()
$output = $admonition + $newLine +$output
if (-not $NoNewLine) {
$output += [System.Environment]::NewLine
$output += $newLine
}
$output
}
Expand Down

0 comments on commit 5a3b50f

Please sign in to comment.