Add doc string and format
This commit is contained in:
parent
33e93de7e3
commit
d300d45f89
@ -3767,6 +3767,9 @@ Support sending rich-text emails via Markdown:
|
|||||||
"<#/multipart>\n"))
|
"<#/multipart>\n"))
|
||||||
|
|
||||||
(defun convert-message-to-markdown ()
|
(defun convert-message-to-markdown ()
|
||||||
|
"Convert the message in the current buffer to a multipart HTML email.
|
||||||
|
|
||||||
|
The HTML is rendered by treating the message content as Markdown."
|
||||||
(interactive)
|
(interactive)
|
||||||
(unless (executable-find "pandoc")
|
(unless (executable-find "pandoc")
|
||||||
(error "Pandoc not found, unable to convert message"))
|
(error "Pandoc not found, unable to convert message"))
|
||||||
@ -3780,8 +3783,8 @@ Support sending rich-text emails via Markdown:
|
|||||||
(call-process-region begin end "pandoc" nil html-buf nil
|
(call-process-region begin end "pandoc" nil html-buf nil
|
||||||
"--quiet" "-f" "gfm" "-t" "html"))
|
"--quiet" "-f" "gfm" "-t" "html"))
|
||||||
(html (format "<html>\n<head></head>\n<body>\n%s\n</body></html>\n"
|
(html (format "<html>\n<head></head>\n<body>\n%s\n</body></html>\n"
|
||||||
(with-current-buffer html-buf
|
(with-current-buffer html-buf
|
||||||
(buffer-substring (point-min) (point-max)))))
|
(buffer-substring (point-min) (point-max)))))
|
||||||
(raw-body (buffer-substring begin end)))
|
(raw-body (buffer-substring begin end)))
|
||||||
(when (not (= exit-code 0))
|
(when (not (= exit-code 0))
|
||||||
(error "Markdown conversion failed, see %s" (buffer-name html-buf)))
|
(error "Markdown conversion failed, see %s" (buffer-name html-buf)))
|
||||||
@ -3812,8 +3815,8 @@ Support sending rich-text emails via Markdown:
|
|||||||
(message-send-and-exit))
|
(message-send-and-exit))
|
||||||
|
|
||||||
(with-eval-after-load 'message
|
(with-eval-after-load 'message
|
||||||
(define-key message-mode-map (kbd "C-c C-s") #'message-md-send)
|
(define-key message-mode-map (kbd "C-c C-s") #'message-md-send)
|
||||||
(define-key message-mode-map (kbd "C-c C-c") #'message-md-send-and-exit))
|
(define-key message-mode-map (kbd "C-c C-c") #'message-md-send-and-exit))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user