Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Aristotle (5147)


Blah blah blah blah blah []

Journal of Aristotle (5147)

Saturday May 21, 2005
12:37 PM

Writing HTML in textareas made convenient: a Markdown praise

[ #24811 ]

This is mostly in reply to “learning GTK+, parsing” by statico, who unfortunately does not have comments enabled.

Personally, I make things easier on myself by using Markdown and SmartyPants. If you haven’t seen Markdown, you’re really missing out. It is the plaintext-to-HTML formatter to end all formatters. The syntax is as close to intuitive as it can possibly get; if you’ve ever seen plaintext email, you’ve basically seen Markdown, and the translation to HTML looks pretty much the way such a mail would reasonably look like if it had been authored as a web page.

Hooking Markdown into the browser, and in fact into any application that has text input widgets at all, is actually simpler than might at first appear: you just need xclip (or some equivalent, I suppose, if you’re not on X11). This little tool can dump any of the X11 selections, such as the clipboard, to its stdout or slurp its stdin into one of the selections.

Thus, I have this shell oneliner bound to a keyboard shortcut in my window manager:

xclip -o -sel clip | Markdown | SmartyPants -2 | xclip -sel clip

With that in place, I simply write my entries in a natural format, then I copy, hit a key, and paste, and there they are, turned to HTML and typographically smartened. Presto.

An advantage of this solution over many tools is that it will work for everything, regardless of whether I’m using a webblogging tool, writing a comment on some foreign weblog, posting on PerlMonks, or anywhere else you can imagine. One keystroke, and there you go. No muss, no fuss.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.