From 3e0c1203379af16c0ca6357e6bc39a580818f64a Mon Sep 17 00:00:00 2001 From: Alex Sarafian Date: Fri, 31 May 2024 14:36:18 +0000 Subject: [PATCH] GH-33 Fixed multi line issue with New-MDQuote --- CHANGELOG.md | 3 +++ README.md | 1 - Src/Modules/MarkdownPS/MarkdownPS.psm1 | 2 +- .../MarkdownPS/Public/New-MDQuote.Tests.ps1 | 16 ++++++++-------- Src/Modules/MarkdownPS/Public/New-MDQuote.ps1 | 8 ++++---- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 539bb0b..4f9bd5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +**v1.10** *20240531* +- Fixed issue with GH-33 where the `New-MDQuote` would output extra `> ` between quote lines + **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 diff --git a/README.md b/README.md index 7718671..6d387e3 100644 --- a/README.md +++ b/README.md @@ -233,7 +233,6 @@ $markdown > Multi line quote > > > Line 1 -> > > > Line 2 > > # Links diff --git a/Src/Modules/MarkdownPS/MarkdownPS.psm1 b/Src/Modules/MarkdownPS/MarkdownPS.psm1 index b2ff4df..ea26808 100644 --- a/Src/Modules/MarkdownPS/MarkdownPS.psm1 +++ b/Src/Modules/MarkdownPS/MarkdownPS.psm1 @@ -5,7 +5,7 @@ "RootModule"="MarkdownPS.psm1" "Description"="PowerShell module for Semantic Version" "Guid"="c1e7cbac-9e47-4906-8281-5f16471d7ccd" - "ModuleVersion"="1.9" + "ModuleVersion"="2.0" # Optional fields "Author"="Alex Sarafian" # "CompanyName" = "Company name" diff --git a/Src/Modules/MarkdownPS/Public/New-MDQuote.Tests.ps1 b/Src/Modules/MarkdownPS/Public/New-MDQuote.Tests.ps1 index c67e167..70e0de7 100644 --- a/Src/Modules/MarkdownPS/Public/New-MDQuote.Tests.ps1 +++ b/Src/Modules/MarkdownPS/Public/New-MDQuote.Tests.ps1 @@ -25,7 +25,7 @@ Describe -Tag @("MarkdownPS","Cmdlet","Public","New-MDQuote") "New-MDQuote" { @("Line 1") | New-MDQuote | Should -Be $expected } It "-Lines count is 2 & -Level not specified" { - $expected="> Line 1"+$newLine+">"+$newLine+"> Line 2"+$newLine+$newLine + $expected="> Line 1"+$newLine+"> Line 2"+$newLine+$newLine New-MDQuote -Lines @("Line 1","Line 2") | Should -Be $expected @("Line 1","Line 2") | New-MDQuote | Should -Be $expected } @@ -52,17 +52,17 @@ Describe -Tag @("MarkdownPS","Cmdlet","Public","New-MDQuote") "New-MDQuote" { @("Line 1") | New-MDQuote -Level $level | Should -Be $expected } It "-Lines count is 2 & -Level provided" { - $expected="> Line 1"+$newLine+">"+$newLine+"> Line 2"+$newLine+$newLine + $expected="> Line 1"+$newLine+"> Line 2"+$newLine+$newLine $level=1 New-MDQuote -Lines @("Line 1","Line 2") -Level $level | Should -Be $expected @("Line 1","Line 2") | New-MDQuote -Level $level | Should -Be $expected - $expected=">> Line 1"+$newLine+">>"+$newLine+">> Line 2"+$newLine+$newLine + $expected=">> Line 1"+$newLine+">> Line 2"+$newLine+$newLine $level=2 New-MDQuote -Lines @("Line 1","Line 2") -Level $level | Should -Be $expected @("Line 1","Line 2") | New-MDQuote -Level $level | Should -Be $expected - $expected=">>> Line 1"+$newLine+">>>"+$newLine+">>> Line 2"+$newLine+$newLine + $expected=">>> Line 1"+$newLine+">>> Line 2"+$newLine+$newLine $level=3 New-MDQuote -Lines @("Line 1","Line 2") -Level $level | Should -Be $expected @("Line 1","Line 2") | New-MDQuote -Level $level | Should -Be $expected @@ -78,7 +78,7 @@ Describe -Tag @("MarkdownPS","Cmdlet","Public") "New-MDQuote -NoNewLine specifie @("Line 1") | New-MDQuote -NoNewLine | Should -Be $expected } It "-Lines count is 2 & -Level not specified" { - $expected="> Line 1"+$newLine+">"+$newLine+"> Line 2"+$newLine + $expected="> Line 1"+$newLine+"> Line 2"+$newLine New-MDQuote -Lines @("Line 1","Line 2") -NoNewLine | Should -Be $expected @("Line 1","Line 2") | New-MDQuote -NoNewLine | Should -Be $expected } @@ -105,17 +105,17 @@ Describe -Tag @("MarkdownPS","Cmdlet","Public") "New-MDQuote -NoNewLine specifie @("Line 1") | New-MDQuote -Level $level -NoNewLine | Should -Be $expected } It "-Lines count is 2 & -Level provided" { - $expected="> Line 1"+$newLine+">"+$newLine+"> Line 2"+$newLine + $expected="> Line 1"+$newLine+"> Line 2"+$newLine $level=1 New-MDQuote -Lines @("Line 1","Line 2") -Level $level -NoNewLine | Should -Be $expected @("Line 1","Line 2") | New-MDQuote -Level $level -NoNewLine | Should -Be $expected - $expected=">> Line 1"+$newLine+">>"+$newLine+">> Line 2"+$newLine + $expected=">> Line 1"+$newLine+">> Line 2"+$newLine $level=2 New-MDQuote -Lines @("Line 1","Line 2") -Level $level -NoNewLine | Should -Be $expected @("Line 1","Line 2") | New-MDQuote -Level $level -NoNewLine | Should -Be $expected - $expected=">>> Line 1"+$newLine+">>>"+$newLine+">>> Line 2"+$newLine + $expected=">>> Line 1"+$newLine+">>> Line 2"+$newLine $level=3 New-MDQuote -Lines @("Line 1","Line 2") -Level $level -NoNewLine | Should -Be $expected @("Line 1","Line 2") | New-MDQuote -Level $level -NoNewLine | Should -Be $expected diff --git a/Src/Modules/MarkdownPS/Public/New-MDQuote.ps1 b/Src/Modules/MarkdownPS/Public/New-MDQuote.ps1 index 44b1611..b7f7864 100644 --- a/Src/Modules/MarkdownPS/Public/New-MDQuote.ps1 +++ b/Src/Modules/MarkdownPS/Public/New-MDQuote.ps1 @@ -81,10 +81,10 @@ function New-MDQuote { Process { $Lines|ForEach-Object { - if($output -ne "") - { - $output+="$prefix"+[System.Environment]::NewLine - } + # if($output -ne "") + # { + # $output+="$prefix"+[System.Environment]::NewLine + # } $output+="$prefix "+$_+[System.Environment]::NewLine } }