Created
June 12, 2014 23:53
-
-
Save jonEbird/22bb0520cce8c2ea3c1f to your computer and use it in GitHub Desktop.
Preview the Github Markdown to HTML convertion before committing. Bound to F12 in markdown-mode.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Markdown preview helper | |
;; ------------------------------ | |
(defun jsm/markdown-preview () | |
"Preview the markdown file in a new browser tab" | |
(interactive) | |
(let ((my-filename (buffer-file-name)) | |
(html-filename (format "%s.html" (file-name-base (buffer-file-name))))) | |
(shell-command (format "pandoc -f markdown_github -t html -o %s %s" html-filename my-filename) nil nil) | |
(browse-url (concat "file://" (file-name-directory (buffer-file-name)) html-filename)))) | |
(define-key markdown-mode-map (kbd "<f12>") 'jsm/markdown-preview) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Requires installation of the pandoc utility. Available on Fedora systems via yum.