mzlogin/vim-markdown-toc

Make the TOC guard text be configurable

idvorkin opened this issue · 7 comments

Very helpful utility, the missing piece for me to do all my markdown edittng in VIM!!

That said, my team uses multiple editors, and the team has agreed that the TOC guard should be

<!-- TOC --> 

Can you make the TOC guard configurable? Thanks!!

return "<!-- vim-markdown-toc " . a:markdownStyle . " -->"

Maybe I can make the text vim-markdown-toc be configurable, but the a:markdownStyle, values GFM, GitLab or Redcarpet is used for help decide which Markdown syntax to use when auto update toc on save.

In other words, if I make the whole TOC guard text be configurable, the convenient of feature auto update toc on save will lose, and even cannot use :UpdateToc command to update toc manually.

So, before make the whole TOC guard text configurable, we'd better think of a good way to solve this problem.

That sounds good.

There is one more to be confirmed, in your scene, what you expect to see is

<!-- TOC -->

toc content here

<!-- TOC -->

right?

Yup. Where TOC is configurable.

Touching thread incase you already have a PR that your forgot to push :)

Hi @idvorkin , first of all, let me say sorry. I delayed so long time to solve this problem.

Now you can configure the TOC guard text, and assign Markdown style in file's modeline now, looks like this:

image

Hope that's what you want.

Here is the steps:

  1. Upgrade this plugin to the lastest version.

  2. Configure TOC guard text in your vimrc file:

    let g:vmt_fence_text = 'TOC'
  3. Add filetype with Markdown style in your Markdown file modeline.

     vim:filetype=GFM.markdown:
    

    the example is GFM, you also can use GitLab.markdown or Redcarpet.markdown.

  4. Remove the existing TOC, close and reopen the Markdown file (to make modeline settings take effects).

  5. Genereate TOC with command :GenTocModeline.

Notice: please don't set Markdown style in modeline if you want to use command GenTocGFM, GenTocGitLab or GenTocRedcarpet, otherwise the plugin will be confused.

Awesome! Thank you.