Markdown code block rendering issues

Noticed a lot of rendering issues when moving Markdown files from GitHub to GitLab. Code blocks seem to be overly sensitive to the content before the starting back ticks and after the ending back ticks. For example, I cannot get the first block to work without making the subsequent sentence a list item.

Here's the Markdown source:

Screen_Shot_2017-12-13_at_4.09.44_PM

And what it looks like when rendered:

Screen_Shot_2017-12-13_at_4.09.54_PM

A second example of ending with a Markdown file with a code block, even with multiple newline characters after the end of the code block:

Screen_Shot_2017-12-13_at_4.10.29_PM

And rendered:

Screen_Shot_2017-12-13_at_4.10.37_PM

Keep in mind that these were all rendering fine in GitHub, so I consider this a compatibility bug with the Markdown engine used by GitLab. I actually had to do a lot of refactoring to make it look this good, including replacing bash with shell (which shouldn't matter, but it does for some reason). The engine also seems to be very particular about having an empty line after the end of a code block, whereas GitHub didn't care. A lot of these issues seem to be related with how the engine deals with lists as well.

EDIT:

Forgot to mention:

  • GitLab: 10.2.4 on Ubuntu 16.04 LTS
  • Browser: Chrome 62 on macOS 10.12.6
Edited by deejross