开发者

Highlighting lines in different colors in SyntaxHighlighter

In SyntaxHighlighter, is it possible to highlight lines with different colors (say, some lines in green, some other in blu开发者_StackOverflowe)?


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.


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