Andreas Matthias writes:

test.org:
#+include: a.org
#+include: b.org

a.org:
* COMMENT BBB

I have an idea that might help to create a workaround. Define a derived backend that exports headings with some tag, e.g. :fence:, as empty string (instead of dropping it early from AST) and add this kind of heading between "#+include:" lines:

    #+include: with-comment.org
    * ---Fence---  :fence:
    #+include: more.org :minlevel 1

On 06/11/2025 03:14, Ihor Radchenko wrote:> Then, Org looks at #+include: b.org, notice that it is inside
_commented_ heading, and skips over :)

This is a bug.

Definitely, it is a pitfall. Whether it is a bug, from my point of view, it is a more subtle question. Limiting scope of "#+include:" may lead to complications. Consider some text between include lines

    #+include: with-comment-heading.org

    A paragraph.

    #+include: another-file.org

If second include is not a part of last heading from first file then what you are going to do with intermediate text? If it belongs to the included heading then it is confusing to the similar degree as the reported case with following include. Otherwise it is top level text and "#+include:" becomes a way to achieve a frequently requested feature - terminating heading without starting new one. Most export backends have no way to express that some section is ended and following text should belong to higher level section. (I am leaving aside various insets.) I am in doubts if something like inline tasks should be allowed for all headings, despite it may be really convenient for notes.

Reply via email to