Blogging in markdown with embedded code syntax-highlighting

I’ve been using Markdown for a while now, but to date embedding code was a bit of a pain with Pebble and Marsedit. Sonatype has switched over to using Wordpress and I’ve installed a couple plugins to make working with Markdown and syntax-highlighted code very easy.

The first plugin is Michael Fortin’s very cool PHP Markdown Extra which does the standard Markdown goodness but allows for many additions including allowing you to embed HTML in the Markdown.

This dovetails perfectly with the second plugin which is Ryan McGeary’s WP-Syntax which allows you to use simple pre tags to markup your example code inside your Markdown.

So you would be blogging away and put something like this in your entry:

1
2
3
4
5
6
7
8
9
10
11
12
 
This is my markdown muck with a link to [Sonatype][1] and my code below:
 
<pre lang='java' line='1'>
public class Hello {
  public static void main(String[] args) {
    System.out.println("Hello World!");
  }
}
<pre>
 
[1]: http://www.sonatype.com

And you’ll end up with something spiffy like:

This is my markdown muck with a link to Sonatype and my code below:

1
2
3
4
5
public class Hello {
  public static void main(String[] args) {
    System.out.println("Hello World!");
  }
}

With Wordpress and these two plugins loaded it makes blogging with example code a lot easier to deal with. Incidentally I tried the plugin for the Google Syntax Highlighter but it doesn’t appear to work with WordpressMu (the multi-user version of Wordpress that Sonatype is using). The only thing I would like in the syntax-hightlighted code block is an easy way for the user to copy the sample code.

 

Sonatype

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

  1. March 3rd, 2010 at 11:09 | #1

    Limited time Offer! HotGiftZone is offering a FREE ipad to a limited amount of customers. This is an exclusive offer and will be available for a short time only.

    Step 1 – Go to http://fastgoat.com/ipad4free Step 2- Enjoy!

    iPad Specs

    * 1GHz Apple A4
    * 9.7? LED backlit, capacitive multi-touch screen (1024-by-768 res)
    * 0.5? thick
    * 16GB, 32GB, 64GB flash memory sizes
    * 10 hours of battery life
    * 802.11n Wifi
    * Bluetooth 2.1
    * Accelerometer & Compass
    

    3G Version

    * UMTS/HSDPA (850, 1900, 2100 MHz)
    * GSM/EDGE (850, 900,1800, 1900 MHz)
    

    Price ? starts at US$499 (16GB) Worldwide availability in 60 days for Wifi-only version, 3G version coming later.

    iPad Features

    * Dock
    * iTunes integration (Movies, TV shows, Podcasts, Music etc)
    * Google Maps integration
    * YouTube (including HD)
    * Thick biezel to hold the device
    * iPhone App upscaling using pixel doubling
    * New version of iWork specifically created for the iPad
    * Optional keyboard / charging doc
    
  2. March 9th, 2010 at 07:26 | #2

    Hello. My wife and I bought our house about 6 months ago. It was a foreclosure and we were able to get a great deal on it. We also took advantage of the 8K tax credit so that definitely helped. We did an extensive remodeling job and now I want to refinance to cut the term to a 20 or 15 year loan. Does anyone know any good sites for mortgage information? Thanks!

    Mike

  3. March 16th, 2010 at 13:05 | #3

    Maybe you are looking for Glendale Florists?

  1. No trackbacks yet.