This question deals with IE specific code blocks that work off special html comments. Is there any way that the code formatted could recognize these special format codes and still comment the javascript (and html) inside?

share|improve this question
add comment

2 Answers

We can force certain language upon a code block by adding such a line above the code:

<!-- language: lang-[language here] -->

After quick trial and error, this one did the trick:

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

More details can be found here.

share|improve this answer
    
And more details at (the links at) How do I format my code blocks? –  Arjan Jan 21 '13 at 20:13
    
Yep, should have linked to that before! :) –  Shadow Wizard Jan 21 '13 at 20:37
add comment

I disagree that conditional comments should be handled by the default syntax highlighter. For one thing, they are an ancient relic, and even IE is discontinuing support for it – as the page you linked to says:

Important As of Internet Explorer 10, conditional comments are no longer supported by standards mode

Fun fact: Until 2012 (!), that page contained the following text instead:

Conditional comments make it easy for developers to take advantage of the enhanced features offered by Microsoft Internet Explorer 5 and later versions, while writing pages that downgrade gracefully in less-capable browsers or display correctly in browsers other than Windows Internet Explorer.

More importantly however, a conditional comment is just that – a comment. So in the context of HTML, it is correct for the syntax highlighter to highlight it as such.

share|improve this answer
add comment

You must log in to answer this question.

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