-
Notifications
You must be signed in to change notification settings - Fork 3
/
copyit-pandoc.el
62 lines (50 loc) · 1.85 KB
/
copyit-pandoc.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
;;; copyit-pandoc.el --- Copy it, yank anything! -*- lexical-binding: t -*-
;; Copyright (C) 2019 USAMI Kenta
;; Author: USAMI Kenta <tadsan@zonu.me>
;; Created: 6 Jun 2016
;; Version: 0.1.0
;; Keywords: convenience yank clipboard
;; Homepage: https://github.com/zonuexe/emacs-copyit
;; Package-Requires: ((emacs "24.3") (copyit "0.1.0") (pandoc "0.0.1"))
;; This file is NOT part of GNU Emacs.
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; “Copy” is known as “Yank” in Emacs.
;;
;; ** Functions
;; - copyit-pandoc-export-to-html
;; - copyit-pandoc-export-to-markdown
;;; Code:
(require 'copyit)
(require 'pandoc)
;;;###autoload
(defun copyit-pandoc-export-to-html (file-path)
"Convert and Copy `FILE-PATH' file as HTML."
(interactive "p")
(kill-new
(pandoc-convert-file
(if (and (eq 4 file-path) buffer-file-name)
buffer-file-name
(read-file-name ""))
nil "html")))
;;;###autoload
(defun copyit-pandoc-export-to-markdown (file-path)
"Convert and Copy `FILE-PATH' file as Markdown."
(interactive "p")
(kill-new
(pandoc-convert-file
(if (and (eq 4 file-path) buffer-file-name)
buffer-file-name
(read-file-name ""))
nil (pandoc-markdown-dialect))))
(provide 'copyit-pandoc)
;;; copyit-pandoc.el ends here