markdownToBlocks has no indented-code support, so indented code is space-joined into a paragraph #1273
Notifications
Due Date
No due date set.
Depends on
Reference: sam/archie#1273
Reference in new issue
Block a user
internal/channels/telegram/richblocks.go markdownBlockParser.handleLine recognises fenced code (```) but not CommonMark's 4-space/tab indented code block. An indented block matches none of the cases and falls to default, which space-joins lines into a paragraph and runs them through stripInlineMarkdown.
Proven by overlay probe against the real package:
FENCED -> [{"type":"pre","text":"type D struct {\n\tKey string\n\tLabel string\n}","language":"go"}]
INDENTED -> [{"type":"paragraph","text":"type D struct { \tKey string \tLabel string }"}]
This is the long-standing 'agent concatenates text' complaint. Models routinely emit indented code, especially as continuation inside a list item, and every such block arrives in Telegram as one run-on line with its underscores stripped by archie-core-8x1r on the way.
The space-join itself is correct for prose (see the comment at the default case: Telegram rich-block paragraphs render an embedded newline as nothing at all, so a space is the right soft-break). The bug is that code reaches that path.
Also noted: a blank line emits a spurious empty paragraph block ({"type":"paragraph","text":""}), visible in both probe outputs.
Acceptance criteria
An indented code block produces a pre block with newlines intact, matching the fenced case; blank lines emit no empty paragraph block.
Notes
CORRECTION (2026-09-12): the empty paragraph block is NOT spurious. appendBlock inserts it deliberately as a spacer because Telegram's renderer adds no vertical gap between adjacent blocks. Do not remove it; the acceptance criterion dropping empty paragraphs is withdrawn.
Close reason
Closed
Imported from beads
archie-core-cvu6· GitHub #800 · type bug · priority P1 · created 2026-09-11 · closed 2026-09-11