Syntax Highlighting HTML - Skip Header

Syntax Highlighting HTML

The com.Ostermiller.Syntax package comes with a program to turn source code into colored web pages. The program is a command line Java program.

To run, use the command line:
java -classpath syntax.jar com.Ostermiller.Syntax.ToHTML --help

ToHTML [-mlTitsofr] <files>
Converts source files to syntax colored HTML.
If no files are specified standard input will be used.
 --help               Print this help message.
 --version            Print out the version number.
 --about              Print out license and contact info.
 -m --mime <type>     Input is the given mime type. text/html, text/x-java...
 -l --lexer <class>   Java class name of the lexer to use.
 -T --title <title>   Use the given title in the html page.
 -i --ignore <class>  CSS class name of token to ignore, eg. "whitespace"
 -t --template <URL>  BTE template to use.  see: ostermiller.org/bte
 -s --css <URL>       Cascading Style Sheet to which html should be linked.
 -o --output <file>   Output file, output directory, or -- for standard output.
 -f --force           Overwrite files without prompting.
 -r --trans <old=new> translate a CSS style into another style.

The resulting html documents will generally be much smaller if the -i whitespace option is used. This is acceptable as long as styles used do not effect whitespace. An example of a style that would effect whitespace would be background color. Also consider translating styles into styles with shorter names and editing the style sheet. For example you might want to use -r keyword=k.

BTE template files are used to customize the output. The BTE system is a separate download. It must just be placed in the classpath or placed in the Java extensions directory. The -t option can then be used to specify a desired template such as the default template. Using templates you can easily customize the look and feel of the generated html and add your own content.

If you are coloring your source files in a project which you build with Ant, you can use an Ant task.