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.
Find and highlight a text expression in a sentence
This is a very simple class that can search for a given text expression in a longer sentence and highlight it.
The class determine if the search text is present in the sentence. If present, it returns the HTML of the whole sentence marking all occurences with red background color.
This is a simple class that can be used to highlight documents with HTML and XHTML syntax.
It outputs a XHTML document that shows the input document using different CSS styles to configure the presentation of comments, data, tags, attributes and attribute values.
This class is meant to highlight PHP code using built-in PHP highlighting functions and using own class code to detect functions and build links to the respective manual pages.
This class highlight text that matches a given search string (keyword) in HTML based documents, without affecting any HTML tags.
This may be useful for processing text and highlight against a glossary of terms for example, or page excerpts returned from search results (like Google).