When a code block ended without a trailing newline after the closing \`\`\`, two bugs occurred in flush_incomplete(): 1. The closing \`\`\` was included as part of the code block content (displayed with syntax highlighting) 2. The same \`\`\` was then emitted again as literal text because current_line was not cleared after being pushed to block_buffer The fix: - Check if current_line is the closing fence before adding to block_buffer - Always clear current_line after processing in the CodeBlock case Added two tests: - test_code_fence_after_blank_line: code fence with trailing newline - test_code_fence_no_trailing_newline: code fence without trailing newline
58 KiB
58 KiB