Fix backslash escaping in chat messages with hard breaks (#511)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Wes
2026-05-08 10:20:27 -07:00
committed by GitHub
co-authored by Claude Opus 4.6
parent a05577fff7
commit e357d53d55
@@ -370,7 +370,12 @@ function getMarkdownFromEditor(editor: Editor): string {
| { getMarkdown?: () => string }
| undefined;
if (storage?.getMarkdown) {
return storage.getMarkdown();
let md = storage.getMarkdown();
// tiptap-markdown serializes hard breaks as "\" + newline (CommonMark hard
// line break syntax). Chat messages are plain text, not rendered markdown,
// so strip the backslashes to keep clean newlines.
md = md.replace(/\\\n/g, "\n");
return md;
}
// Fallback: plain text
return editor.state.doc.textContent;