This is pretty obvious, but I just started blogging, and I decided to dust off my old blogger account and use it for my posts, because, why not?
However, what has been bothering me is blogspots WYSIWYG editor, and while I can edit my posts in HTML, I am a bit too lazy to fight the editor. My process was to save rough drafts in Apache OpenOffice's native ODT format, then copy and paste the draft into blogspot's editor and 'polish' off the blog, switching between the Compose and HTML screens.
Then a thought hit me, why not blog in Markdown and convert to HTML, and post the HTML instead. Great idea, but how?
For almost a month now, I had made the switch from Emacs to Vim as my default editor and "IDE" of choice, so I did a search for available plugins and came across this awesome article, Vim Essential Plugin: Markdown to HTML
So I downloaded Markdown 1.0.1, unzipped it and placed it in my /usr/local/binand tested it out...
/usr/local/bin/Markdown.pl: not found
Whuh? Not found? Oh yes, I needed to ensure the file could find my perl, so I edited the first line in the file to reflect it's location.
$ which perl
/usr/local/bin/perl
I edited the first line of Markdown.pl so it looks like this #!/usr/local/bin/perl
and I tested it from
my terminal this time.
Markdown.pl --html4tags README.md
It's output was splendid, clean HTML. So I assigned my vim shortcut key, like so:
" Markdown to HTML
nnoremap <leader>m2h :%!/usr/local/bin/Markdown.pl --html4tags <CR>
I also downloaded the html2text.py script from Aaron Swartz html2text page.
That way I can now convert between the two formats within vim. Just follow the same steps as we did for Markdown.
As a sign off note, this is my first blog written entirely in Markdown, converted to HTML and published to Blogger!
No comments:
Post a Comment