diff --git a/src/components/markdown/RemarkRenderer.tsx b/src/components/markdown/RemarkRenderer.tsx index 155e0ebd..824e5ab0 100644 --- a/src/components/markdown/RemarkRenderer.tsx +++ b/src/components/markdown/RemarkRenderer.tsx @@ -184,6 +184,11 @@ const Container = styled.div<{ largeEmoji: boolean }>` */ const RE_QUOTE = /(^(?:>\s){5})[>\s]+(.*$)/gm; +/** + * Regex for matching multi-line blockquotes + */ +const RE_BLOCKQUOTE = /^([^\S\r\n]*>[^\n]+\n?)+/gm; + /** * Regex for matching HTML tags */ @@ -214,6 +219,9 @@ function sanitise(content: string) { // because remark renderer is collapsing empty // or otherwise whitespace-only lines of text .replace(RE_EMPTY_LINE, "‎") + + // Ensure empty line after blockquotes for correct rendering + .replace(RE_BLOCKQUOTE, (match) => `${match}\n`) ); }