Markdown is a nice way to write blog type articles, providing a balance between readability and functionality. I flirted with dedicated blog editors, but as usual, fell back to my favourite editor, jEdit. Unfortunately, getting the markdown formatted post into the blog itself was cumbersome. So, I wrote a beanshell macro that called a markdown shell command that copied the markdown->HTML formatted post into the clipboard.
Now my workflow is:
- Write blog in markdown.
- Press keyboard shortcut bound to markdown macro.
- Paste into blog.
To do this, download the markdown perl script here. Create a shell script called markdown that calls Markdown.pl with the first argument as a file and copies the results into the clipboard (Mac only sorry):
The markdown script:
#! /usr/bin/env sh
Calls Markdown.pl on the file and copies the output to the clipboard.
Markdown.pl --html4tags $1 | pbcopy
Add the markdown script to your $PATH, and make it executable.
Then, in jEdit, create the macro:
runCommandInConsole(view,"System","markdown " + buffer.getPath());
and save it as e.g. Markdown2Clipboard.bsh. Now you can bind a shortcut to the macro, and it will apply the markdown converter on the current buffer in jEdit. Then you can just paste the HTML into your blog.
You can use my jEdit plugin
http://code.pi.co.ua/jedit-markdown-plugin
The plugin render HTML to a new buffer, to clipboard or show it in browser (InfoViewer plugin).
Now it’s beta version.
Cool, I’ll definitely check it out again.