Post

00 how to view md files in emacs

00 how to view md files in emacs

Methods: Impatient-mode

Reference

  • Install impatient-mode with `M-x package-install RET impatient-mode RET, given you have configured package.el to use the melpa repository.
  • Start an emacs’ web server with M-x httpd-start.
  • Start impatient mode in the buffers you’re interested to live preview: M-x impatient-mode.
  • Open your browser to localhost:8080/imp. You’ll see the list of buffers with the mode enabled. Click on one: you see live rendering of the buffer.
  • Define this elisp function somewhere, like in your .emacs file:
  • Tell impatient mode to use it: M-x imp-set-user-filter RET markdown-html RET.
  • Go back to your browser, it works!

```emacs-lisp ;; Define markdown-html function (defun markdown-html (buffer) (princ (with-current-buffer buffer (format “<!DOCTYPE html><html>Impatient Markdown<xmp theme="united" style="display:none;"> %s </xmp><script src="http://ndossougbe.github.io/strapdown/dist/strapdown.js"></script></html>” (buffer-substring-no-properties (point-min) (point-max)))) (current-buffer)))

This post is licensed under CC BY 4.0 by the author.