Markdown 2 Confluence

3zach14th May 2007Uncategorized

I seriously heart Markdown, but on several of my projects, we use Confluence for documentation etc. Here is a script I wrote to convert from Markdown to Confluence markup:

#!/bin/sh
# Takes standard input in Markdown format and converts it to Confluence wiki format
# Usage:
#      markdown2confluence.sh < markdown-file > confluence-file
umask 077

TEMP1=/tmp/markdown2html.$$
TEMP2=/tmp/html2confluence.$$

trap "exit 1"               HUP INT PIPE QUIT TERM
trap "rm -f $TEMP1 $TEMP2"  EXIT

Markdown.pl $1 > $TEMP1
java -classpath jparsec-1.2.jar:confluence_converter.jar jfun.markup.Html2Confluence $TEMP1 $TEMP2
cat $TEMP2

The heavy lifting is done by Markdown.pl which you can download from the link I gave you above, and jparsec, which is a framework in Java for building parsers, with the parser built for this purpose available here.

The Html2Confluence class is not perfect, but the source code is available, so what are you waiting for? ;-)

3 Comments Comments Feed

  1. Tim (July 23, 2010, 9:57 am).

    Couldn’t find a link to Markdown.pl

  2. zach (July 23, 2010, 10:50 am).

  3. Gilles Ruppert (November 8, 2010, 5:43 am).

    I am trying to get this running on OSX, but I get Java error (java.lang.NoClassDefFoundError). Unfortunately I don’t have any experience with Java & do not know where to put the file for the Java runtime to find it. Currently the jar just lives in the same bin directory than the markdown2confluence.sh script.

    Any help more than welcome!

Add a Comment