[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Justify/align image previews in org-mode

From: Ihor Radchenko
Subject: Re: [PATCH] Justify/align image previews in org-mode
Date: Mon, 18 Dec 2023 17:07:58 +0000

Karthik Chikmagalur <karthikchikmagalur@gmail.com> writes:

>> This will not work when the image paragraph is indented:
> * This is test
>   #+attr_org: :align center
>   [[file:~/Downloads/wallpaper.png]]
> - Is there a better way to address this than checking if there is only
> whitespace behind the link until the start of the paragraph?

I can only suggest something like

(equal (org-element-begin link)
  (goto-char (org-element-contents-begin paragraph))
  (skip-chars-forward "\t ")

(equal (org-element-end link)
  (goto-char (org-element-contents-end paragraph))
  (skip-chars-backward "\t ")

> - Does org-element provide a property that can help here? I tried
> :pre-blank but it was nil, I'm not sure what it does.

:pre-blank is for blank lines before contents. Leading whitespace is
considered a part of the paragraph:
(paragraph (...) "  " (link ...) "\n")

Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]