mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user