diff --git a/tests.py b/tests.py
index db321f23c..e4dace257 100644
--- a/tests.py
+++ b/tests.py
@@ -3293,6 +3293,13 @@ def testMarkdownToHtml():
assert markdownToHtml(markdown) == 'This is a quotation:
' + \
'
Some quote or other' + markdown = 'This is a multi-line quotation:\n' + \ + '> The first line\n' + \ + '> The second line' + assert markdownToHtml(markdown) == \ + 'This is a multi-line quotation:
The first line The second line' + markdown = 'This is **bold**' assert markdownToHtml(markdown) == 'This is bold' diff --git a/webapp_utils.py b/webapp_utils.py index 29c965100..7a3fe6b1d 100644 --- a/webapp_utils.py +++ b/webapp_utils.py @@ -73,16 +73,26 @@ def _markdownReplaceQuotes(markdown: str) -> str: return markdown lines = markdown.split('\n') result = '' + prevQuoteLine = None for line in lines: if '> ' not in line: result += line + '\n' + prevQuoteLine = None continue lineStr = line.strip() if not lineStr.startswith('> '): result += line + '\n' + prevQuoteLine = None continue lineStr = lineStr.replace('> ', '', 1).strip() - result += '
' + lineStr + '\n' + if prevQuoteLine: + newPrevLine = prevQuoteLine.replace('\n', '') + result = result.replace(prevQuoteLine, newPrevLine) + ' ' + lineStr += '\n' + else: + lineStr = '
' + lineStr + '\n' + result += lineStr + prevQuoteLine = lineStr if result.endswith('\n') and \ not markdown.endswith('\n'):