Syntax Coloring (colorsyntax.pl)

[ home / software / Syntax Coloring (colorsyntax.pl) ]

[Download colorsyntax.pl]

Bookmark and Share
colorsyntax.pl is a Perl script that performs syntax highlighting of source code files using HTML. It is meant to work with a variety of programming languages and can be extended easily to add more. If your system has Perl installed, you should be able to execute it like so:
$ perl colorsyntax.pl -t c < source-file
Where your current directory contains the downloaded script and source-file is the path to the source code file you want to apply highlighting to. This code should also work on Windows systems that have Perl installed. Assuming the Perl executable is in your path, type the following:
C:\> perl.exe colorsyntax.pl -t c < source-file

If you need something highlighted quickly or just want to see how it works, select the programming language for your source code, and copy and paste it into the box. Then click the 'Colorize' button.
Perl C Java JavaScript Python

Most often you will place the output between <pre> tags to keep the spacing and formatting of your source code as is. The code is not complete at this point but works for most situations. It does not handle HERE documents in Perl, for example, and no doubt I have missed some keywords from some of the languages. Let me know if you run into any of these problems.

If you have any questions, suggestions, or run into any problems, let me know. You can also use the comments at the bottom of the page.

[Back to Top]

Enter a comment or email me directly if you prefer.

Comments:

Name (optional):
Comment: