Fork me on GitHub

Ciplogic's Code Editor supports multiple code renderers in order to highlight the source code (currently both HTML and GeSHi are provided). A code renderer is a piece of software that takes the text of the source code and creates nicely marked HTML out of it.

The HTML code renderer does the highlighting at article editing time, while GeSHi does it when your site decides to render that particular article, thus a bit of overhead is placed onto the server.

In order to support a 0 configuration experience, the HTML renderer is recommended. This has also the advantage of allowing  you to migrate your site and articles, even if you don't reinstall the Ciplogic's Code Editor, since now they're not trapped inside weird looking <pre> tags.

Now, if you already have a website, you've already wasted counltess hours installing and configuring GeSHi, it might make less sense to switch to the HTML Renderer at this stage, but you still want to use the Ciplogic's Code Editor. Then a different plugin is available where you can add your code samples using GeSHi - you can find it on the downloads page.


The HTML renderer inserts the HTML for the code directly into the article. It purposely doesn't uses any CSS classes, allowing for a 0 configuration approach, and true WYSIWYG (what you see is what you get) while inside the article editor.

All the code samples on this website are rendered using the HTML Renderer.

Here is a simple Java sample:

1
2
3
4
class A {
  // this is a comment
  int x; // this is a variable
}

and a Python one:

1
2
3
4
5
def a():
  print "hello world"
  
if not b:
  print "not b"

GeSHi is a PHP code renderer that takes the HTML code from the article, specially marked via a lang or xml:lang property, and replaces it with HTML that syntax highlights the code when displaying the article.

GeSHi needs to be installed, enabled and configured on your platform before you can use it at all. Programming languages for it must be added separately.

In Wordpress its usage is something like:

1
2
3
4
<pre lang="java" line="1">class A {
  // this is a comment
  int x; // this is a variable
}</pre>

While in Joomla its usage is:

1
2
3
4
<pre xml:ang="java" lines="true">class A {
  // this is a comment
  int x; // this is a variable
}</pre>

Don't forget that you need the Java language support installed into your GeSHi for this to work.

comments powered by Disqus

Donate

Go to top