23
\$\begingroup\$

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
```
\$\endgroup\$
17
  • \$\begingroup\$ I think I'd consider that status-bydesign pending "Word of God" from the implementing dev. \$\endgroup\$
    – Vogel612 Mod
    Commented Apr 14, 2019 at 10:10
  • 11
    \$\begingroup\$ @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. \$\endgroup\$
    – Dave
    Commented Apr 14, 2019 at 10:55
  • 5
    \$\begingroup\$ I agree, this does seem like a bug. \$\endgroup\$
    – Simon Forsberg Mod
    Commented Apr 14, 2019 at 14:33
  • 4
    \$\begingroup\$ Appears to be some weird interaction with MathJax. Wild... \$\endgroup\$
    – Shog9
    Commented Apr 16, 2019 at 17:42
  • \$\begingroup\$ Attempting to "bump" because this is still an issue: codereview.stackexchange.com/revisions/229448/1 \$\endgroup\$ Commented Sep 22, 2019 at 20:16
  • 1
    \$\begingroup\$ @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. \$\endgroup\$
    – Dave
    Commented Sep 22, 2019 at 22:04
  • \$\begingroup\$ @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. \$\endgroup\$ Commented Sep 22, 2019 at 22:07
  • 1
    \$\begingroup\$ "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)... \$\endgroup\$ Commented Jan 28, 2020 at 21:16
  • 5
    \$\begingroup\$ @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... \$\endgroup\$
    – Peilonrayz Mod
    Commented Mar 13, 2020 at 13:19
  • \$\begingroup\$ This issue still persists. This was posted on April 13, 2019. It has been 583 days \$\endgroup\$
    – user228914
    Commented Nov 16, 2020 at 15:41
  • 2
    \$\begingroup\$ This is still an issue. I just fixed it on new questions like codereview.stackexchange.com/q/275640/89257 -- at least the work around is easy. \$\endgroup\$
    – chicks
    Commented Apr 9, 2022 at 14:08
  • 1
    \$\begingroup\$ as per crypto.meta.stackexchange.com/questions/1237/…, this doesn't appear to be an issue any more. Can someone involved in the thread still repro it? \$\endgroup\$
    – JNat StaffMod
    Commented Nov 17, 2022 at 14:17
  • 2
    \$\begingroup\$ @JNat: Here's one! \$\endgroup\$ Commented Feb 10, 2023 at 14:27
  • \$\begingroup\$ @JNat Another example, see difference rev 1 and 2. \$\endgroup\$
    – Mast Mod
    Commented Feb 15, 2023 at 9:07
  • 1
    \$\begingroup\$ The issue still seems present: codereview.stackexchange.com/posts/283665/revisions \$\endgroup\$
    – Peilonrayz Mod
    Commented Aug 13, 2023 at 16:05

0

You must log in to answer this question.

Browse other questions tagged .