On this page... (hide)
I use markdown so much for github readmes, on StackExchange and Discourse that I’m really, really getting used to it.
I wish I could use it as an alternate markup here in PmWiki; not main markup, as so many other markups are possible here in the wiki. But for simple things like headings, lists, links, &c I am very VERY happy with it.
in-browser editor can save locally
For rendering, I used node’s markdown-preview, for which I contributed a bug-fix the day I started using it.
(autoload 'markdown-mode "markdown-mode"
"Major mode for editing Markdown files" t)
(add-to-list 'auto-mode-alist '("\\.text\\'" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
(setq markdown-command "markdown-preview")
(setq markdown-command-needs-filename t)
And that should do it. I had no luck setting
markdown-open-command to use markdown-preview
markdown-mode.el runs a shell-command, which waits for a return value.
This ties up the buffer (actually, ALL of Emacs) preventing further changes.
Which is a shame, since
markdown-preview watches the file and performs live-updates.
I did get the below to work in
*scratch* via emacs’ Asynchronous Processes notes:
(start-process "markdown-preview" "*scratch*" "markdown-preview.cmd" "d:/Dropbox/projects/NaNoGenMo.yawp/ngram/README.md")
;; so then this should work:
(defun markdown-preview-buffer ()
"open current buffer with markdown-preview (node.js)"
(start-process "markdown-preview" nil "markdown-preview.cmd" (buffer-file-name)))
;;; redefine the keymapping in markdown-mode only
(define-key markdown-mode-map (kbd "C-c C-c p") 'markdown-preview-buffer)
The second parameter
"*scratch*" associated that buffer with the process, appending
stdout to the buffer -- to see errors, in particular. Remove for other uses.
BUT how to get
markdown-mode.el to use this?
Or just skip the mode entirely, and wire up my own thing?
The docs on
markdown-mode.el speak of
markdown as a program you’d just find lying about, ready to do all sorts of things. While I haven’t been able to find it at all for Win32 or Gnu.
No comments yet.