mzlogin / vim-markdown-toc

A vim 7.4+ plugin to generate table of contents for Markdown files.
http://www.vim.org/scripts/script.php?script_id=5460
MIT License
613 stars 59 forks source link

Removing existed insert fence, then UpdateToc manually raises error. #15

Closed liuchengxu closed 8 years ago

liuchengxu commented 8 years ago
Error detected while processing function <SNR>120_UpdateToc[5]..<SNR>120_DeleteExistingToc:
line   29:
Cannot find toc begin fence
Error detected while processing function <SNR>120_UpdateToc:
line    8:
Cannot find existing toc

It's noted that insert fence followed is neccessay for auto save, but I don't need it and like running :UpdateToc manually, in which situation the error above occurs. I think it should be coverd.

<!-- vim-markdown-toc GFM -->
toc
<!-- vim-markdown-toc -->
mzlogin commented 8 years ago

Sorry about that, it's my fault there is no clear description in the doc.

As of now, :UpdateToc command is only useful when g:vmt_auto_update_on_save is turn off and keep insert fence on.

The fence have two functions, the most important it can mark which Markdown parser link style the toc is, like GFM or Redcarpet, and it also mark start and end of the toc.

Unless one day I find and implement a better idea to replace this strategy, the fence is needed when update toc, whether auto update on save or use :UpdateToc command.

If you want to update toc without fence existing, now you can only delete existing toc manually and rerun :GenTocXXX command.

liuchengxu commented 8 years ago

Hope you find a better solution!

mzlogin commented 8 years ago

Thanks. I'll keep thinking about it.

Because it is not a bug on the basis of current strategy, so I'll close this issue first. If I find a better solution, I will @ you here. And if you have some idea, please let me know.

I will update instructions of :UpdateToc command in the doc, and change the error output to normal message level later.

Thanks for reporting, more feedbacks are welcome.