Markdown, how can I set the language highlighting display in Stack Overflow to ruby? [duplicate]

StackOverflow https://stackoverflow.com/questions/10441441

Question

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.

Était-ce utile?

La solution

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.

(use lowercase letters, uppercase letters like <!-- language: C# --> does not work.)

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top