Repository navigation
Keep nested lists and indentation in Chat messages - #666
Merged
Merged
Conversation
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 <li>); 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 <alexlavaee@microsoft.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Chat showed a nested list as flat sibling bullets, even when the message text was correctly nested Markdown.
Cause
referenceRenderModelhides@chopinmentions before the Markdown is parsed, throughprojectedDisplayUnitsinapps/web/src/chat/references.ts. That projection also collapsed every run of two or more spaces into one. The parser therefore saw this:One space is not enough to nest, so the sub-items became siblings. The same collapse also removed indentation inside fenced code blocks and turned a two-space hard line break into a plain space.
Fix
The projection now drops only the extra space that a removed mention leaves behind.
Ask @chopin about itstill readsAsk about it, and every other space reaches the Markdown parser unchanged. The parser options, allowed elements and list CSS were already correct and are unchanged. Documents render through the editor rather than this path, so they are unaffected.Tests
markdown.test.ts, "indentation keeps nested lists and code blocks intact": covers two-space and four-space nesting, a bullet list under an ordered item, code-block indentation, and the mention-gap space. It failed before the fix (four sibling<li>).chat-composer.e2e.ts, "a sent message keeps its nested list nested": a person sends a three-level list from the composer, and the transcript must show it nested and indented. It failed before the fix, where the accessibility tree showed parent, child, grandchild and next as flat list items.bun test apps/web packages(2241 pass),bun run types,bun run ci, and the chat-composer, chat-mentions and chat-references e2e specs (20 passed).