开发者

Searching for a semantic syntax highlighter in Javascript

开发者 https://www.devze.com 2022-12-31 02:31 出处:网络
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 num

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
0

精彩评论

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