1

I am looking for a (free) blog engine (WordPress...) that handles sections of code well. That is, I could just markup a portion of my entry as code and it would indent/format appropriately, much like Server Fault does right below:

  static void Build()
  {
      Indexer.BuildIndex();
  }
0

7 Answers 7

7

WordPress uses plugins which are very easy to install to handle this. I chose SyntaxHighlighter for my blog because it was easy to use, supported the languages I was after, and worked the best. You can go to my profile for a link to my blog to see some examples.

This link compares a bunch of them, some of them have themes, etc., one of them should work for you. You usually just use some sort of tag in your post like: [sourcecode lang=perl] print foo [/sourcecode] and the plugin takes care of the rest.

4

Prettify is used by Stack Overflow and it works very well. You just include it into your blog template and every <code> section gets highlighted automagically.

3

You could use SyntaxHighlighter.

SyntaxHighlighter is here to help a developer/coder to post code snippets online with ease and have it look pretty. It's 100% Java Script based and it doesn't care what you have on your server.

enter image description here

0

Normally this sort of thing is added to a blogging engine through including JS and setting up CSS in your posts. It's generally trivial to add to any flexible engine when done this way. Like with the google syntax highlighter.

0

I use GeSHi under Drupal... but it is a general PHP library for code highlighting, so there may be a plugin for Wordpress that uses it too if you prefer to use Wordpress (definitely simpler for a blog).

0

You also have the option of converting your code directly into colored/highlighted HTML.

Check out Pygments. You enter the code. It gives you the highlighted syntax.

It is a generic syntax highlighter for general use in all kinds of software such as forum systems, wikis or other applications that need to prettify source code. Highlights are:

  • a wide range of common languages and markup formats is supported

  • special attention is paid to details that increase highlighting quality

  • support for new languages and formats are added easily; most languages use a simple regex-based lexing mechanism

  • a number of output formats is available, among them HTML, RTF, LaTeX and ANSI sequences

  • it is usable as a command-line tool and as a library

  • ... and it highlights even Brainf*ck!

0

Calepin is a static blog publisher that supports syntax highlighting out of the box.

1
  • Please consider expanding your answer by adding some excerpt how the referenced program handles code highlighting. This will improve the quality of your answer. Nov 13, 2012 at 18:02

Not the answer you're looking for? Browse other questions tagged .