Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Basics (Retired) Making Decisions with Conditional Statements The Conditional Challenge

Brian Stumbaugh
Brian Stumbaugh
2,161 Points

how do I format my code in these question forums?

I see that some people are able to format their code......is there some symbols or something that I have to wrap my code?

thanks in advance.

HI, Konrad here . Please press EDIT on this question and look what i did to achieve the effect you want.

<h1> Hello </h1>
h1 {
     color:transparent;  /*Spot the error ;D */
}
var car = wheels;

//Code
Random things 

Make sure you live extra space on the ` .

5 Answers

Roy Penrod
Roy Penrod
19,810 Points

You use three backtick characters to enclose your code. The backtick key is usually directly to the left of the 1 key on most keyboards. If you hold shift and hit it, you get a tilde.

After the opening three backticks, you can specify the language you're using to get proper syntax highlighting. Here's what it would look like for JavaScript:

 ```javascript
Roy Penrod
Roy Penrod
19,810 Points

You close it with the same three backticks, but without the language. It's not showing in the code above for some reason.

Konrad Pilch
Konrad Pilch
2,435 Points

Im a MOD so i can edit other posts. What i find useful in it is that i mainly fix the code of other people which helps me if I'm helping them, as well as others plus its a good way to see how to do other things such as adding images which i never knew how to unless I checked on edit and saw how they did it.

It would be good if Treehouse would add a 'preview' of the back end of the writing or 'edit' with read me only .

Konrad Pilch
Konrad Pilch
2,435 Points

I just showed you how to do it, press on your post EDIT. As well as look here at markdownsheet

+

Look wher eis Post answer, above it should be Markdown Cheatsheet.

Heres how you post code to treehouse and more :)

Markdown Cheatsheet
Markdown is a short-hand syntax for easily converting text to HTML. Below are some popular examples of Markdown formatting. For more examples reference Markdown Basics for a more detailed overview.

Links
This is an [example link](http://example.com/)

Code
Wrap your code with 3 backticks (```) on the line before and after. If you specify the language after the first set of backticks, that'll help us with syntax highlighting.

            ```html
            <p>This is code!</p>
            ```

Italic
Here’s a word that is *emphasized*

Bold
Here’s a word that is **bold**

Images
![alt text](/path/to/img.jpg "Title")

Unordered List
+ Candy
+ Gum
+ Peanuts

Ordered List
1. Red
2. Green
3. Blue
Roy Penrod
Roy Penrod
19,810 Points

Konrad, how did you add the code samples to Brian's post?

Brian Stumbaugh
Brian Stumbaugh
2,161 Points

thanks for your reply!

one more question: so when you do

// Look up i opened it - press edit and see what i did.

are you putting the name of the language in there just for color formatting?

// Look below, i closed it 
Konrad Pilch
Konrad Pilch
2,435 Points

You have to close it. Press edit on the post to see exactly what i did. It might be confusing up thhere as there are a lot of ticks.

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hi Brian,

Take a look at this previous post on the subject by Dave McFarland.

:)

Great find, Jason!

Brian Stumbaugh
Brian Stumbaugh
2,161 Points

don't respond....just practicing here. thanks guys!

<h1>this is html</h1>
h1 {
  color: blue;
}
var a = 1;

doestnt seem to work for me

<p> Just trying it out </p>