This test page for Syntax Highlighter, free (LGPL) JavaScript tool by Alex Gorbatchev at Google Code, uses a modified version of shCore.js based on my following proposal:
Insted of using a custom name given at HighlighAll()
function, usually "code", and an additional class atrribute for language and
options, this proposal uses only a class with the following form:
syntax-highlight:language:options. The :options
part remains optional.
This proposal also works fine if there were other classes specified in the class atribute.
Using: <pre class="syntax-highlight:java:nogutter">
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class AloMundoServ extends HttpServlet
{
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{
String alo = "Alô Mundo!";
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<body><h1>" + alo + "</h1></body>");
out.println("</html>");
} // doGet
} // class AloMundoServ
Using: <pre class="other1 syntax-highlight:java other2">
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class AloMundoServ extends HttpServlet
{
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{
String alo = "Alô Mundo!";
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<body><h1>" + alo + "</h1></body>");
out.println("</html>");
} // doGet
} // class AloMundoServ
Using: <textarea class="syntax-highlight:java" cols="80" rows="17">
The textarea is inside a fieldset.