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

Emoji support and Syntax-Highlighting

Hello beloved Treehouse members! We've got an extra fun little update for you today with two new things that we're pretty excited about.

First, here on the forum, you're now able to use emoji for those times when words just aren't enough. If you're new to emoji, you can check out the emoji cheat sheet. To write emoji, just type a colon, then the word, then another colon and you're done! When you submit your post or response, it'll show up. :smiley:

The second thing is syntax-highlighting for code blocks here on the forum. Now when you share code, you can specify the language and it will be properly syntax-highlighted when you submit. To do so, just type three back ticks (that key to the left of the 1 on your keyboard), then the language (like ruby, python, javascript, etc.), and put your code below. Then just close it off with three back ticks and you're done! If you're sharing HTML or CSS you won't even have to specify the language. It'll just assume those by default.

```ruby
[code goes here]
```

Here's an example of some code rendered with syntax-highlighting:

def my_method(syntax)
  syntax.is_highlighted?
end

Pretty neat, huh? We think so too. We hope that these two little updates will help make the forum a more fun and enjoyable experience for everyone.

Oh, and if you use Redcarpet for rendering Markdown like we do, you can also check out the gem we wrote to make all this emoji and syntax-highlighting magic happen.

:shipit:

10 Answers

James Barnett
James Barnett
39,199 Points

Using emoji in markdown feels soo wrong :smiling_imp:

I'm super excited about syntax highlighting for code blocks :grinning:

James Barnett
James Barnett
39,199 Points

On another note, looks like @chalkers has his own emoji :bowtie:

samiff
samiff
31,206 Points

What's the best way when copy/pasting code to have it show up correctly? Manually indenting each line seems tedious, and I really dislike having to reformat my spacing so it's readable. Someone please tell me I'm doing it the hard way.

Sam, I'd recommend using soft-tabs in your text editor. That will make all of your tabs effectively spaces, but they should still behave like tabs.

With spaces in place, you should be able to simply copy and paste, add the code fences (the back ticks above and below) and you're all set.

Also, note that with code fences, you don't need to indent four spaces to trigger a code block.

samiff
samiff
31,206 Points

Thanks Sean for the tips, the back ticks alone should help in my case then as I was looking for a code tag of sorts earlier.

James Barnett
James Barnett
39,199 Points

Setting soft tabs isn't required, as I use regular tabs in my text editor and copy & pasting that code into forum correctly formats it as code blocks.

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher
public static void main(String args[]) {
  System.out.println("Hello, :earth_americas:!");
}
James Barnett
James Barnett
39,199 Points

@Ben - oh you crazy Java programmers

Michael Watson
STAFF
Michael Watson
Treehouse Teacher

What's the difference between :punch: 'punch' and :facepunch: 'facepunch'? :laughing: