As the title says, Code Blocks sometimes render incorrectly (while writing my own posts) on Discuss. I used to create them using triple backticks, optionally with a language identifier, GitHub Flavored Markdown style, for example:
```bash
# complex one-liners never have comments
my-very-complex-one-liner
```
Note: the snippet above is created using a Preformatted Text block (indent by 4 spaces), which is not the same. It lacks syntax highlighting, causing a snippet to become hard to read.
However, a snippet written with that syntax does not always seem to work anymore. Here’s the same snippet without the preformatted text block indentation:
# complex one-liners never have comments
my-very-complex-one-liner
… which of course works fine now that I want to create a topic about it, even in the preview to the right. When I replied to another post an hour ago a similar snippet did not work. Using the example above, it would render the triple backticks followed by bash as a single backtick followed by bash, the comment as a markdown title and the one-liner as normal text. I should have taken a screenshot. I now edited the post to change the markup from preformatted text to code blocks and it now also works there.
I would cancel the creation of this topic, but it’s happened to me before in the passed couple days and I have an example where it did not work as expected with proof I am not crazy . In this reply I could not get code blocks to work either. I tried many different things and at some point during my experimentation I accidently placed 4 opening backticks instead of 3 (it is still closed with only 3 backticks), which to my surprise rendered it correctly:
Has anyone else experienced code blocks being rendered incorrectly?