Function: org-md--headline-referred-p
org-md--headline-referred-p is a byte-compiled function defined in
ox-md.el.gz.
Signature
(org-md--headline-referred-p HEADLINE INFO)
Documentation
Non-nil when HEADLINE is being referred to.
INFO is a plist used as a communication channel. Links and table of contents can refer to headlines.
Source Code
;; Defined in /usr/src/emacs/lisp/org/ox-md.el.gz
;;; Internal functions
(defun org-md--headline-referred-p (headline info)
"Non-nil when HEADLINE is being referred to.
INFO is a plist used as a communication channel. Links and table
of contents can refer to headlines."
(unless (org-element-property :footnote-section-p headline)
(or
;; Global table of contents includes HEADLINE.
(and (plist-get info :with-toc)
(memq headline
(org-export-collect-headlines info (plist-get info :with-toc))))
;; A local table of contents includes HEADLINE.
(cl-some
(lambda (h)
(let ((section (car (org-element-contents h))))
(and
(eq 'section (org-element-type section))
(org-element-map section 'keyword
(lambda (keyword)
(when (equal "TOC" (org-element-property :key keyword))
(let ((case-fold-search t)
(value (org-element-property :value keyword)))
(and (string-match-p "\\<headlines\\>" value)
(let ((n (and
(string-match "\\<[0-9]+\\>" value)
(string-to-number (match-string 0 value))))
(local? (string-match-p "\\<local\\>" value)))
(memq headline
(org-export-collect-headlines
info n (and local? keyword))))))))
info t))))
(org-element-lineage headline))
;; A link refers internally to HEADLINE.
(org-element-map (plist-get info :parse-tree) 'link
(lambda (link)
(equal headline
;; Ignore broken links.
(condition-case nil
(org-export-resolve-id-link link info)
(org-link-broken nil))))
info t))))