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

Andres Chaves
Andres Chaves
3,462 Points

How I can insert code correctly when asking a question

I see when everyone place code in the question is showing nice in a box. How I can do that?

1 Answer

Click on the Markdown Cheatsheet link toward the bottom of the page. There is also a course here.

The main thing to get your code formatted along with syntax coloring is to put three backticks followed by the langauge name before your code and three backticks after your code. An example is shown @3:48 in this video from the course.

1) Python example without backticks:

This is a comment

if 5 > 2: print("Five is greater than two!")

2) Python example with backticks:

#This is a comment
if 5 > 2:
    print("Five is greater than two!")

3) Python example with backticks and language name

#This is a comment
if 5 > 2:
    print("Five is greater than two!")
Andres Chaves
Andres Chaves
3,462 Points

Great !, Thanks Kris!