On August 11, 2023 5:20:08 AM EDT, Ihor Radchenko <yantar92@posteo.net> wrote:
"Tom Alexander" <tom@fizz.buzz> writes:

The org-mode documentation states: "With the exception of list items, blank lines belong to the preceding element with the narrowest possible scope. For example, if at the end of a section we have a paragraph and a blank line, that blank line is considered part of the paragraph."

https://orgmode.org/worg/org-syntax.html#org9bc833d

So I created a test org-mode document with exactly that scenario described:
...
and then I ran a M-x eval-expression (message "%s" (pp-to-string (org-element-parse-buffer))) to see the parse tree. I'll paste the output at the end because its a wall of text, but analyzing it:
...
Its only child is a paragraph which has a :begin at 1 and :end at 10, which only includes the line break at the end of "foo bar." but this is exactly the scenario described in the documentation (a paragraph at the end of a section) so I would expect the paragraph to end at 14, not 10.

You are right and you revealed an existing inconsistency between our
incremental and recursive parsers (org-element-parse-buffer is the
recursive parser).

Fixed, on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=bfe1179dc

Also, in addition to list items, footnote-definitions do not extend
their contents to the trailing blank lines.
I now clarified it in org-syntax document.
https://git.sr.ht/~bzg/worg/commit/3e91f5be


Oh neat, I didn't know there were two! I'll check that out. Thanks!