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

Posting code within the community

I realize this is a very primary question, but I can't think of a better place to ask it. How do I post my code in the correct format when I ask a question here in the Community?

3 Answers

Steven Beckham
seal-mask
.a{fill-rule:evenodd;}techdegree
Steven Beckham
iOS Development Techdegree Student 2,979 Points

Directly under the text box where you type your message (and above the "Post" button) there is a link to the Markdown Cheatsheet. I think this is the answer you're looking for though:

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.

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Here's a good Post by Dave on Posting Code in the Community.

Note: changed topic of Posting to General Discussion as it doesn't directly pertain to specific Treehouse content.

Great! Thanks Jason. One follow-up to that; I notice that when I paste my code, the text is only in Orange. Why isn't my code highlighted with Swift syntax as I see with most of the other questions/responses in the Community?

Jason Anders
Jason Anders
Treehouse Moderator 145,860 Points

To add syntax highlighting, just insert the name of the language directly after the opening 3 backticks with no space.

eg.

```swift

:dizzy: