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

General Discussion

Hayden Taylor
Hayden Taylor
5,076 Points

How to Properly display code in a forum question/answer/comment

I was just wondering how to properly format code so it displays nicely within an Question / Answer / Comment. I notice this issue mostly with html. Keep in mind I already know that if you space the < and > or remove them the code will display but... it displays as a paragraph not keeping the structure which makes it hard to read....

SO

Am I missing something here?

John Schnettgoecke
John Schnettgoecke
2,012 Points

test

<body> 
    <p> Just testing </p>
    <p/> Test #1 </p>

2 Answers

Mike Baxter
Mike Baxter
4,442 Points

At the bottom of where you can comment is a Markdown Cheatsheet. From that sheet you'll find you can use three back ticks ` to create a block of code, and then you can specify which type of code (html, JavaScript, etc.). The one I didn't find on there and learned from a Moderator was how to reference someone by name, which uses the @ symbol and then you start typing the person's name as it appears on the forum. Hope this helps!

Mike Baxter
Mike Baxter
4,442 Points

Back tick ` is (usually) above the tab key. It took me a while to find the first time. Maybe you were looking for that.

Hi Haden,

Look to the bottom-right of the text field where you enter your Question / Answer / Comment. You will see Markdown Cheatsheet. That will show you what to do (if I understand your question). You can also look here to see an example.

Jeff