Monday, January 7, 2008

how to reserve code format in blogspot


Keywords: code format, blogspot, C#, java, SQL code


How to reserve format for code block In blogspot? Today I found 3 webs can help us.


1. The simple way



1.1. Goto the http://formatmysourcecode.blogspot.com/ ,


1.2. Insert our code into the textbox of top region


1.3. Click to button "Format Text"


1.4. Copy the html text into your blog editor.



Visit the following blog, we can find the javascript and know it how to work.


http://ghouston.blogspot.com/2006/02/about-format-my-source-code.html



2. The more powerful way(need update template html to apply css)



Goto the http://www.manoli.net/csharpformat/


how to apply css, refer the http://thinkode.blogspot.com/2007/12/code-formatting-with-blogger.html


Highlight显示source code的设置步骤如下:


2.1. 到www.manoli.net网站下载 csharp.css文件


2.2. 到http://pages.google.com/为blogspot站点开一个web站点, 在该站点保存csharp.css文件,纪录css文件的地址, 比如 http://wadewindows.googlepages.com/csharp.css


2.3. 登录blogspot的dashboard, 进入template/Edit Html的编辑框中, 在head tag中增加一行 <link href='http://wadewindows.googlepages.com/csharp.css' rel='stylesheet' type='text/css'/>


2.4. 设置完毕.


2.5 在blog中发布sourcecode的方法: 访问http://www.manoli.net/csharpformat/, copy 你的source code, 它会为你生成对应的html text, 将这些html text 拷贝到你的blog中就可以了.



3. The more powerful way(need update template html to apply css and import javascript), it will support more computer language than way 2.


http://thinkode.blogspot.com/2007/12/code-formatting-with-blogger.html




No comments: