From fe45823c8b6da4ecae3347de4859127add03e253 Mon Sep 17 00:00:00 2001 From: Jay Kamat Date: Sun, 20 Aug 2017 19:01:29 -0400 Subject: [PATCH] ox-md.el: Add TITLE export to markdown export * lisp/ox-md.el (org-md-template): Add title export to md template. Title will be exported as level 1 and 2 headers, as determined by org-md-headline-style See https://github.com/larstvei/ox-gfm/issues/21 for an external bug report --- lisp/ox-md.el | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/lisp/ox-md.el b/lisp/ox-md.el index ac94ba648..a552063e8 100644 --- a/lisp/ox-md.el +++ b/lisp/ox-md.el @@ -649,14 +649,26 @@ holding export options." ;; Footnotes section. (org-md--footnote-section info))) -(defun org-md-template (contents _info) +(defun org-md-template (contents info) "Return complete document string after Markdown conversion. CONTENTS is the transcoded contents string. INFO is a plist used as a communication channel." - contents) + (concat + ;; Generate title and subtitle, if possible + (let ((title (and (plist-get info :with-title) + (plist-get info :title))) + (subtitle (plist-get info :subtitle)) + (style (plist-get info :md-headline-style))) + (when title + (concat + (org-md--headline-title style + 1 (org-export-data title info)) + (when subtitle + (org-md--headline-title style + 2 (org-export-data subtitle info)))))) + contents)) - ;;; Interactive function ;;;###autoload -- 2.11.0