I had to find me a good html/css code displaying plugin for WordPress. Most of them are based upon http://alexgorbatchev.com/SyntaxHighlighter/. But the original plugin doesn’t have an installer. So there are several others who made code highlighting plugin to easily integrate to WP.
I will try Syntax Highlighter Compress to start. Seems to be a good plugin, it adds a button in editing post toolbar, with all the options. If it’s not good will try to use SyntaxHighlighter Evolved maybe. Or even WP-GeSHi-Highlight, but it’s still in Beta and when I copy code from it, it leaves unnecessary signs. But let’s see how that Compress plugin works.
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <h1>Code Highlighter</h1> <p>Test HTML Code Display in WP</p> </body> </html>
There is an option to highlight some lines of code, etc. with following tags:
<pre class="brush:php; html-script: true; collapse: true; ruler: true; first-line: 10; highlight: [2, 4, 6]">...</pre> <!-- I see the code is not generating horizontal scrollbar in Explorer, when first tag is PRE --> <!-- the second problem there is some small icon on the right, it moves together with horizontal scroll --> <!-- so I probably should polish original highlighter code css -->
Update: This plugin doesn’t work with my favorite lightbox plugin called WP-prettyPhoto. So I”ll use something else..
Update 2: …And after some checking, I see that the most beautiful and nice plugin is SyntaxHighlighterPro. It’s based on same Alex Gorbatchev’s SyntaxHighlighter, as previously tested Syntax Highlighter Compress. It’s not latest and doesn’t have WYSIWYG editing as that Compress, but still works and does not interfere with other plugins, and has important features (view source, copy and print) in top right corner of Code box. Looks right to me.
Update 3: Now I’m using WP SyntaxHighlighter plugin, because it’s getting updates, also now I realize that copy icon in SyntaxHighlighterPro was needed only because line numbers were entering the buffer on copy. In the new version of Alex Gorbatchev’s script it doesn’t happen.