diff --git a/__tests__/ExpensiMark-HTML-test.js b/__tests__/ExpensiMark-HTML-test.js
index f0da1504..1a137162 100644
--- a/__tests__/ExpensiMark-HTML-test.js
+++ b/__tests__/ExpensiMark-HTML-test.js
@@ -1040,15 +1040,15 @@ test('Test quotes markdown replacement and removing
from
and expect(parser.replace(testString)).toBe(resultString); }); -test('Test quotes markdown replacement including blank quotes', () => { +test('Test quotes markdown replacement skipping blank quotes', () => { const testString = '> \n>'; - const resultString = ''; + const resultString = '>
>'; expect(parser.replace(testString)).toBe(resultString); }); test('Test quotes markdown replacement with text starts with blank quote', () => { const testString = '> \ntest'; - const resultString = 'test'; + const resultString = '>
test'; expect(parser.replace(testString)).toBe(resultString); }); @@ -1078,7 +1078,7 @@ test('Test quotes markdown replacement with quotes includes multiple middle blan test('Test quotes markdown replacement with text includes blank quotes', () => { const testString = '> \n> quote1 line a\n> quote1 line b\ntest\n> \ntest\n> quote2 line a\n> \n> \n> quote2 line b with an empty line above'; - const resultString = 'quote1 line atest
quote1 line b
testquote2 line a'; + const resultString = '
quote2 line b with an empty line abovequote1 line atest
quote1 line b
>
testquote2 line a'; expect(parser.replace(testString)).toBe(resultString); }); diff --git a/lib/ExpensiMark.js b/lib/ExpensiMark.js index e5a2b571..8a1e99ca 100644 --- a/lib/ExpensiMark.js +++ b/lib/ExpensiMark.js @@ -239,10 +239,11 @@ export default class ExpensiMark { // block quotes naturally appear on their own line. Blockquotes should not appear in code fences or // inline code blocks. A single prepending space should be stripped if it exists process: (textToProcess, replacement, shouldKeepRawInput = false) => { - const regex = /^(?:>)+ +(?! )(?![^<]*(?:<\/pre>|<\/code>))([^\v\n\r]*)/gm; + const regex = /^(?:>)+ +(?! )(?![^<]*(?:<\/pre>|<\/code>))([^\v\n\r]+)/gm; const replaceFunction = (g1) => replacement(g1, shouldKeepRawInput); if (shouldKeepRawInput) { - return textToProcess.replace(regex, replaceFunction); + const rawInputRegex = /^(?:>)+ +(?! )(?![^<]*(?:<\/pre>|<\/code>))([^\v\n\r]*)/gm; + return textToProcess.replace(rawInputRegex, replaceFunction); } return this.modifyTextForQuote(regex, textToProcess, replacement); },
quote2 line b with an empty line above