What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 128 Stack Exchange communities.

Would like the ability to apply a highlighter (background yellow, red, etc..) to identify a specific section of code to draw attention to it. Note that this would be inside of the formatted code itself.

share|improve this question

4 Answers 4

up vote 3 down vote accepted

http://pastebin.com does this in a very neat way!

"To highlight particular lines, prefix each line with @@" I see it as a proper inspiration.

Pastebin is also open source: http://pastebin.com/pastebin.tar.gz So it is easy to see how the implementation works.

share|improve this answer

That would require changes to the code used to do syntax-coloring right now, which isn't managed by SO. It would be a nice feature though. Perhaps for now your best bet is to show the code without its context, and with its context. It's a bit more verbose than what you're proposing, but it's the best way I can think to achieve this right now.

Example:

What's wrong with this:

echo ('Hello World);

From this:

public function introduction() {
  if (isset($foo)) {
    $bar->logConv();
    echo ('Hello World);
  }
}
share|improve this answer

Tell it to google-code-prettify; that's what SO uses. Of course, you can always just do something like:

here
is
important stuff
some
code

Note this section:

important stuff
share|improve this answer
4  
Or just... add comments to the code. –  Shog9 Sep 29 '09 at 18:33

Post minimal code fragments that have been abstracted down to just what it takes to exhibit the problem?

Then all the code is necessary, and highlighting is not.

/pet peeve

I know that this is not always possible, but it is possible much more often than people use it.

share|improve this answer

You must log in to answer this question.

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