markdown-github-bear-toc icon indicating copy to clipboard operation
markdown-github-bear-toc copied to clipboard

Feature Request: Updating Existing TOC

Open rzu-7 opened this issue 4 years ago • 1 comments

I noticed that if I create a TOC for a Bear note and then make changes to the note headers, if I rerun the script it does not update the TOC and says the Note already has headers.

I took a peek at the code and I think the key place in the code is here https://github.com/alexander-lee/markdown-github-bear-toc/blob/06037316dac6c8b3e16e3ea29a5142fca65c02bb/markdowntoc/markdowntoc.py#L210-L212

I propose to have logic in that if statement to delete the TOC and then continue recreating it so that if there are any changes they get accounted for.

rzu-7 avatar Feb 01 '21 06:02 rzu-7

I've seen other mechanisms where there is an explicit TOC marker that the user can insert in the place they want the TOC to be placed. Then on re-run that same marker (in a comment) is located and then deleting the existing links/TOC is considered safe.

I'm not using this tool, but considering options (my current use case is html generation so currently experimenting with TOC generation tweaks in the markdown to html phase). If I end up using this, I'll likely need/want this functionality (and would implementing it myself).

clach04 avatar Jan 19 '24 18:01 clach04