Skip to content

Fix output block closing fence when content lacks trailing newline#32

Open
vorou wants to merge 1 commit into
simonw:mainfrom
vorou:fix-output-no-trailing-newline
Open

Fix output block closing fence when content lacks trailing newline#32
vorou wants to merge 1 commit into
simonw:mainfrom
vorou:fix-output-no-trailing-newline

Conversation

@vorou
Copy link
Copy Markdown

@vorou vorou commented Mar 11, 2026

All the following is generated by CC, but I've read it, and it makes sense to me. Built and tested locally too!

Summary

  • Commands like printf "hello" produce output without a trailing newline, causing the closing fence to land on the same line as the output (`hello), breaking the resulting markdown
  • Added a conditional newline before the closing fence when output content doesn't already end with \n
  • Added TestWriteOutputNoTrailingNewline test case

Reproduction

showboat init /tmp/repro.md "Repro"
showboat exec /tmp/repro.md bash 'printf "hello"'

Before: hello``` (broken markdown)
After:

hello

Test plan

  • go test ./... — all existing tests pass
  • New test TestWriteOutputNoTrailingNewline covers the fix
  • Manual verification with printf "hello" produces valid markdown

🤖 Generated with Claude Code

Commands like `printf "hello"` produce output without a trailing newline,
causing the closing ``` fence to land on the same line as the output and
breaking the resulting markdown.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant