Skip to content

Commit

Permalink
ox-md: Fix export with broken links
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
yantar92 committed Jul 23, 2022
1 parent 4631790 commit 14532ec
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lisp/ox-md.el
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,10 @@ of contents can refer to headlines."
;; A link refers internally to HEADLINE.
(org-element-map (plist-get info :parse-tree) 'link
(lambda (link)
(eq headline
(pcase (org-element-property :type link)
((or "custom-id" "id") (org-export-resolve-id-link link info))
("fuzzy" (org-export-resolve-fuzzy-link link info))
(_ nil))))
(equal headline
;; Ignore broken links.
(ignore-error 'org-link-broken
(org-export-resolve-link link info))))
info t))))

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

0 comments on commit 14532ec

Please sign in to comment.