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

Added automatic re-indexing #19

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

padalev
Copy link

@padalev padalev commented Jan 7, 2023

I added functionality for re-indexing footnotes automatically.

To achieve this I mostly re-wrote the shouldCreateNewFootnote() function.
The new footnote ID is determined by just searching for the biggest footnote before the current cursor position.
Then all IDs bigger or equal to that get incremented.
Lastly the new footnote marker and detail get added.

Regarding the edge cases:

What if... new footnote is inserted before the first footnote?

Footnote details get added before the next one. So not an issue.

What if... text has the same footnote at several places?

Not an issue since only bigger IDs ever get incremented. New footnote is only added afterwards.

What if...Footnote details are spread across the text?

Not an issue since the correct position is just searched for everywhere after the cursor (could be changed to everywhere maybe?)

What if... the footnote details are multi-line on the bottom?

Not an issue as the new detail line is placed just before the next one.

What if... there are non-numeric footnotes in the text?

Get ignored for now.

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

Successfully merging this pull request may close these issues.

1 participant