PHP Classes

GeSHi: Highlight syntax of source code of many languages

Recommend this page to a friend!
  Info   View files View files (25)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 73%Total: 2,215 All time: 1,763 This week: 105Up
Version License PHP version Categories
geshi 1.0.0GNU General Publi...4.1.0HTML, Text processing
Description 

Author

GeSHi is a Generic Syntax Highlighter for PHP. The user inputs the source to be highlighted and a language to highlight it in, and GeSHi returns the source code, highlighted and formatted for the web.

It includes features for increasing the speed of highlighting, changing how the source is displayed and decreasing the amount of HTML source outputted for speed over slower connections.

GeSHi features also include:

* The ability to check for keywords in source code in either a case sensitive or non-case sensitive manner (for example, Java will only accept classes with TheCorrectCapitalisation, while in PHP it doesn't matter)
* The ability to auto-caps/auto-noncaps keywords in the source (particularly for SQL and older BASIC dialects)
* The ability to change the style of almost any aspect of the source on the fly, or even choose whether some parts of the source (for example, strings) are highlighted at all. The use of CSS means that the source can take on many aspects - rather than those provided by deprecated HTML elements such as <font>, <b> etc.
* The ability to use CSS classes to massively reduce the amount of outputted code.
* XHTML compliant output.
* Simple adding and removing languages.
* Function to URL conversion so functions can be linked to API documentation
* Line numbering, context highlighting and much, much more!

GeSHi requires PHP 4.1.0 or better. It requires no extra PHP extensions.

Innovation Award
PHP Programming Innovation award nominee
July 2004
Number 2


Prize: One copy of the PHP Anthology book set
Syntax highlighting maybe an useful for sites that need to present source code, as it makes source code more readable and easier to understand.

PHP comes with built-in functions that can highlight the syntax of PHP code. This is useful if you just need to present source code in PHP.

This class provides a more generic solution t highlight the syntax of source code of many languages.

Furthermore, if you need to highlight the syntax of source code of a language that is not supported, you can create a new language configuration script and extend the utility of this class to suite your needs.

Manuel Lemos
Picture of Nigel McNie
Name: Nigel McNie <contact>
Classes: 1 package by
Country: New Zealand New Zealand
Age: 38
All time rank: 13829 in New Zealand New Zealand
Week rank: 312 Up2 in New Zealand New Zealand Up
Innovation award
Innovation award
Nominee: 1x

  Files folder image Files  
File Role Description
Files folder imagecontrib (2 files)
Files folder imagedocs (1 file)
Files folder imagegeshi (21 files)
Plain text file geshi.php Class The GeSHi class

  Files folder image Files  /  contrib  
File Role Description
  Accessible without login Plain text file cssgen.php Aux. CSS Generator
  Accessible without login Plain text file example.php Example Example script

  Files folder image Files  /  docs  
File Role Description
  Accessible without login HTML file geshi-doc.html Doc. Documentation

  Files folder image Files  /  geshi  
File Role Description
  Accessible without login Plain text file actionscript.php Conf. Actionscript
  Accessible without login Plain text file ada.php Conf. Ada
  Accessible without login Plain text file apache.php Conf. Apache
  Accessible without login Plain text file applescript.php Conf. Applescript
  Accessible without login Plain text file asm.php Conf. ASM
  Accessible without login Plain text file asp.php Conf. ASP
  Accessible without login Plain text file autoit.php Conf. AutoIT
  Accessible without login Plain text file bash.php Conf. Bash
  Accessible without login Plain text file blitzbasic.php Conf. Blitzbasic
  Accessible without login Plain text file c.php Conf. C
  Accessible without login Plain text file caddcl.php Conf. CADDCL
  Accessible without login Plain text file CHANGES Doc. List of changes
  Accessible without login Plain text file cpp.php Conf. C++
  Accessible without login Plain text file css-gen.cfg Data Placeholder for contrib
  Accessible without login Plain text file css.php Conf. CSS
  Accessible without login Plain text file html4strict.php Conf. HTML
  Accessible without login Plain text file php.php Conf. PHP
  Accessible without login Plain text file README Doc. Readme
  Accessible without login Plain text file visualfoxpro.php Conf. Visual Fox Pro
  Accessible without login Plain text file winbatch.php Conf. Winbatch
  Accessible without login Plain text file xml.php Conf. XML

 Version Control Unique User Downloads Download Rankings  
 0%
Total:2,215
This week:0
All time:1,763
This week:105Up
 User Ratings  
 
 All time
Utility:97%StarStarStarStarStar
Consistency:92%StarStarStarStarStar
Documentation:89%StarStarStarStarStar
Examples:68%StarStarStarStar
Tests:-
Videos:-
Overall:73%StarStarStarStar
Rank:123