alphapapa / org-make-toc

Automatic tables of contents for Org-mode files
GNU General Public License v3.0
108 stars 18 forks source link

Add an option to automatically insert CUSTOM_ID property to entries #22

Closed noctuid closed 1 year ago

noctuid commented 2 years ago

This will allow links to work on both Github and in Org. Fixes #20.

I only looked at the existing code briefly, but it looked like entry was only called on non-ignored headings. If that's incorrect or there is something else wrong with this approach, let me know.

noctuid commented 2 years ago

Any feedback on this? I am making some new packages and would like to switch to org-make-toc for my table of contents (but want links to work in the org buffer also; using custom ids better than the toc-org solution since it will work without user configuration).

mattiasdrp commented 1 year ago

This is a nice feature and it would be really nice if it could be merged ;-)

alphapapa commented 1 year ago

Thanks for pinging on this PR. I don't think I had noticed it yet.

This seems like a good idea, yes. I wonder if it would be even better if it were implemented as one of the link-type functions so it wouldn't need a new customization option. It could probably be just a simple function that called the github-style function and also added the custom ID.

It would also be good to handle disambiguation in case multiple headings have the same name. But I'm not sure if that should be in scope for this PR. What do you think?

Thanks.

noctuid commented 1 year ago

I'm not sure. I think it might be better to have it as a setting in the case that styles for other sites were added instead of having two styles for each site. Let me know if you want me to change it to a new style instead.

It would also be good to handle disambiguation in case multiple headings have the same name. But I'm not sure if that should be in scope for this PR. What do you think?

Probably something to look into later. Haven't tested to see how github handles it (or if it can correctly handle it), but I think disambiguation needs to be considered even if this PR isn't merged.

alphapapa commented 1 year ago

Finally merged. Please let me know if it works for you. Thanks.

mattiasdrp commented 10 months ago

Hello, sorry for the late answer. This update is perfect for my needs, thanks a lot :-)

alphapapa commented 10 months ago

Thanks!