Skip to main content
replaced http://meta.stackexchange.com/ with https://meta.stackexchange.com/
Source Link

As adequately explained in this postpost, Stack Overflow does not have its own syntax highlighting engine but uses Google Code Prettify. It is however possible to override this syntax in use with a language of your own choice.

But does it allow to mix different languages in one snippet? Apparently, the lexer has troubles to handle the following fragment where three languages are used.

<!-- language: lang-js -->
var a = 3;
while( !(a < 0)){
    alert("JavaScript code <b>goes</b> here.");
    a--;
}

<!-- language: lang-css -->
#content {
    margin: 0 auto;
    width: 80%;
}

<!-- language: lang-html -->  
<div id="content">
    <p>Different highlighting in the same snippet</p>
</div>

So, is it possible to mix syntax highlighting?

As adequately explained in this post, Stack Overflow does not have its own syntax highlighting engine but uses Google Code Prettify. It is however possible to override this syntax in use with a language of your own choice.

But does it allow to mix different languages in one snippet? Apparently, the lexer has troubles to handle the following fragment where three languages are used.

<!-- language: lang-js -->
var a = 3;
while( !(a < 0)){
    alert("JavaScript code <b>goes</b> here.");
    a--;
}

<!-- language: lang-css -->
#content {
    margin: 0 auto;
    width: 80%;
}

<!-- language: lang-html -->  
<div id="content">
    <p>Different highlighting in the same snippet</p>
</div>

So, is it possible to mix syntax highlighting?

As adequately explained in this post, Stack Overflow does not have its own syntax highlighting engine but uses Google Code Prettify. It is however possible to override this syntax in use with a language of your own choice.

But does it allow to mix different languages in one snippet? Apparently, the lexer has troubles to handle the following fragment where three languages are used.

<!-- language: lang-js -->
var a = 3;
while( !(a < 0)){
    alert("JavaScript code <b>goes</b> here.");
    a--;
}

<!-- language: lang-css -->
#content {
    margin: 0 auto;
    width: 80%;
}

<!-- language: lang-html -->  
<div id="content">
    <p>Different highlighting in the same snippet</p>
</div>

So, is it possible to mix syntax highlighting?

added 56 characters in body
Source Link

As adequately explained in this post, Stack Overflow does not have its own syntax highlighting engine but uses Google Code Prettify. It is however possible to override this syntax in use with a language of your own choice.

But does it allow to mix different languages in one snippet? Apparently, the lexer has troubles to handle the following fragment where three languages are used.

var a = 3;
while( !(a < 0)){
    alert("JavaScript code <b>goes</b> here.");
    a--;
}
#content {
    margin: 0 auto;
    width: 80%;
}
<div id="content">
    <p>Different highlighting in the same snippet</p>
</div>
<!-- language: lang-js -->
var a = 3;
while( !(a < 0)){
    alert("JavaScript code <b>goes</b> here.");
    a--;
}

<!-- language: lang-css -->
#content {
    margin: 0 auto;
    width: 80%;
}

<!-- language: lang-html -->  
<div id="content">
    <p>Different highlighting in the same snippet</p>
</div>

So, is it possible to mix syntax highlighting?

As adequately explained in this post, Stack Overflow does not have its own syntax highlighting engine but uses Google Code Prettify. It is however possible to override this syntax in use with a language of your own choice.

But does it allow to mix different languages in one snippet? Apparently, the lexer has troubles to handle the following fragment where three languages are used.

var a = 3;
while( !(a < 0)){
    alert("JavaScript code <b>goes</b> here.");
    a--;
}
#content {
    margin: 0 auto;
    width: 80%;
}
<div id="content">
    <p>Different highlighting in the same snippet</p>
</div>

So, is it possible to mix syntax highlighting?

As adequately explained in this post, Stack Overflow does not have its own syntax highlighting engine but uses Google Code Prettify. It is however possible to override this syntax in use with a language of your own choice.

But does it allow to mix different languages in one snippet? Apparently, the lexer has troubles to handle the following fragment where three languages are used.

<!-- language: lang-js -->
var a = 3;
while( !(a < 0)){
    alert("JavaScript code <b>goes</b> here.");
    a--;
}

<!-- language: lang-css -->
#content {
    margin: 0 auto;
    width: 80%;
}

<!-- language: lang-html -->  
<div id="content">
    <p>Different highlighting in the same snippet</p>
</div>

So, is it possible to mix syntax highlighting?

edited tags
Link
deleted 6 characters in body
Source Link
jonrsharpe
  • 121.5k
  • 8
  • 48
  • 63
Loading
Source Link
Loading