• mic_check_one_two@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    15
    ·
    edit-2
    1 day ago

    Because it’s meant to be a block of code, not something that formats using MarkDown rules. The point of code blocks is that you can use special characters and have them rendered as plaintext, instead of actually working as special characters. For instance, here’s the classic Reddit shrug:
    ¯_(ツ)_/¯

    Notice that the left arm is missing? That’s because the backslash and underscores are both special characters. The backslash cancels out the underscore, making the backslash disappear. Now here’s the same shrug formatted as code:

    ¯\_(ツ)_/¯ 
    

    Notice that the left arm is visible, (or at least, it should be), because none of the characters were treated as special characters. If the left arm is invisible on your client, that is actually an error in parsing the MarkDown formatting.

    Tangentially, if I wanted to format that shrug without the missing arms, it would actually take three backslashes, like this:

    ¯\\\_(ツ)_/¯ 
    

    The first backslash cancels out the second, making the second visible. Then the third cancels out the underscore, making the underscores visible, if I only used two, the backslash would be visible, but the underscores would disappear and make the head italicized. But by using three, we get this:
    ¯\_(ツ)_/¯

    Notice how I was able to actually show how I used all three backslashes, using the code block?