For Org Mode, I'm trying to generate a Table of Contents, but can't seem to make any headway. I've looked at the official documentation. Although I suspect this is just for exporting Org documents.
I've not found any direction on how to actually generate a Table of Contents with links that would appear in Github.
I've also explored snosov1/toc-org
and alphapapa/org-make-toc
. But their functions don't even generate malformed TOCs.
I was able to generate a TOC once with alphapapa/org-make-toc
. But can't replicate the result when trying to generate.
Sometimes nothing happens. And sometimes running org-make-toc
throws the message: user-error: Before first headline at position 213 in buffer SUNRA.org
(source).
What am I missing?
Emacs: 29.4 (https://emacsformacosx.com)
There seem to be two things wrong with the SUNRA.org
file you are using:
The :PROPERTIES: drawer needs to be adjacent to the Table of Contents
headline: there can be no empty line there, otherwise properties drawers are not recognized - see first paragraph of Property Syntax.
The commented-out TOC
line in the property drawer seems to cause problems - try deleting it.
In short, the Table of Contents
headline should start like this:
...
* Table of Contents
:PROPERTIES:
:TOC: :include all :ignore this
:END:
:CONTENTS:
:END:
...