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

Development Tools

Posting code in questions

Hello, i remember when i first started here at team treehouse there was a tutorial on how to put code, properly formatted, into questions and comments.

Can somebody please redirect me to that resource one more time, I can't find it now.

class Post:
    subject = "code blocks"
String firstName = console.readLine("Enter your first name:");
<h1>WELCOME!</h1>
<p>This is just nonsense</p>

[MOD: added code blocks for demonstration purposes - srh]

2 Answers

Ryan S
Ryan S
27,276 Points

Hi Chris,

Are you referring to the Markdown Cheatsheet? It is linked at the bottom of questions, answers, and comments and provides some basic guidelines for using Markdown styling, including code formatting.

For code formatting, you need to surround your code with 3 back ticks. Note that these are not apostrophes, but the back tick found in the upper left corner of your keyboard. If you add the name of the programming language immediately after the opening back ticks, it will add some syntax highlighting that is typical of that language.

For example:

```python

print("Treehouse")

```

Will produce the following:

print("Treehouse")

There is also an "eye" icon in the bottom right corner of the text box that you can click to preview your post before submitting.

Hi Chris,

I edited your original post with three code block examples. If you edit it yourself, you'll see exactly how code blocks are produced. Ryan is correct, but I thought a demonstration might help too.

All the best!

Steve.

yep, great now im up and running, thanks :)

No problem! Always happy to help. :+1: :smile: