Nearly every project I work on has Markdown documentation with Github’s exstensions for things like code highlighting. Unfortunately,I’m not super-great at remembering how the syntax goes, which results in commit messages like “l2md” when I push and realize the mistake I’ve made.
Markdown-mode in Emacs is great for highlighting Markdown syntax and has some nice keybindings to help out, and it also comes with the command
markdown-preview which processes the Markdown you’re editing and opens it in your browser. So all we need is a Github-flavored Markdown command to push that to.
This turns out to be surprisingly tricky! There’s no Github-supplied client for their flavor of Markdown. The best solution I’ve found is this script by Brett Terpstra that actually uses the Github API to do it on their server for you. So, annoyingly, this solution requires internet access.
I’ve forked that script to fix an encoding issue with Ruby 2.x, it’s available here. Save that file,
chmod a+x, and then tell Markdown-mode where it is:
(setq markdown-command "/path/to/flavor")
C-c C-c p will process and display your Github-flavored Markdown for you.