Posting Code in the Forums

Request to change feature.

Topic: Solutions to Issues involving "Code" in the forums


Description:

Currently, members of the forums are constantly having the same issue of posting code straight into the forums page like I have posted below. Due to this we cannot see their actual code and therefor we must ask them to fix it when the individual may not know how to. This issue causes frustration to the whole community, and I have thought of a few solutions that may be practical in eliminating this issue.

Current problem:

What we see:

hello

What we see when the code is marked correctly:

<p><s><i><b>hello</b></i></s></p>


Proposed solutions:

- Right now in order to mark anything as code you must either indent the entire pasted code 4 spaces, or put three backticks above, and below the code
```
<code>
```
 <code>
  1. Automatically assuming the user is posting “Code”: If we could possibly reverse this or automatically put them into the post this would ensure that new comers would more ably post their code, enabling help to come at a quicker pace. This would alleviate the pain of figuring it out later. In essence, it’s just dummy-proofing the forums.
  • Popups whenever code is recognized: While I believe this would be a lot harder to accomplish, I believe that we could have a popup appear one time per post after a “tag” || “<p>” has been recognized that offers the user the option to enclose their post in back-ticks ( ` ) like example 1) above. This would do the same as 1. however it would not be automatic unless someone was posting code.

  • Reversing Code & Text conditions: As we know, currently you need the back-ticks, or spacing in order to post code in flat text format that code may be read instead of interpreted by the computer. What if instead we reversed those rules and made it instead of Code->Text, that it become Text->Code format. In more detail that means in order to post regular text, and have pictures or links be followed, we invert the current process. We could make the back-ticks allow the code run, instead of the current process or just allowing the code to be seen.

I understand that most of these are hard to change, or impractical in some way. However those are a few of the solutions that I’ve been able to think of recently allowing new users to more easily post code in a way that they may be able to receive help in a quick and efficient manner without jumping through hoops to figure out how the forums works. Essentially Dummy-Proofing the system.


Pros:

  1. Dummy-Proofing the forums allows it’s primary function to be fulfilled. Assisting members quickly and efficiently. (Main argument)
  2. Allows quicker response times between users, and members. (Sub-Argument)
  3. Eliminates a recurring problem in the forums (Sub-Argument)

Cons:

1. May not be possible with the current forums set-up. (Main Argument) 2. May cause confusion for old Members through Admins (Sub-Argument) 3. May cause unknown consequences, things I haven't thought of (Sub-Argument)

Do you want to see this in CodeCademy?

[poll] - Yes, this would be awesome! - No, There's a better way, or I like it like this! - This does not affect me. [/poll]

Additional Remarks:

I cannot claim to know if this is even possible. Or even if any of these are the right direction to pursue in this issue. All I hope to accomplish is setting all of us on the right track to further assist, new members to the forums so they don't become overwhelmed and just give up. This is supposed to be easy for them to get the help they require, and in a timely, or efficient manner.

Experienced users will be the ones that this change impacts the most as we already have a grasp on how the forums work and the change will probably be jarring as most changes are. Otherwise, I hope that in newer users will be positively impacted by implementing any of these, or other solutions.

Let me know if there’s anything else I need to add, or wasn’t clear on and I will do my best to correct and clarify the error.

-Alex

1 Like

Hey Alex,

Going through your suggestions in order:

  1. Putting three backticks at the beginning and end of the post, while not ideal, I think is probably the best solution currently
  2. That would be great, but 1) hard to make, & 2) users ignore stuff right in front of their eyes. Jeff Atwood (one of the guys who makes Discourse and used to work on Stack Overflow) has written about how users don’t care how their post looks, so it would essentially be wasted effort. He proposed something similar to #1.
  3. That would make all of the currently properly formatted posts get reversed, causing problems, and I don’t think it’s possible without a lot of work.

So I’m going to vote for #1.

Under Cons, I think that reversing properly formatted posts is something you may not have thought of yet.

I think that starting off each post like this:

```
|
```

with the cursor in the middle (represented by the pipe sign (|)) would be the best idea, since then all code (and all text as well) would look like code. URLs would get a bit difficult, but most of the people who don’t pay attention to how their post looks also don’t put URLs in their posts much, so that wouldn’t be too much of a problem.


Until this happens, or if it doesn’t ever happen, I’ll share a trick I found for viewing someone’s code:

Each post gets given a data-post-id attribute. On this post, it’s 62063. Once you find the post’s id, you can go to:

http://discuss.codecademy.com/posts/[post id].json

then under the raw section, you can see the post’s contents, not formatted, or with the HTML stripped. Firefox makes this easier than Chrome; you get a handy JSON viewer with Firefox, whereas Chrome just shows you the plain text.

2 Likes

Right, I am using an outdated Internet explorer, and I have no way of opening “json” at current. So viewing users posts without text-only format enabled is proving more than difficult. I see where you’re going with that though and I understand. I put the possibilities in order from least, to most degree of difficulty. Thank you for your input on it and I was thinking the same thing in terms of your suggestion looking similar to:

```
|
```

with the user “pipe” sign indicating text at the base. That is what I imagined first and foremost. Also I’m not strictly stating that my choices are right either, I am opening a door to possibilities and as long as the forums benefit, I’m not apposed to any solution that the community can bring.

2 Likes