-
-
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 table of contents generation for Markdown #2281
Conversation
Adds table of contents for any Markdown note or Markdown snippet. Consequent generations update existing TOC. Generated TOC is case sensitive to handle BoostIO#2067 Shortcut : CommandOrControl+Alt+T Menu : Edit/Generate/Update Markdown TOC
Due to the fact, that submenu "Edit" is visible only in macOS, let's move TOC generator to "File" menu. Also, change accelerator to SHIFT+CTRL+T which is working without conflicts and problems on all platforms.
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.
Could you make a test for this function?
https://github.com/BoostIO/Boostnote/pull/2281/files#diff-6a71191a63c2cc8d596fd5acceb9e08cR41
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.
@Rokt33r , good point. I've added unit test with 13 test cases.
LGTM 🎉 |
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 think this need some small changes before it get merged.
Hey @mbarczak , just one more small request, it would be great if you can insert the toc at the cursor position. Sometimes, I want to have a document like this:
With the current code it only insert at the top of the document. |
If there is no TOC in the current document, it's created at current cursor position. Subsequent generation calls update TOC at existing position. Add additional tests with CodeMirror editor mock.
@ZeroX-DG , I've introduced change you requested, and indeed, it's more usable now. Also, I've added additional tests with CodeMirror mock. |
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.
Just another small request 😄 can you please change your code. Thank you!
@ZeroX-DG , all requests solved ;) |
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 🎉 Thank you for your contribution!
Hi @Rokt33r , work is done here. Ready to be merged. |
Hi @mbarczak, I featured your contribution on release blog 😄 Thank you! |
This PR aims to solve #1436.
Shortcut : SHIFT+CTRL+T
Menu : File / Generate/Update Markdown TOC