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

please add a new feature of updating existing toc #6

Closed
hitzhangjie opened this issue Apr 18, 2016 · 7 comments
Closed

please add a new feature of updating existing toc #6

hitzhangjie opened this issue Apr 18, 2016 · 7 comments

Comments

@hitzhangjie
Copy link

First of all, thanks for your good work, it's very convenient to generate toc now. If you add a new feature like updating existing toc when triggering some hotkeys, it would be more useful. Is it right?
I have no vim script programming experience, but I think this is a good idea for some document which contains a long table of contents. If you add a updating-toc feature, we don't have to delete existing toc again. And I think inserting toc before the document is finished is useful too, because it can help us navigate the document.
So I think add a updating-toc feature is very useful. Thanks!

@hitzhangjie
Copy link
Author

I have another question, 'toc' generated by your plugin, I cannot used it for navigate in documents, I used 'instant-markdown' for realtime preview. Do they the two plugins conflict with each other?

@mzlogin
Copy link
Owner

mzlogin commented Apr 18, 2016

@hitzhangjie For your second question, it seems 'instant-markdown' use CommonMark as its Markdown parser, CommonMark does not add anchor to headings automatic default, and TOC link relyon this feature. Maybe you can find some options in these plugins to turn on it.

Unfortunately, different Markdown parser generate different anchor link for headlings, my current work is for GFM and Redcarpet, under CommonMark is untested.

At company I'm using Windows, and 'instant-markdown' doesn't support Windows official, so I cannot test the situation you said now. If you find the realtime preview page's headings have anchor with them, could you provider a demo generated html file to me for analyze? Thanks.

@mzlogin
Copy link
Owner

mzlogin commented Apr 18, 2016

@hitzhangjie Updating existing toc is a good idea, I'll work on it when I got some free time.

@sunaku
Copy link

sunaku commented Oct 18, 2016

:neckbeard: Here is how I do this from Vim's command mode:

:/<!-- vim-markdown-toc \w\+ -->/,/<!-- vim-markdown-toc -->/d|execute 'normal! k'|GenTocGFM

You can replace GenTocGFM with GenTocRedcarpet as the last word of the command line too.

@sunaku
Copy link

sunaku commented Oct 18, 2016

Oops, this plugin already provides a :UpdateToc command. 🎅 Shouldn't this issue be closed then? 📕

@mzlogin
Copy link
Owner

mzlogin commented Oct 19, 2016

@sunaku Yeah, I updated the code yesterday to add :UpdateToc command and a feature of auto update toc on save, but have not update the README doc yet. Sorry about that, I'll do it soon. Your command mode command above is very concisely, thanks.

@hitzhangjie You can use :UpdateToc command to update existing toc generated by this plugin now, and by default, the toc will auto update when save, you also can add let g:vmt_auto_update_on_save = 0 to your vimrc file to close this feature.

@mzlogin mzlogin closed this as completed Oct 19, 2016
@sunaku
Copy link

sunaku commented Oct 19, 2016

Awesome! ✨ Auto-update on save sounds great! 👍 Thanks @mzlogin. 🎅

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

No branches or pull requests

3 participants