>> Would it be possible to also handle image data in the function or
>> refactor the org-link-preview-file function in a way that the geometry
>> handling is done in a helper function which can be reused by other
>> handlers.
>
> There is such function: `org-display-inline-image--width'.
> We may consider exposing it as public function.

This will not be enough, we will also have to expose `org-image--align'
and the alignment code:

(when align
  (overlay-put
   ov 'before-string
   (propertize
    " " 'face 'default
    'display
    (pcase align
      ("center" `(space :align-to (- center (0.5 . ,image))))
      ("right"  `(space :align-to (- right ,image)))))))

I don't think we can expect third party packages to figure out and
reimplement Org's image alignment logic.

Considering this, it might be better to just split
`org-link-preview-file' into two public functions, where the "inside"
function accepts an image instead of a file.

Karthik

Reply via email to