org-make-toc
org-make-toc copied to clipboard
:include siblings may sometimes include descendants also?
Hello, I have run the latest version of org-make-toc on the README of my project, and there is something wrong with the output.
Both "Guide" and "Design goal" should reside at the same level as "Features", but they are demoted. The output in plain text is as follows:
:CONTENTS:
- [[#features][Features]]
- [[#when-to-and-when-not-to-use-elinter][When to and when not to use elinter]]
- [[#guide-how-to-configure-your-emacs-lisp-project][Guide: How to configure your Emacs Lisp project]]
- [[#design-goal][Design goal]]
:END:
I produced the TOC with my new GitHub Action which runs org-make-toc on CI. It basically runs this script in batch mode with the file given as an argument, so it has no custom Org options set.
Can this be a bug with org-make-toc.el?
Hi Akira,
Does the bug only happen on the GitHub Action CI?
Does the bug only happen on the GitHub Action CI?
No, the bug reproduces on interactive sessions as well, with my extensively customized config. org-make-toc
seems to produce exactly the same output between the two environments.
Interestingly, it seems to produce a correct output when I demote the TOC context to the second level. You can get a correct result from the following input:
* New heading
** The TOC context
:PROPERTIES:
:TOC: :include siblings :depth 2 :ignore this
:END:
:CONTENTS:
:END:
*** Features
*** Guide
*** Design goal
while not from the following one:
* The TOC context
:PROPERTIES:
:TOC: :include siblings :depth 2 :ignore this
:END:
:CONTENTS:
:END:
** Features
** Guide
** Design goal
I'm sorry, but the culpit was :include siblings
, which should have been :include descendants
. I don't remember why I got it wrong, but correctly specifying the property has fixed the issue:
:PROPERTIES:
:TOC: :include descendants :depth 2
:END:
It seems that the descendants are included in the TOC in a wrong way if :include siblings
is specified in the property. I don't think this is a common case, but it may be another bug.
Thanks.