From 2e677c1ea7da9a967375fae8e337e0502f7ceb3c Mon Sep 17 00:00:00 2001 From: Alex Lavaee Date: Fri, 16 Oct 2026 21:38:45 -0700 Subject: [PATCH] Keep nested lists and indentation in Chat messages Chat drew a nested list as flat sibling bullets. The message text was correctly nested Markdown, but the display projection that hides @chopin mentions also collapsed every run of two or more spaces to one before the Markdown was parsed. That shrank a sub-item's two- or four-space indent to one space, too little to nest. The same collapse removed the indentation inside code blocks and the two trailing spaces of a hard line break. The projection now drops only the space a removed mention leaves doubled, so "Ask @chopin about it" still reads "Ask about it". Every other space reaches the Markdown parser unchanged. Documents render through the editor, not this path, so they are unaffected. Assistant-model: Claude Opus 5.5 (fast) Assistant-workflow: inline (fast subagents) Assistant-verification: red-before-fix: markdown.test.ts "indentation keeps nested lists and code blocks intact" failed on the unfixed web app (two-space nested list rendered as four sibling
  • ); chat-composer.e2e.ts "a sent message keeps its nested list nested" failed on the unfixed build (parent, child, grandchild and next as flat list items) Assistant-verification: after fix: bun test apps/web packages passed (2241 pass, 0 fail); bun run types and bun run ci passed; chat-composer, chat-mentions and chat-references e2e passed (20) Co-authored-by: Alex Lavaee --- apps/web/src/chat/markdown.test.ts | 11 +++++++++++ apps/web/src/chat/references.ts | 27 ++++++++++----------------- e2e/chat-composer.e2e.ts | 18 ++++++++++++++++++ 3 files changed, 39 insertions(+), 17 deletions(-) diff --git a/apps/web/src/chat/markdown.test.ts b/apps/web/src/chat/markdown.test.ts index fc56ed534..27ed00cc8 100644 --- a/apps/web/src/chat/markdown.test.ts +++ b/apps/web/src/chat/markdown.test.ts @@ -72,6 +72,17 @@ test("Chat Markdown admits formatting without document features", () => { expect(markdown("Planner wrote **strongly**.")).toContain("strongly"); }); +test("indentation keeps nested lists and code blocks intact", () => { + let nested = + /
  • parent\s*