OK, I know, there are literally dozens of already available syntax highlighters out there. But I want one specifically, that implements line numbers through <ol/>
lists. And that reduces the number of possible ca开发者_如何转开发ndidates to one, Lighter.js. Unfortunately, that is MooTools based, and since I decided some time ago to use jQuery, I don't want to embed yet another library just for syntax highlighting.
The SyntaxHighlighter does something similar, but uses tables for the line numbering, and I don't want to hack it, if there is an already available tool, too.
OK, I finally went with server-side:
PHP: Use GenSHi,
Python: Use Pygments.
Both are easily customizable, and I can cache the results, so there are no jumps on the page compared to an JS solution.
Edit: Seems, that my magical unicorn comes to a life: jQuery Syntax Highlighter
Edit 2: And another one: snippet
It seems that even my google-fu didn't do the truck to find this unicorn. I presume that you're left with:
- either change your mind about using a separate library for syntax highlighting
- or create this unicorn and make it available for the potential interested people out there
精彩评论