Wednesday, October 13, 2010

code block test

Used SyntaxHighlighter theme and js to support code listing in blogs.
Add following styles and js libraries to the html layout:
<link href='http://alexgorbatchev.com/pub/sh/current/styles/shCore.css' rel='stylesheet' type='text/css'/> 
<link href='http://alexgorbatchev.com/pub/sh/current/styles/shThemeEclipse.css' rel='stylesheet' type='text/css'/> 
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js' type='text/javascript'/> 
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js' type='text/javascript'/> 
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js' type='text/javascript'/>
The above includes theme(I use Eclipse theme and js & java brush, i.e. the syntax highlighter)
If the sample code has any xml markup, it needs to be escaped, use this tool.
sample as below:
class AppAProperties{
    int a;
    private String b;
    private UserCredential user;
    public AppProperties(int a, String b, UserCredential user){
        this.a=a;
        this.b=b;
        this.user=(UserCredential )user.clone();
    }
    // no setter methods . .
}

No comments:

Post a Comment