>From 341d7237b2b274c6f7d8da379f58ecb3ccb5d215 Mon Sep 17 00:00:00 2001
From: Markus Huber-Liebl <[email protected]>
Date: Tue, 6 May 2025 23:25:40 +0200
Subject: [PATCH] ox-md.el: Respect `:html-prefer-user-labels' for target type
* lisp/ox-md.el (org-md-link): Use `raw-path' as reference for
targets to match behaviour of `org-html-target'.
`org-md-link' always called `org-export-get-reference' regardless of
the `:html-prefer-user-labels' option. This let to a mismatch of the
used references.
TINYCHANGE
---
lisp/ox-md.el | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lisp/ox-md.el b/lisp/ox-md.el
index 0f621851d..7a0f2ef66 100644
--- a/lisp/ox-md.el
+++ b/lisp/ox-md.el
@@ -596,7 +596,7 @@ INFO is a plist holding contextual information. See
;; Reference.
(or (org-element-property :CUSTOM_ID destination)
(org-export-get-reference destination info))))
- (_
+ (any-type
(let ((description
(or (org-string-nw-p desc)
(let ((number (org-export-get-ordinal destination info)))
@@ -607,7 +607,9 @@ INFO is a plist holding contextual information. See
(when description
(format "[%s](#%s)"
description
- (org-export-get-reference destination info))))))))
+ (if (and (eq any-type 'target) (plist-get info
:html-prefer-user-labels))
+ raw-path
+ (org-export-get-reference destination info)))))))))
((org-export-inline-image-p link org-html-inline-image-rules)
(let ((path (cond ((not (string-equal type "file"))
(concat type ":" raw-path))
--
2.49.0