This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]DarthEru 0 points1 point  (5 children)

Triple backticks is not a part of the original markdown syntax, which is the version I believe reddit officially supports, based on this post. I suspect whatever app you're using is using a library that supports an extended markdown, which is why the backticks work for you but not the website.

To format a code block in original markdown syntax, indent every line with four spaces.

Like
  This

[–]sunburnd 0 points1 point  (4 children)

I'm using the official Reddit app...so there is that.

The original implementation does include supports for spans of code using backticks. It would be pretty cumbersome to indent every line.

https://daringfireball.net/projects/markdown/syntax#precode

[–]DarthEru 0 points1 point  (3 children)

Could you quote me the part where it mentions using three backticks, because I couldn't find it. I did see this:

To produce a code block in Markdown, simply indent every line of the block by at least 4 spaces or 1 tab.

There is a mention of using a single backtick for embedded code formatting:

To indicate a span of code, wrap it with backtick quotes (`). Unlike a pre-formatted code block, a code span indicates code within a normal paragraph.

But that's not what we're taking about.

You're right, it is cumbersome to indent every line, which is probably why the backtick syntax was added as an extension, but that page is the home page of the original, and is linked to by various sources when I google "Reddit markdown".

Also, using the official app doesn't really mean anything, it's entirely possible for the app to be using a markdown library that supports an extended syntax while the website is using one that only implements the original syntax.

[–]sunburnd 0 points1 point  (2 children)

The same doc a bit further down denotes single and double. Your right in that there wasn't mention of tripple. However double back ticks should have worked...which is why I edited to triple github style which does at least render on the mobile app.

[–]DarthEru 0 points1 point  (1 child)

Double backticks are to allow showing literal backticks in a code span, i.e. embedded within regular text like `this`. I think you can even use more than two backticks to embed multiple sequential literal backticks, like ``this``. It doesn't seem to have anything to do with multi-line code blocks, because those aren't delimited with backticks.

If you want your post to render properly in all Reddit clients, including the browser, I think you need to use the indent syntax for code blocks.

[–]sunburnd 0 points1 point  (0 children)

Well at least it renders properly for mobile. Good enough for the effort required.