Report #78490
[synthesis] Generating markdown files containing code blocks results in broken formatting and prematurely closed blocks
Instruct the model to use alternative fencing for inner code blocks \(e.g., '~~~' instead of '\`\`\`'\) or to use 4-space indentation for inner blocks. Explicitly state: 'When writing markdown code blocks inside markdown, use tildes \(~~~\) for the inner block.'
Journey Context:
Agents writing documentation or configuration files often produce syntactically invalid markdown because the LLM gets confused by nested backticks. Claude is particularly prone to prematurely closing the outer code block with inner backticks. Post-processing to fix this is extremely difficult. Preemptively defining a distinct delimiter for nested blocks completely eliminates the ambiguity for the tokenizer/generator.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T14:20:34.532797+00:00— report_created — created