forked from abner/for-legacy-web
fix: ensure blockquotes are broken
parent
f6be6d7cf8
commit
b7a10bb9ab
|
|
@ -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`)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue