fix(messages): normalize escaped markdown newlines
This commit is contained in:
1 parent
6ce7e63c71
commit
31aac7c0de
9 files changed
+78
-7
No files matched your search
@@ -0,0 +1,12 @@
|
||||
const ACTUAL_LINE_BREAKS = /\r\n?/g;
|
||||
const ESCAPED_CRLF = /\\r\\n/g;
|
||||
const ESCAPED_LF = /\\n/g;
|
||||
const ESCAPED_CR = /\\r/g;
|
||||
|
||||
export function normalizeMarkdownText(text: string): string {
|
||||
return text
|
||||
.replace(ACTUAL_LINE_BREAKS, "\n")
|
||||
.replace(ESCAPED_CRLF, "\n")
|
||||
.replace(ESCAPED_LF, "\n")
|
||||
.replace(ESCAPED_CR, "\n");
|
||||
}
|
||||
Reference in new issue
Block a user