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.
simple-httpd and M-x httpd-start.markdown from your system's package manager.impatient-mode and M-x impatient-mode.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 http://localhost:8080/imp/ and 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:
markdown-exportandeww, driven from a change notification hook and timer. But it seems like the interesting part would be determining what part of theewwbuffer HTML corresponds topointin the markdown buffer (so the they could scroll "in sync").