snosov1 / toc-org

toc-org is an Emacs utility to have an up-to-date table of contents in the org files without exporting (useful primarily for readme files on GitHub)
GNU General Public License v3.0
287 stars 29 forks source link

Numbered sections in the table of contents. #54

Open mgoldenbe opened 6 years ago

mgoldenbe commented 6 years ago

I use #+OPTIONS: num:t to have my sections numbered in GitHub. How do I make the section numbers appear in the table of contents?

snosov1 commented 6 years ago

Thanks for this find.

Actually, there's 2 issues here. First, as you mention, the section numbers don't appear in the table of contents. And, second (which is, actually, somewhat worse), if you have the num option set to non-nil the hrefs to the headings change and the current links don't work.

I'll think about how to fix this.

mgoldenbe commented 6 years ago

Oops, I did not notice the second issue. However, that issue is not one of yours, since it affects all the internal links in README.org, not only the ones in the table of contents. So, I think that you need to only care about the first issue on your side.

mgoldenbe commented 6 years ago

As for the second issue, see this solution. Since this is the only workable solution right now, you might want to use such custom ids when they are available.

mgoldenbe commented 6 years ago

Note, however, that to insure jumping to the correct place, the solution needs to look like this:

@@html:<a name="intro">@@
* Introduction

That is, the ID should be placed before the heading. OK, I am done with my suggestion now. Thanks!