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.

Is there a reason that inline-code (with ``, of course) in answers is excluded from the prettify-process?

Sometimes a piece of code is a bit too small to be blessed with its own blockquote, and so it's merely streamed inline with the rest of a paragraph, but having syntax-highlighting on it would still help to break up the different parts of the code.

(For the record, I don't think this should be included in comments — which has already been discussed here.)

Or does there already exist a way to prettify inline code? (The language of code blocks can be explicitly set with <!-- language: ... -->; could this also be allowed for inline code?)

share|improve this question
    
FYI, I added a greasemonkey script that applies style rules to inline code (but it doesn't make them pretty-printed): meta.stackexchange.com/questions/15429/… –  Kip Aug 19 '09 at 13:16

5 Answers 5

up vote 5 down vote accepted

It's the difference between this:

SuperFunction()

System.DoesItWork

and this:

SuperFunction() System.DoesItWork

The former is (or should be coloured) the latter isn't.

BTW - I vacillate when it comes to this question. Sometimes I'm happy with the way it looks, but other times I wish is was coloured. I think it has to do with the actual words I'm using. If the keywords are normal English then I want them to stand out more. If they're obviously code then I'm happy.

share|improve this answer
    
This answer doesn't actually answer the question, which is "Is there a reason that inline-code ... is excluded from the prettify-process?" This answer just restates the question's problem. –  Max Nanasy Nov 8 '13 at 20:26

I think that the thing with inline code is that it is usually too short a snippet to need syntax highlighting. With long code snippets, this is often useful, since the snippets can be several lines long. However, with inline code, it is often for short keywords or short snippets that, as you say, are too small to be put in their own blockquote.

Normally I use inline snippets for variable names or class names, for instance, and they don't really need colouring as they are only one or two words. If it is hard to read the code and it needs to be broken up to better understand it, then it's probably better to put it on its own line anyway.

share|improve this answer
    
I used the ternary operator the other day - would have loved some color-coding there :) –  Jonathan Sampson Jul 6 '09 at 13:28

Foreground coloration for syntax on inline code would be okay (I lived without out it just fine), but I really hate the background coloration. Inline code is inline because it's supposed to flow with the enclosing text. Changing the background color destroys that continuity and impairs readability.

I agree with Perspx: inline code isn't really for "code", at least not for code complex enough to benefit from syntactic analysis. It's just to set apart keywords, identifiers, and options from surrounding text. If it's more complex than that, make it a block quote.

share|improve this answer
2  
many, including Jon Skeet, felt the font alone was not enough to distinguish the inline code. –  Jeff Atwood Oct 2 '09 at 5:01
    
Argument from authority? –  erickson Aug 31 '11 at 0:39
    
Jeff's style of arguing. But in all seriousness, there's a social hierarchy put in place, simulated with rep that weights users contribution. Which means that naturally higher rep people have more say in how the site works. The privileges are spoken, but there are also unspoken privileges as well. –  Lee Louviere Oct 5 '12 at 13:12

Hmm, this could help differentiate inline code from regular text, especially in block quotes..

share|improve this answer

If I am not mistaken you -can- do syntax highlighting on code in a paragraph (example, I cam now going to call my SuperFunction() right now). All I did was select my little bit of code and hit the code button and it will perform syntax highlighting on it.

Here is another example, this time using my System.DoesItWork value.

Note: This can be achieved by putting backticks on both ends of your little code sample.

If you are speaking of actual color-specific items (like certain parts of code showing red, others blue, etc.) then I could see your point.

share|improve this answer
    
No - it's not come out coloured for me. –  ChrisF Jul 6 '09 at 13:09
    
Not colored for me either. –  Jonathan Sampson Jul 6 '09 at 13:10
3  
Yeah, I'm referring to actual coloring of the different parts. Distinguish $foo from "bar". –  Jonathan Sampson Jul 6 '09 at 13:37

You must log in to answer this question.

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