# Fenced code blocks don't close properly at the end of a post

The new feature, GitHub (tilde) code blocks, from Implement -style (fenced) Markdown code blocks is a great addition, but there is a small bug which bizarrely only appears on Code Review & Code Review Meta. If a code block contains a blank line anywhere, and the closing  isn't followed by a newline, it will be taken as code rather than a closing fence.

The bug applies to both the previews of the posted content. It can be worked around easily enough by finishing the post with a newline but is unexpected. The source of the problem seems to be due to MathJax.

This can result in accidental noise in any code block at the end of a post:

some code

more code but there was a blank line above
$$$$

• I think I'd consider that status-by-design pending "Word of God" from the implementing dev. – Vogel612 Apr 14 '19 at 10:10
• @Vogel612 the thing is that the same bug does not appear on the main meta site, nor on StackOverflow. So I'm thinking it's some interaction with bespoke CodeReview formatting. Also it only manifests if there's a blank line somewhere in the posted code. It's just too weirdly specific to be intentional. – Dave Apr 14 '19 at 10:55
• I agree, this does seem like a bug. – Simon Forsberg Apr 14 '19 at 14:33
• Appears to be some weird interaction with MathJax. Wild... – Shog9 Apr 16 '19 at 17:42
• Attempting to "bump" because this is still an issue: codereview.stackexchange.com/revisions/229448/1 – Carcigenicate Sep 22 '19 at 20:16
• @Carcigenicate I think "bump"ing like that just alerts the OP (in this case, me). If you really want to, you could edit your link into the question text, which will bump it to the front page. People might get annoyed though; voting is the usual way to show agreement. Presumably if it wasn't fixed last time, it won't be fixed now either. – Dave Sep 22 '19 at 22:04
• @Dave Ya, I thought a comment would be sufficient to make the question considered "active", but I checked the active page and it wasn't there. And ya, the comment was ill-thought-out. – Carcigenicate Sep 22 '19 at 22:07
• "it will be taken as code" - do you mean it will be formatted as code? taken gives me images of Liam Neeson on the phone (even though I never saw the movie)... – Sᴀᴍ Onᴇᴌᴀ Jan 28 '20 at 21:16
• @AdamLear could SE append a newline to the body of posts to fix this. A simple if not post.body.endswith('\n'): post.body += '\n'`. Sure it's a monkey patch, but it's been a year... – Peilonrayz Mar 13 '20 at 13:19
• This issue still persists. This was posted on April 13, 2019. It has been 583 days – Aryan Parekh Nov 16 '20 at 15:41