redbeardcreator / hyperlight-gc

Highlight source code in PHP (based on export from http://code.google.com/p/hyperlight)
0 stars 0 forks source link

Hyperlight Redux

This is a fork of Hyperlight, cloned from the original Google Code repository. The intent is to make it installable via composer. And modernize the codebase.

I'm doing this so I can propose using it in a few projects that I'm currently using that could use PHP-based code highlighting.

I believe @klmr is the originator of this repository. If you notice this, feel free to contact me about it. Also, if you are a user of Hyperlight and you'd like to help me out with this, please feel welcome to submit a pull request.

At some point, unless I start working with @klmr, I will have to rename this.

Why use Hyperlight?

Why not use something else?

Sure, there are alternatives. Unfortunately, they are surprisingly few for PHP:

Geshi

If you’re forced to work with PHP version < 5.0, sure, use Geshi. But be prepared that each syntax brings its own (ugly) style, lacking conventions make the use of one CSS for all languages impossible (because they use the same CSS class names for completely different things), a lot of badly-documented configuration is necessary to get the desired result, HTML garbage is produced and the CSS class names are gibberish.

Furthermore, many of the syntax definitions are badly realized and/or have bugs. Creating an own highlighting isn't trivial because the API is quite complicated, not very powerful and lacks documentation.

If that doesn't matter to you, Geshi is perhaps not such a bad choice.

Pear_TextHighlighter

Syntax definitions must be given as cumbersome XML files. Need I say more?