mirror of
https://github.com/revoltchat/revite.git
synced 2024-12-24 06:32:08 -05:00
fix: ensure blockquotes are broken
This commit is contained in:
parent
f6be6d7cf8
commit
b7a10bb9ab
1 changed files with 8 additions and 0 deletions
|
@ -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 a new issue