Jo_Pitts1_0-1697102654611.png

Posting Code in Discussions

Jo_Pitts1
Level 10 - Community Advisor Level 10 - Community Advisor
Level 10 - Community Advisor

People often post code into Discussion posts - and that's a great thing.  It helps the technically minded people amongst dig into the problem and provide solutions, and let's face it - solutions are what we are all looking for here.

 

One thing new users often don't realise is that code posted as regular old text is very hard to read, or they do realise the issue but they don't know how to fix it. 

 

There's a reason coding is done in fixed space type not proportional spaced, and why we have syntax highlighters to show different types of elements.  For instance, compare the readability of this:

<body>
<h1>This is my heading</h1>
<p>And this is a paragraph</p>
<body>

 

vs this:

 

<body>
  <h1>This is my heading</h1>
  <p>And this is a paragraph</p>
<body>

 

 

No contest right?  And that's for a ridiculously simple example.

 

So, how do you do post code like a pro?  It's super easy once you know how

  1. Click on the ellipses in the editor formatting bar.  This exposes the full formatting menu
    Jo_Pitts1_0-1697102654611.png
  2. Click on the </>.  This takes you to the code editor
    Jo_Pitts1_1-1697102705880.png
  3. Chose your language.  For emails, set it to HTML/XML, for Velocity set it to Java.  For all others, go with the obvious.
    Jo_Pitts1_2-1697102775987.png

    Then either paste in, or type in your code.

  4. Click OK. 
  5. You've earned a coffee for posting code like a pro!

This will help get your questions answered quicker and that's got to be a good thing right?

 

459
1
1 Comment