Make pandoc conversion arguments customisable

This commit is contained in:
TEC 2024-04-11 11:42:05 +08:00
parent bc91164151
commit 4ede32d859
Signed by: tec
SSH Key Fingerprint: SHA256:eobz41Mnm0/iYWBvWThftS0ElEs1ftBr6jamutnXc/A
1 changed files with 10 additions and 2 deletions

View File

@ -197,6 +197,12 @@ Set to nil to disable."
:type '(repeat regexp) :type '(repeat regexp)
:group 'emacs-everywhere) :group 'emacs-everywhere)
(defcustom emacs-everywhere-pandoc-md-args
'("-f" "markdown-auto_identifiers" "-t" "org")
"Arguments supplied to pandoc when converting text from Markdown to Org."
:type '(repeat string)
:group 'emacs-everywhere)
(defcustom emacs-everywhere-clipboard-sleep-delay 0.01 (defcustom emacs-everywhere-clipboard-sleep-delay 0.01
"Waiting period to wait to propagate clipboard actions." "Waiting period to wait to propagate clipboard actions."
:type 'number :type 'number
@ -631,8 +637,10 @@ return windowTitle"))
(when (and (eq major-mode 'org-mode) (when (and (eq major-mode 'org-mode)
(emacs-everywhere-markdown-p) (emacs-everywhere-markdown-p)
(executable-find "pandoc")) (executable-find "pandoc"))
(shell-command-on-region (point-min) (point-max) (apply #'call-process-region
"pandoc -f markdown-auto_identifiers -t org" nil t) (point-min) (point-max) "pandoc"
nil nil nil
emacs-everywhere-pandoc-md-args)
(deactivate-mark) (goto-char (point-max))) (deactivate-mark) (goto-char (point-max)))
(cond ((bound-and-true-p evil-local-mode) (evil-insert-state)))) (cond ((bound-and-true-p evil-local-mode) (evil-insert-state))))