Question

In SyntaxHighlighter, is it possible to highlight lines with different colors (say, some lines in green, some other in blue)?

Was it helpful?

Solution

I don't know SyntaxHighlighter, but looking at the site it would appear that you can highlight with a single colour, but there's nothing to allow you to use multiple highlight colours.

The only thing I can suggest is to contact the author and suggest it as a feature request.

OTHER TIPS

Like @MatTheCat said, change the background-color on the class alt1 and/or alt2

.syntaxhighlighter .line.alt1 {
    background-color: white !important;
}
.syntaxhighlighter .line.alt2 {
   background-color: #F8F8F8 !important;
}

Each line is a with a class which shows the line number () so apply a background-color to the right class.

The version 3.0.83 supports highlighting of certain lines. See http://alexgorbatchev.com/SyntaxHighlighter/manual/demo/highlight.html

<pre class="brush: php; html-script: true; highlight: [1, 2, 3, 4, 5, 6]">
     line 1
     line 2
     line 3
     line 4
     line 5
     line 6
</pre>

this will highlight line 1 to 6. Check Documentation: http://alexgorbatchev.com/SyntaxHighlighter/manual/demo/highlight.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top