Skip to content

Commit 14532ec

Browse files
committed
ox-md: Fix export with broken links
* lisp/ox-md.el (org-md--headline-referred-p): Allow exporting headlines when the document contains broken links and `org-export-with-broken-links' is non-nil. For broken links, `org-export-resolve-link' throws an error - catch it and do not match the headline against such broken link.
1 parent 4631790 commit 14532ec

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

lisp/ox-md.el

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,10 @@ of contents can refer to headlines."
193193
;; A link refers internally to HEADLINE.
194194
(org-element-map (plist-get info :parse-tree) 'link
195195
(lambda (link)
196-
(eq headline
197-
(pcase (org-element-property :type link)
198-
((or "custom-id" "id") (org-export-resolve-id-link link info))
199-
("fuzzy" (org-export-resolve-fuzzy-link link info))
200-
(_ nil))))
196+
(equal headline
197+
;; Ignore broken links.
198+
(ignore-error 'org-link-broken
199+
(org-export-resolve-link link info))))
201200
info t))))
202201

203202
(defun org-md--headline-title (style level title &optional anchor tags)

0 commit comments

Comments
 (0)