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

I posted a question in the and noticed the code wasn't highlighted. I think it would be appropriate to associate with the Javascript language, similar to for instance backbone.js.

I know how to get the highlighting to work: tag it with or use Syntax highlighting language hints. I could do that, but (as I see it now) it's a d3.js question. If I'd tag it with Javascript, that would be just to get the highlighting. I wouldn't tag an asp.net question with c#, just to get the highlighting to work.

If that is the preferred way instead of requesting associating a tag with a language, I'll be happy to do that, just let me know in an answer here.

share|improve this question
    
@Close voter: why is this off topic? –  Marijn Jul 13 '12 at 9:13
    
Why would you not also tag that question with javascript? –  Bill the Lizard Jul 13 '12 at 12:15
    
Well, I could do that, but (as I see it now) it's a d3.js question. If I'd tag it with Javascript, that would be just to get the highlighting. I wouldn't tag an asp.net question with c#, just to get the highlighting to work. I'll edit my question a bit. –  Marijn Jul 13 '12 at 12:32
4  
Okay, that makes sense. I do see a lot of uses of the tag by itself, and it's rarely used in conjunction with other languages that aren't JavaScript, so I guess it won't hurt anything. I went ahead and applied lang-js to the d3.js tag. –  Bill the Lizard Jul 13 '12 at 12:38
    
OK, thanks Bill. –  Marijn Jul 13 '12 at 12:40

2 Answers 2

You can use an HTML comment in your answer to specify a language for syntax highlighting. From Markdown help:

To manually specify the language of a code block, insert an HTML comment like this before the block:

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

    setTimeout(function () { alert("JavaScript"); }, 1000);

You can also specify a language for all code blocks in the answer with:

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

I've edited that into your answer.

share|improve this answer
    
Thanks, I'm familiar with that option! –  Marijn Jul 13 '12 at 9:11
    
Yeah, I agree it would probably be easier if it was picked up automatically, but thought this could be useful for some people. It took me ages to realise you could do this! –  James Allardice Jul 13 '12 at 9:12
    
It's good to know indeed; especially when you have tags with conflicting highlighting languages. –  Marijn Jul 13 '12 at 9:14
    
Thanks for the edit to my question, but I'll remove it so that my feature request is clear for everyone. –  Marijn Jul 13 '12 at 9:16
    
If this can't be implemented I'll add it again later. –  Marijn Jul 13 '12 at 9:17
up vote 0 down vote accepted

Bill fixed this, see his comments to my question above .

share|improve this answer

You must log in to answer this question.

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