From 8e82dbb23109e2bf13281d3f929bdddb9096d13d Mon Sep 17 00:00:00 2001 From: chasberry Date: Sun, 2 Nov 2014 13:16:55 -0800 Subject: [PATCH] lisp/ox-md.el: Fix lists following paragraphs * lisp/ox-md.el (org-md-separate-elements): Add a line after a paragraph that preceeds a list, but is not itself contained in a list. Markdown needs a blank line following a paragraph to understand that a list really is a list. However, nested lists do not need this and adding the blank line would result in extra whitespace when formatted for display. --- lisp/ox-md.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lisp/ox-md.el b/lisp/ox-md.el index 9625948..fd950d2 100644 --- a/lisp/ox-md.el +++ b/lisp/ox-md.el @@ -110,7 +110,7 @@ exceptions to this rule: 1. Preserve blank lines between sibling items in a plain list, - 2. Outside of plain lists, preserve blank lines between + 2. Outside of plain lists, preserve or add blank lines between a paragraph and a plain list, 3. In an item, remove any blank line before the very first @@ -127,6 +127,13 @@ Assume BACKEND is `md'." ((not (eq (org-element-type (org-element-property :parent e)) 'item))) (t (org-element-put-property e :post-blank (if (org-export-get-previous-element e info) 1 0)))))) + (org-element-map tree 'paragraph + (lambda (e) + (if + (eq (org-element-type (org-export-get-next-element e info)) + 'plain-list) + (org-element-put-property e :post-blank 1))) + nil nil 'plain-list) ;; Return updated tree. tree) -- 1.9.3 (Apple Git-50)