My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
SourceCode2HTML  
Sourcecode to syntax highlighted HTML converter.
Phase-Implementation
Updated May 16, 2010 by axelclk@gmail.com

Sourcecode to syntax highlighted HTML converter

A syntax highlighter is available for the languages: ABAP (SAP R/3), C#, Java, JavaScript, PHP, Python, XML(HTML).

A conversion from Java to syntax highlighted HTML looks like this:

import info.bliki.wiki.tags.code.JavaCodeFilter;
import info.bliki.wiki.tags.code.SourceCodeFormatter;

public class HelloWorld {
	
	public static void main(String[] args) {
		String javaCode = "public class HelloWorld {\n" + 
				"	public static void main(String[] args) {\n" + 
				"		System.out.println(\"Hello World\");\n" + 
				"	}\n" + 
				"}\n" + 
				"";
		SourceCodeFormatter f = new JavaCodeFilter();
		String result;
		String coding1 = "<pre class=\"java\" style=\"border: 1px solid #b4d0dc; background-color: #ecf8ff;\">";
		String coding3 = "</pre>";
		result = f.filter(javaCode);
		result = coding1 + result + coding3;
		System.out.println(result);
	}
}

You can use the source code to syntax highlighted HTML converter online here:

Powered by Google Project Hosting