Good news to all the users of this website. As you all know that you can use geishi syntax highlighter while posting your posts here, you can similarly use geishi highlighter in the forums as well. And for all the new users out here, I am going to describe on how to use the tags to syntax highlight and beautify your code.
For the blogs:
– In the editor window, select Visual and type in everything you need, don’t put any code snippets in the post anywhere yet
– Save the post and switch over to HTML editing
– Go to the place where you want to insert your code
– Start with the following tag
<pre lang=”GEISHI_SUPPORTED_LANGUAGE” line=”1″>
– Now copy and paste your code
– End with the following tag
</pre>
IMPORTANT: Do not switch back to Visual mode, simply click on “Update Post”. Switching back to Visual mode will insert some HTML tags for special characters which will mess up your code display. So only edit in HTML mode once you have your code in the post. This is not a bug/problem with this website, it is a general flaw in wordpress system.
The line=”1″ parameter is optional and is needed if you want to show line numbers along with your code. This works for the blog here. The examples can be found at: http://www.naresh.se/2009/03/30/hello-world-in-d/ and http://www.naresh.se/2009/04/09/hello-world-in-d-part-2/
For the forums:
– Start with the editor whether you are replying to a post, PM, entering a new post, topic, etc
– Write in everything that you want
– When you want to insert code, use the code tags as below:
[code=GEISHI_SUPPORTED_LANGUAGE]
– Insert code after that
– End with
[/code]
This easily integrates Geishi with the code tags inside phpbb3. It was a lot of work to do it but it finally works. As a side note phpbb people should work on improving MOD installation. Anyways but it works now. Again, do not click on Preview. Directly click Submit since Preview messes up with the spacing and general indentation of the code. I don’t know if it was only this website forum that is facing this problem.
The examples can be found at: http://www.naresh.se/phpBB/viewtopic.php?f=10&t=3. Pretty cool, eh!
The GEISHI_SUPPORTED_LANGUAGE parameter is one of c, cpp, html, php, d, etc. Visit http://qbnz.com/highlighter/ for details on all the languages that it supports. As of now around 115 languages are supported and I will keep updating as more and more support is added. But do ping me if you are missing anything.
As you also might be seeing, I have a new software known as phpGedView available on the site now. Go ahead and build your own geneology tree. And you can also see the Share and Leave Comment links on the main site posts now. Took me sometime to figure out and change the templates since I am no PHP guy but hey I can do an intelligent good copy paste at times like that :). But I have started loving php and will try to learn more of it as time permits.