Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Updating Existing TOC #13

Open
rzu-7 opened this issue Feb 1, 2021 · 1 comment
Open

Feature Request: Updating Existing TOC #13

rzu-7 opened this issue Feb 1, 2021 · 1 comment

Comments

@rzu-7
Copy link

rzu-7 commented Feb 1, 2021

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

if has_table_of_contents(md_text):
print('[WARNING]: \'{}\' already has a Table of Contents, Ignoring...'.format(title))
continue

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.

@clach04
Copy link

clach04 commented Jan 19, 2024

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants