Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 157 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

Possible Duplicate:
Syntax highlighting language hints
Interface options for specifying language prettify

How do I set the language being highlighted in Stack Overflow to be colored and formatted for ruby?

I've seen this somewhere but can't find it now.

Something like a one line option at the top of a file.

share|improve this question

migrated from stackoverflow.com May 4 '12 at 10:12

This question came from our site for professional and enthusiast programmers.

marked as duplicate by Cody Gray, Yi Jiang, Pops, ChrisF, animuson May 25 '12 at 0:34

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 12 down vote accepted

You can't highlight a language with Markdown. You need to outsource this to external libraries. Such as.

  1. SyntaxHighlighter
  2. Google Code Prettify
  3. Pygments

EDIT: The StackOverflow way of doing this is to have a comment at the top. Like so.

<!-- language: lang-js -->

Just replace lang-js with one of the language codes or a tag to set the language to the language associated with that tag. For example.

<!-- language: C# -->

Highlighting for C# is associated with the C# tag.

share|improve this answer
    
Good point, my question was not clear so i added more detail. – Michael Durrant May 4 '12 at 1:18
1  
+1 Yup, lang-rb for ruby worked for me (maybe I can do mutiple languages on one page even?) – Michael Durrant May 4 '12 at 1:30
    
I would assume so. – user184498 May 4 '12 at 1:33

Not the answer you're looking for? Browse other questions tagged .