Add narf:org-export (and for markdown-mode too)

This commit is contained in:
Henrik Lissner 2015-11-17 02:10:49 -05:00
parent c1147e912b
commit 2a1809cf63
2 changed files with 33 additions and 17 deletions

View file

@ -226,6 +226,17 @@ COUNT-FOOTNOTES? is non-nil."
(t (copy-file link new-path)))
(insert (format "[[./%s]]" (abbreviate-file-name new-path))))))
;;;###autoload (autoload 'narf:org-export "defuns-org" nil t)
(evil-define-command narf:org-export (dest)
(interactive "<a>")
(let ((path (if (string-match-p "^[/~]" dest)
dest
(expand-file-name dest default-directory))))
(shell-command
(format "/usr/local/bin/pandoc '%s' -o '%s'"
(buffer-file-name) path))
(message "Done! Exported to: %s" path)))
;;;###autoload
(defun narf/org-remove-link ()
"Replace an org link by its description or if empty its address"

View file

@ -11,27 +11,32 @@
:init
(add-hook! markdown-mode 'narf|enable-hard-wrap)
:config
(bind! :map markdown-mode-map
(add-hook! markdown-mode
(exmap! "preview" 'narf/markdown-preview)
(exmap! "export" 'narf:org-export))
(bind! (:map markdown-mode-map
"<backspace>" nil
"<M-left>" nil
"<M-right>" nil
;; Assumes you have a markdown renderer plugin in chrome
:nv "M-r" (λ (narf-open-with "Google Chrome"))
"M-*" 'markdown-insert-list-item
"M-b" 'markdown-insert-bold
"M-i" 'markdown-insert-italic
"M-`" 'narf/markdown-insert-del
(:prefix "," ; <leader>
:nv "i" 'markdown-insert-image
:nv "l" 'markdown-insert-link
:nv "L" 'markdown-insert-reference-link-dwim
:nv "b" 'markdown-preview)
:nv ",i" 'markdown-insert-image
:nv ",l" 'markdown-insert-link
:nv ",L" 'markdown-insert-reference-link-dwim
:nv ",b" 'markdown-preview
;; TODO: Make context sensitive
:n "[p" 'markdown-promote
:n "]p" 'markdown-demote
:i "M--" 'markdown-insert-hr))
:i "M--" 'markdown-insert-hr)))
;; TODO: Test previewing capability