How can I do that either in a different buffer or even in the current buffer?
I'm trying to do Github README.md and other Github rendering of Markdown (for notes and such),
Here's a pretty long but efficient solution.
markdownfrom your system's package manager.
Finally, evaluate this code:
(defun markdown-export-continuous (&optional output-file) (interactive) (let ((input-file (buffer-file-name)) (output-file (markdown-export-file-name ".html"))) (when output-file (with-current-buffer (find-file-noselect output-file) (erase-buffer) (insert (shell-command-to-string (format "markdown %s" input-file))) (save-buffer))))) (add-hook 'after-save-hook 'markdown-export-continuous t t)
Note that the
add-hook statement needs to be local to Markdown, so run it in that buffer.
After all this, open your browser on
it will refresh each time you C-x C-s.
As of markdown-mode 2.1, this is functionality is provided in
markdown-live-preview-mode (bound to
C-c C-c l).
It uses eww for rendering the HTML. Screenshot: