Emacs : Htmlize and WordPress Syntax Highlighter

by

In my previous post, I posted the perl script with syntax highlighting. I was able to get that code with syntax highlighting directly off the forum post. If you want to post random code with syntax highlighting, there are 3 options –

  1. Using plugins (generally not available for free)
  2. Using online generator such as those described here. (Usually give css code which cant be used in free mode of WordPress)
  3. Htmlize in Emacs 🙂

Emacs has an addon called “htmlize” which can be used to convert any file into an htmlized version. It provides 3 output types – css, inline-css and font. Emacs FTW again :D.

PS :: This is also available in the emacs-goodies.el packages in Debian and Ubuntu but the version of htmlize.el in those is outdated and does not work with Emacs 23.x

EDIT :: It seems that WordPress internally supports syntax highlighting with the use of SyntaxHighlighter. For more info check here. List of all the supported languages is here. For blogs other than WordPress, htmlize still seems a very good option.

Advertisements

3 Responses to “Emacs : Htmlize and WordPress Syntax Highlighter”

  1. Jitesh Says:

    that is of *immense* help!

  2. Amod Jaltade Says:

    i think i should start using Emacs 🙂

  3. Raven Morris Says:

    Vim also has a nice HTML exporting function built-in, called “TOhtml”, which can be run by going:

    :TOhtml

    You could use Vim’s command-line mode to automatically pass a file through this function and save it to an .html file, if you wanted to automate it.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: