On 08/08/2025 02:07, Ihor Radchenko wrote:
Max Nikulin writes:

[[https://orgmode.org][<file:./img.png>]]

[[https://orgmode.org][file:./img.png]]
...
Image overlays are created for all 3 links in the case of Org 9.5.5,
however only first link is displayed as the image in the case of current
git main.

Is it a regression or an intentional change? Maybe I just missed some
defcustom or startup option.

Yeah. We forgot special case for nested links.
Nested links are not parsed, so we have special cases for them all over
the place.
The simplest fix will be restoring special handling of links inside link
description, although I am thinking if we should revert the Nicolas's
decision to disallow nested links.

At first I did not realize that preview of images in link descriptions is broken for all types of links including "file:" and "attachment:", see

Rudolf Adamkovič. Attachment previews went from semi-broken to broken. Tue, 16 Sep 2025 14:24:28 +0200.
<https://list.orgmode.org/[email protected]>

It should be supported accordingly to the docstring added by the following commit.

9cce40c94 2024-08-23 15:46:53 -0700 Karthik Chikmagalur: org-link: Customizable preview API for arbitrary link types

`org-link-preview-region':
By default, a file link or attachment is previewable if it
follows either of these conventions:

  1. Its path is a file with an extension matching return value
     from `image-file-name-regexp' and it has no contents.

  2. Its description consists in a single link of the previous
     type.  In this case, that link must be a well-formed plain
     or angle link, i.e., it must have an explicit \"file\" or
     \"attachment\" type.

I am still in doubts if nested links should be recognized by the parser.

Perhaps a default :preview function should be added to all link types. It should check if link description is a link to an image and should add a preview overlay. Likely a helper that test description whether it is an image may be reused in export functions.

Reply via email to