Function: org-md-headline
org-md-headline is a byte-compiled function defined in ox-md.el.gz.
Signature
(org-md-headline HEADLINE CONTENTS INFO)
Documentation
Transcode HEADLINE element into Markdown format.
CONTENTS is the headline contents. INFO is a plist used as a communication channel.
Source Code
;; Defined in /usr/src/emacs/lisp/org/ox-md.el.gz
;;;; Headline
(defun org-md-headline (headline contents info)
"Transcode HEADLINE element into Markdown format.
CONTENTS is the headline contents. INFO is a plist used as
a communication channel."
(unless (org-element-property :footnote-section-p headline)
(let* ((level (+ (org-export-get-relative-level headline info)
(1- (plist-get info :md-toplevel-hlevel))))
(title (org-export-data (org-element-property :title headline) info))
(todo (and (plist-get info :with-todo-keywords)
(let ((todo (org-element-property :todo-keyword
headline)))
(and todo (concat (org-export-data todo info) " ")))))
(tags (and (plist-get info :with-tags)
(let ((tag-list (org-export-get-tags headline info)))
(and tag-list
(concat " " (org-make-tag-string tag-list))))))
(priority
(and (plist-get info :with-priority)
(let ((char (org-element-property :priority headline)))
(and char (format "[#%c] " char)))))
;; Headline text without tags.
(heading (concat todo priority title))
(style (plist-get info :md-headline-style)))
(cond
;; Cannot create a headline. Fall-back to a list.
((or (org-export-low-level-p headline info)
(not (memq style '(atx mixed setext)))
(and (eq style 'atx) (> level 6))
(and (eq style 'setext) (> level 2))
(and (eq style 'mixed) (> level 6)))
(let ((bullet
(if (not (org-export-numbered-headline-p headline info)) "-"
(concat (number-to-string
(car (last (org-export-get-headline-number
headline info))))
"."))))
(concat bullet (make-string (- 4 (length bullet)) ?\s) heading tags "\n\n"
(and contents (replace-regexp-in-string "^" " " contents)))))
(t
(let ((anchor
(and (org-md--headline-referred-p headline info)
(format "<a id=\"%s\"></a>"
(or (org-element-property :CUSTOM_ID headline)
(org-export-get-reference headline info))))))
(concat (org-md--headline-title style level heading anchor tags)
contents)))))))