Since publishing codes in your posts in Blogger is such a big pain in the a** for me, I'd like to share this blog post that I just recently found (though, it's an old post based on the date) to those who also have the same problem as I have.
I use GeSHi to publish codes in blogger. Here's a brief background about GeSHi taken from its website:
GeSHi started as an idea to create a generic syntax highlighter for the phpBB forum system, but has been generalized. GeSHi aims to be a simple but powerful highlighting class, with the following goals:First step is to go to the demo page of GeSHi and enter the necessary data.
- Support for a wide range of popular languages
- Easy to add a new language for highlighting
- Highly customisable output formats
Open any text editor then copy the style by viewing the source code after hitting highlight. Then, save the file as a CSS stylesheet (e.g. geshi.css). Store the file in any server that you have access on and which you can call publicly. I have a free web host wherein I stored the file.
Edit your HTML code in blogger by going to Layout and Edit HTML. At the bottom of the template styles, just add this line
<link rel="stylesheet" type="text/css" href="/path/to/style.css" />
After that, view the source code of the demo again and copy the code where it contains the "codebox" (as I would call it). It usually starts with the code: "<div class="php" style...". And voila! You have a clean publishing of codes in your post.
Update: Currently using the method found here.
0 comments:
Post a Comment