In web technology world, snippet sharing is one of the most common tasks for developers. Right now, developers are developing new snippets regularly and they can easily share them in their own blog or other popular social bookmarking websites. As a result web technologies are growing rapidly.
If you have some snippets and want to share them then you come in right place. You can easily integrate following scripts in your website or blog and highlight your snippet in smart way. You know, people love to learn about new snippets and if you present then a nice way with syntax highlighters in your blog then I’m sure they must love you and your blog.
It’s a great challenge for web developers to represent their snippets in their blogs. Because PHP, HTML, CSS , jQuery snippet run as a normal code when you are trying to show them in your blog. Syntax highlighters are preventing them from execution as a normal code.
You can found lots of syntax highlighter tools over internet. From them I’ve tried to make a nice list, that will help you for presenting your snippet beautifully. The list below made up of the best syntax highlighter and most of them are providing you highest quality and they are easy to use as well as very simple to configure. You can give them a try. So, let’s go –
– Google Code Pretify:
1. Works on HTML pages
2. Works even if code contains embedded links, line numbers, etc.
3. Simple API : include some JS&CSS and add an onload handler.
4. Lightweights : small download and does not block page from loading while running.
5. Customizable styles via CSS. See the themes gallery
GeSHi aims to do this all as quickly as possible. Many customisable features of GeSHi facilitate speed increases, and you can easily find a balance between the amount of highlighting done and the speed in which it is done.
GeSHi supports PHP5 and Windows, and has even been used to highlight code on ASP pages. Numerous blogs, wikis and forums use GeSHi, including Dokuwiki, Mambo, phpBB and WikkaWiki.
Ultraviolet is a syntax highlighting engine based on Textpow. Since it uses Textmate syntax files, it offers out of the box syntax highlighting for more than 50 languages and 20 themes.
Ultraviolet is at the same time a stand-alone command line utility and a Ruby library.
– Pygments syntax highlighter:
It is a generic syntax highlighter for general use in all kinds of software such as forum systems, wikis or other applications that need to prettify source code.
Highlights Features are:
1. A wide range of common languages and markup formats is supported
2. Special attention is paid to details that increase highlighting quality
3. Support for new languages and formats are added easily; most languages use a simple regex-based lexing mechanism.
4. A number of output formats is available, among them HTML, RTF, LaTeX and ANSI sequences it is usable as a command-line tool and as a library.
Highlight.js highlights syntax in code examples on blogs, forums and in fact on any web pages. It’s very easy to use because it works automatically: finds blocks of code, detects a language, highlights it. This is not only convenient but also allows highlighting for code examples marked up with writing syntaxes like Markdown where there is no way to specify HTML class easily.
The library knows 46 languages and is bundled with 18 style themes.
Lighter is a free syntax highlighting class developed for MooTools. It was created with the MooTools developer in mind and takes advantage of many of the Framework’s features. Using it can be as simple as adding a single script to your webpage, selecting the elements you wish to highlight, and Lighter takes care of the rest. It is currently in use on the MooTools forge so you are seeing it in action right there.
Was this information useful? What other tips would you like to read about in the future? Share your comments, feedback and experiences with us by commenting below!