-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Automatic update the table of content if available #2869
Conversation
linePossibleContainsHeadline (currentLine) { | ||
// We can't check if the line start with # because when some write text before | ||
// the # we also need to update the toc | ||
return currentLine.includes('# ') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can't we? We can just replace it with '\n# '
don't you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't think that matching '\n# '
helps. The line starts with the first char that is't a new line.
And we should check for the '# '
because when you add to a headline with '## test'
something at the beginning (new text is: 'something## test'
) the toc should automatic remote the entry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎉
linePossibleContainsHeadline (currentLine) { | ||
// We can't check if the line start with # because when some write text before | ||
// the # we also need to update the toc | ||
return currentLine.includes('# ') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right!
… if available when a headline was modified
Description
After a line with a headline was changed
(the line should contains
#
) in a note with a toc, the toc generator will generate a new toc for this note.Tested use cases:
Issue fixed
#2782
Type of changes
Checklist: