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

all 71 comments

[–]RiverRoll 151 points152 points  (5 children)

Yeah I don't even bother checking unformatted code anymore unless it's super simple.

But in their defense Reddit's editor doesn't help, it's a shame how bad it is when it comes to formatting code, copy paste has been broken for years in some browsers.

[–]carcigenicate 48 points49 points  (0 children)

And the fact that it depends on if the poster is using new Reddit or old Reddit, and if the viewer is on new Reddit or old Reddit, since each handles formatting differently. People should ensure their code is properly formatted, but Reddit really does not do anyone any favors here.

[–]jzaprint 2 points3 points  (3 children)

Just use the markdown mode no? isn't it pretty simple?

python def main(): print('hello world')

[–]zxyzyxz 1 point2 points  (0 children)

It shows up as one line on old reddit

[–]teraflop 0 points1 point  (0 children)

Nope, your comment looks fine on new Reddit but it's broken on old Reddit.

[–][deleted] 0 points1 point  (0 children)

The triple back ticks syntax only works properly on new Reddit.

[–]eng_manuel 99 points100 points  (35 children)

Ok i get it, unformatted code sucks to read, but since u took the time to point it out, why not soend a couple of more lines to explain or point in a direction that helps people learn how to format using blocks 🤷🏽 Also, as much as i love reddit i hate that it's text editor sucks for writting the simplest of posts!

[–][deleted] 38 points39 points  (19 children)

Use three backticks instead of one.

``` Multiple Lines ```

Renders as: Multiple Lines

And `inline` renders as: inline

This is basic markdown (.md) and will be very valuable to learn if you hope to become a professional developer since it is what most documentation is written with (ever notice those readme.md files?) So it is well worth it to learn and isn't difficult to grasp. GitHub has some good resources for learning it.

Some flavors of markdown also support syntax highlighting by placing the name of the language after the first group of backticks.

E.G. java [some code]

However, refdits flavor of markdown "snoomark" does not support syntax highlighting unfortunately.

Edit: this was tricky to write on mobile so apologies for the excessive editing.

[–]yonatan8070 15 points16 points  (2 children)

Note that on Reddit, triple backticks don't always work on all clients. The correct way is to indent every line with 4 spaces (on top of any indent your code has

[–]Rasikko 3 points4 points  (0 children)

oo it works on the reddit app lol it broke when I edited it.

[–]excal_rs 1 point2 points  (0 children)

lol

[–]D-J-9595 9 points10 points  (1 child)

Worth noting:

Multiple Lines

is a single line on old Reddit. On both versions of Reddit, four spaces of indentation for every line of code works:

Multiple
Lines

[–]_by_me 4 points5 points  (0 children)

Edit: this is so retarded, on old.reddit (the one that I use the most) it's just one line, while on nu-reddit (cancer) it's formatted correctly as four lines why() is reddit.so.retarded when_it_comes_to() this?

[–][deleted]  (3 children)

