Browse Source

ox-md: Correctly export elements converted as HTML

* lisp/ox-md.el (org-md--identity):
(org-md--convert-to-html): New functions.
(md): Use new functions. Transparently export drawers.

According to <https://www.markdownguide.org/basic-syntax/#html>,
contents of elements converted to HTML must also be converted to HTML.

Reported-by: Dominique Dumont <domi.dumont@free.fr>
<http://lists.gnu.org/r/emacs-orgmode/2020-06/msg00397.html>
Nicolas Goaziou 4 years ago
parent
commit
83f5c6dcd8
1 changed files with 14 additions and 0 deletions
  1. 14 0
      lisp/ox-md.el

+ 14 - 0
lisp/ox-md.el

@@ -85,13 +85,17 @@ The %s will be replaced by the footnote reference itself."
 	      (if a (org-md-export-to-markdown t s v)
 		(org-open-file (org-md-export-to-markdown nil s v)))))))
   :translate-alist '((bold . org-md-bold)
+		     (center-block . org-md--convert-to-html)
 		     (code . org-md-verbatim)
+		     (drawer . org-md--identity)
+		     (dynamic-block . org-md--identity)
 		     (example-block . org-md-example-block)
 		     (export-block . org-md-export-block)
 		     (fixed-width . org-md-example-block)
 		     (headline . org-md-headline)
 		     (horizontal-rule . org-md-horizontal-rule)
 		     (inline-src-block . org-md-verbatim)
+		     (inlinetask . org-md--convert-to-html)
 		     (inner-template . org-md-inner-template)
 		     (italic . org-md-italic)
 		     (item . org-md-item)
@@ -105,7 +109,9 @@ The %s will be replaced by the footnote reference itself."
 		     (property-drawer . org-md-property-drawer)
 		     (quote-block . org-md-quote-block)
 		     (section . org-md-section)
+		     (special-block . org-md--convert-to-html)
 		     (src-block . org-md-example-block)
+		     (table . org-md--convert-to-html)
 		     (template . org-md-template)
 		     (verbatim . org-md-verbatim))
   :options-alist
@@ -279,6 +285,14 @@ INFO is a plist used as a communication channel."
                          fn-alist
                          "\n")))))
 
+(defun org-md--convert-to-html (datum _contents info)
+  "Convert DATUM into raw HTML, including contents."
+  (org-export-data-with-backend datum 'html info))
+
+(defun org-md--identity (_datum contents _info)
+  "Return CONTENTS only"
+  contents)
+
 
 ;;; Transcode Functions