fix: ensure blockquotes are broken

This commit is contained in:
Paul Makles
2022-09-02 14:17:56 +01:00
parent 9925a10ece
commit 1fc65ae75b

View File

@@ -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`)
);
}