Markdown 2 Confluence
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?
« Facebook Platform | Home | Waltzing with Bears »
Leave a Comment