From 1cf5914c41dc73f2e62d04f2ee866a352006806c Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Wed, 13 Apr 2022 09:21:34 +0200 Subject: [PATCH 1/2] Avoid failure if no markdown compiler is installed * elpa-admin.el (elpaa--markdown-candidates): Add list of markdown implementations (elpa--markdown-executable): Add function to detect available implementations (elpaa--section-to-html): Use elpa--markdown-executable --- elpa-admin.el | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/elpa-admin.el b/elpa-admin.el index d570c3c6aa..e86b8d3196 100644 --- a/elpa-admin.el +++ b/elpa-admin.el @@ -1257,6 +1257,22 @@ which see." :ext-plist (append '(:html-toplevel-hlevel 3) elpaa--org-export-options))) +(defvar elpaa--markdown-candidates + '("pandoc" "cmark" "marked" "discount" ;ideally + "lowdown" "hoedown" "sundown" "kramdown" ;backup + "markdown.pl" "markdown_py" "md2html.awk" ;fallback + "markdown" ;despair + )) + +(defun elpa--markdown-executable () + (catch 'exists + (dolist (cmd elpaa--markdown-candidates) + (when (executable-find cmd) + (throw 'exists cmd))) + ;; If no markdown compiler is installed, just display + ;; the source without rendering it. + "cat")) + (cl-defmethod elpaa--section-to-html ((section (head text/markdown))) (with-temp-buffer (let ((input-filename @@ -1264,7 +1280,7 @@ which see." (unwind-protect (progn (write-region (cdr section) nil input-filename) - (elpaa--call-sandboxed t "markdown" input-filename)) + (elpaa--call-sandboxed t (elpa--markdown-executable) input-filename)) (delete-file input-filename))) ;; Adjust headings since this HTML fragment will be inserted ;; inside an

section. -- 2.30.2