Karthik Chikmagalur <karthikchikmaga...@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)
(save-excursion
  (goto-char (org-element-contents-begin paragraph))
  (skip-chars-forward "\t ")
  (point)))

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

> - 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