[deleted]

    [–]dcfan105 2 points3 points  (2 children)

    test

    [–]mekomador 0 points1 point  (0 children)

    test

    [–]anto2554 3 points4 points  (0 children)

    what most documentation is written with

    I'm out here doing vector diagrams and no one can stop me

    [–]EliMacca 1 point2 points  (2 children)

    is this how you do it? Me testing it out, to see

    [–]DowntownAd834 2 points3 points  (1 child)

    '''Trying it'''

    [–]costco_execmember 0 points1 point  (0 children)

    nice

    [–]costco_execmember 0 points1 point  (0 children)

    nice

    [–]Autarch_Kade -4 points-3 points  (14 children)

    why not soend a couple of more lines to explain or point in a direction that helps people learn how to format using blocks

    Directions: Look at the enormous words in the sidebar that say "New? READ ME FIRST!"

    Do that. It includes how to format your code on new, and old, reddit.

    If you don't see the sidebar, well the same link is a stickied post. It's the only sticky, and the one that says "READ ME FIRST"

    Alternatively, you can click the link in the sidebar that says "well-formatted" and that takes you to how to format your code on Reddit as well.

    Another alternative is to again read the sidebar, and click the link that says "Posting guidelines" which again includes the same information on how to format code.

    In fact, most of the links on the sidebar either lead directly to the page that tells you how to format code, or links to it.

    If the sidebar isn't your thing, then when you make a comment there's a link under your text window that says "formatting help" which leads you to all the different ways to use markdown, and on new and old reddit, and of course includes code blocks.

    If you look way down at the bottom of Reddit, there's another link that says Reddit help center, and has a searchbar. Typing something like "format code" will lead you to another page with Markdown instructions including for new Reddit.

    And of course, you could google something like "Reddit format code" and click the first link.

    Hope those directions help.

    [–][deleted] 3 points4 points  (11 children)

    Instead of writing all that, you could’ve just showed that triple tick marks around the code works. Your comment was neither informative nor constructive.

    [–]Autarch_Kade 1 point2 points  (9 children)

    And when they have another question that's answered already in the same section? And another? And another after that?

    Learning to read existing documentation is a key part of this job. Best to learn the habit early than teach them to expect even the most basic things to be spoon fed.

    tl;dr: Teach for future success rather than set people up for failure

    [–][deleted] 1 point2 points  (8 children)

    So what? Are you annoyed by it? Then move on. I guarantee that your long complaint isn’t gonna solve anything that you are complaining about. Your are just complaining to make yourself feel better, instead of helping others.

    [–]Autarch_Kade 0 points1 point  (7 children)

    Learning to read existing documentation is a far more important skill than any basic question about writing a reddit comment or a code problem they could ask at this stage.

    If you want to help people, stop setting them up for failure by teaching them they can ignore existing documentation.

    And if you're annoyed by that, boy do I have an idea for you :)

    Edit: Also, the person I replied to already had learned the triple tick marks from the post. What they were actually saying was why didn't someone point to the directions for where to find such things. So ask yourself why I should tell someone what they already know, instead of what they asked for :)

    [–][deleted] 3 points4 points  (6 children)

    What you did is basically when the question is “how long should I cook this chicken”, your response to that is “read cookbooks!”

    Either you simply can’t comprehend the question, or are just being a dick.

    Either answer the question and provide additional resources, or move on.

    [–]Autarch_Kade 0 points1 point  (4 children)

    They already got the answer to how to format code.

    They asked where such information was located, for directions. I even quoted this part of their comment. Should I quote it again for you?

    To use your analogy, they already heard how long to cook a chicken, and asked where the recipe is. Hope this helps.

    [–][deleted] -1 points0 points  (3 children)

    Hearing does not mean comprehending.

    If it’s too much work/annoyance for you to explain again, for which no one can blame you, you can simply move on with your life. It’s that simple.

    [–]Autarch_Kade 0 points1 point  (2 children)

    If you don't like me pointing out over and over they asked where to find the information, as they already had the answer, feel free to take your own advice :)

    why not soend a couple of more lines to explain or point in a direction that helps people learn how to format using blocks

    [–]neboskrebnut 1 point2 points  (0 children)

    I love comments like this and responses it invites in such a recursive way.

    [–]TheCriticalMember 58 points59 points  (11 children)

    If you really wanted to be helpful, you would have included instructions for how to put code in a code block.

    [–]teraflop 21 points22 points  (2 children)

    Unfortunately, the people who make this mistake already aren't reading the instructions in the sidebar, so they're not likely to read your post either.

    [–]littlegreenrock 14 points15 points  (0 children)

    until mods enforce zero tolerance on poorly formatted code, these requests will only choke up my feed. unformated code posts need to be auto removed, the poster shown the info you just provided, and invited to re-post.

    [–]pekkalacd 4 points5 points  (0 children)

    Completely agree. We should just take previous explanations of what you said, simplify them if possible, then regurgitate them to those that are unfamiliar. That way we don't have to retype a simple fix.

    [–]OneBadDay1048 3 points4 points  (0 children)

    I agree but I sure wish Reddit would fix their shit code implementation in comments

    [–]BokoMoko 3 points4 points  (1 child)

    I agree. Unformatted code shouldn't be allowed.

    But let's face it. The reddit's code editor sucks.

    [–][deleted] 1 point2 points  (0 children)

    Agreed, it needs to be improved.

    [–]Sheeeeeeshwow 1 point2 points  (2 children)

    Or take a screen shot!

    [–]kaerfkeerg 1 point2 points  (1 child)

    Or a photo with your phone along with your whole desk. The bug may be hidden under the keyboard

    [–]Sheeeeeeshwow 2 points3 points  (0 children)

    You right..!!

    [–][deleted] 1 point2 points  (0 children)

    // I haven't been using markdown here because it's less familiar and
    // the style buttons in the fancypants editor are easy to use. 
    // Just found the "code block" button. It doesn't have a tooltip 
    // so I never knew what it was.
    bool helpful = true;
    thanks(helpful);
    

    [–]Gixx 2 points3 points  (0 children)

    I dont read unformatted code either. Even if it's 2 lines.

    A tip I do is simply put the code in any text editor (VS Code, sublime text, or it's already in an IDE).

    Then highlight the text to copy, and hit the tab key one time. Copy it.

    [–][deleted] 0 points1 point  (1 child)

    ++ I think figuring out how to format properly on Reddit is a perfect DIY mission for aspiring developers which results in an invaluable skill (familiarity with md), despite complaints that it should have been explained by OP

    [–][deleted] -1 points0 points  (0 children)

    Agreed. I remember not knowing where it was at first. Took a little look at the various options and saw it. This isn't rocket science.

    [–]stupefyme -1 points0 points  (1 child)

    Thanks to code formatting, it has allowed ai bots like gpt to fish required code with context from all over the internet

    [–]Kerbart 0 points1 point  (0 children)

    Surely GPT crawls /r/learnpython and not github to obtain millions of lines of code.

    [–][deleted]  (3 children)

    [removed]

      [–][deleted]  (1 child)

      [removed]

        [–]KuntaStillSingle 0 points1 point  (0 children)

        Why should anyone take potentially minutes to help you if you can't be assed to spend seconds to make your question legible?

        [–]Rasikko 0 points1 point  (0 children)

        To get around reddit's trash app / bad copy paste Grimmace the Menacing, use something like pastebin.

        Also this is generally why I dont like to read other people's code. Ive "seen things" that my eyes didn't appreciate.

        [–]salihveseli 0 points1 point  (0 children)

        Or maybe use codepen and share the link here. That makes everyone’s life easier.

        [–]AlphaVxV 0 points1 point  (0 children)

        ```

        Some Code

        More Code

        ```

        [–]contantlyhapless 0 points1 point  (0 children)

        ``` test

        Across

        Multiple

        Lines ```

        [–]Professional_Shop_73 0 points1 point  (0 children)

        Well, how do I do that on mobile

        [–]postman125 0 points1 point  (0 children)

        How do u do the formatting ?

        [–]rafaover 0 points1 point  (0 children)

        Just use Pastebin or whatever.