Sunday, July 25, 2010

Integrating SyntaxHighlighter on

Today I integrated SyntaxHighlighter ( on my blog. Adding source code to a blog works like a charm by embedding it in <pre></pre> tags.

<pre class="brush: java">
-- insert code here ---

In order for SyntaxHighlighter to work, you need to to the following in your account

Just after the <head> tag:
<link href='' rel='stylesheet' type='text/css'/>
<link href='' rel='stylesheet' type='text/css'/>
<script src='' type='text/javascript'/>
<script src='' type='text/javascript'/>
<script src='' type='text/javascript'/>
<script src='' type='text/javascript'/>

Just before the </body> tag :
<script type='text/javascript'>
SyntaxHighlighter.config.bloggerMode = true;

One minor issue encountered with XML rendering. This doesn't seem to work properly unless replacing all left brackets with <
So currently I'm stuck with copying the code to an editor, executing a search "<" and replace with &lt; XML Snippet with left handed brackets included


XML Snippet with left handed brackets replaced with &lt;

<persistence-unit name="pu" transaction-type="RESOURCE_LOCAL">
<property name="hibernate.connection.url" value="jdbc:hsqldb:mem:unit-testing-jpa"/>
<property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
<property name="" value="create-drop"/>
<property name="hibernate.connection.username" value="sa"/>
<property name="hibernate.connection.password" value="x"/>
<property name="hibernate.archive.autodetection" value="class, hbm"/>

Rest seems to be working fine...

package be.ecs.seamdemo.beans;

import javax.persistence.EntityManager;

import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityHome;

import be.ecs.seamdemo.entities.Category;

public class CategoryHome extends EntityHome {

private static final long serialVersionUID = 1729733881106540912L;

EntityManager entityManager;

public EntityManager getEntityManager() {
return entityManager;

public String persist() {
return null;


  1. Nice syntax... As I thougth, i bet this will be great help to all the blogger out there! Keep posting new useful syntax.

    My blog: rampe d'escalier 

  2. This is awesome!
    I haven't tried it, but I am sure this will work fine.
    Can't wait for the results after I apply this codes.

    Eunice from fixation abattant WC