I dug a little bit into the export code and it looks like the default
function for formatting TOC entries is `org-export-toc-entry-backend',
which explicitly states that "...it changes links and radio targets into
regular text." It does take an optional set of transcoders, so I tried
changing where it gets called in ox-html.el to pass a custom transcoder for
links:

@@ -2589,7 +2589,9 @@ INFO is a plist used as a communication channel."
                         (org-element-property :priority headline)))
          (text (org-export-data-with-backend
                 (org-export-get-alt-title headline info)
-                (org-export-toc-entry-backend 'html)
+                (org-export-toc-entry-backend 'html
+                  `(link . ,(lambda (l c i)
+                              (org-html-link l c i))))
                 info))
          (tags (and (eq (plist-get info :with-tags) t)
                     (org-export-get-tags headline info))))

With some minimal testing this does appear to work, at least with the test
case I created. I don't know that we want to make a default behavior
change, so it might be better to provide a defcustom to either control
HTML-ified links or to allow for a custom format function. There may
already be one, I'm not that familiar with ox-html.el and didn't have time
to fully review the file.

Cheers,

Derek

On Sat, Apr 25, 2026 at 7:07 AM Derek Chen-Becker <[email protected]>
wrote:

> Owned. Let me take a look and see what I can figure out.
>
> Cheers,
>
> Derek
>
> On Mon, Apr 20, 2026 at 11:29 PM Bastien Guerry <[email protected]> wrote:
>
>> Derek Chen-Becker <[email protected]> writes:
>>
>> > Confirmed, on HEAD.
>>
>> I'm updating the subject so that BARK sees this as a bug.
>>
>> Confirmed.
>>
>> --
>>  Bastien
>>
>
>
> --
> +---------------------------------------------------------------+
> | Derek Chen-Becker                                             |
> | GPG Key available at https://keybase.io/dchenbecker and       |
> | https://pgp.mit.edu/pks/lookup?search=derek%40chen-becker.org |
> | Fngrprnt: EB8A 6480 F0A3 C8EB C1E7  7F42 AFC5 AFEE 96E4 6ACC  |
> +---------------------------------------------------------------+
>
>

-- 
+---------------------------------------------------------------+
| Derek Chen-Becker                                             |
| GPG Key available at https://keybase.io/dchenbecker and       |
| https://pgp.mit.edu/pks/lookup?search=derek%40chen-becker.org |
| Fngrprnt: EB8A 6480 F0A3 C8EB C1E7  7F42 AFC5 AFEE 96E4 6ACC  |
+---------------------------------------------------------------+

Reply via email to