Markdown macro for jEdit.

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:

  1. Write blog in markdown.
  2. Press keyboard shortcut bound to markdown macro.
  3. Paste into blog.

To do this, download the markdown perl script here. Create a shell script called markdown that calls 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 on the file and copies the output to the clipboard. --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.

This entry was posted in jEdit, scripts and tagged , . Bookmark the permalink.

2 Responses to Markdown macro for jEdit.

  1. UR6LAD says:

    You can use my jEdit plugin

    The plugin render HTML to a new buffer, to clipboard or show it in browser (InfoViewer plugin).

    Now it’s beta version.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>