Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

37 lines (30 sloc) 1.6 KB
;; CSS:
;; API docs:
;; elisp http:
;; also check out other people's implementations:
;; -
;; -
;; pandoc seems the The Right Way to do this - would need a CSS file though
(defun md-preview ()
"Uses the GitHub API to render the current buffer as GitHub
Flavored Markdown and displays the results in a web browser"
(let ((endpoint "")
(url-request-method "POST")
(url-request-extra-headers `(("Content-Type" . "text/x-markdown")))
(url-request-data (buffer-string)))
(url-retrieve endpoint (lambda (status)
(goto-char 0)
(insert (gh-stylesheet-link)))
(browse-url-of-buffer nil)))))
(defun delete-http-headers ()
(goto-char 0)
(delete-region (point) (mark))))
(defun gh-stylesheet-link ()
(let ((stylesheet ""))
(format "<link rel='stylesheet' type='text/css' href='%s' />" stylesheet)))
Jump to Line
Something went wrong with that request. Please try again.