Closed idvorkin closed 6 years ago
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.
Good thinking!
We could stick a guard in comments somewhere. Kind of like how vim does with the lines like these:
vim:tw=78:fo=tcq2:isk=!-~,^*,^|,^\":ts=8:ft=help:norl:
On Mon, Nov 27, 2017 at 7:12 AM, Zhuang Ma notifications@github.com wrote:
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.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mzlogin/vim-markdown-toc/issues/37#issuecomment-347211829, or mute the thread https://github.com/notifications/unsubscribe-auth/AARJlbiP90wJ2FvX6OE2-okZSdCEzC7Iks5s6tFtgaJpZM4Qq0Az .
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:
Hope that's what you want.
Here is the steps:
Upgrade this plugin to the lastest version.
Configure TOC guard text in your vimrc file:
let g:vmt_fence_text = 'TOC'
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
.
Remove the existing TOC, close and reopen the Markdown file (to make modeline settings take effects).
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.
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
Can you make the TOC guard configurable? Thanks!!
https://github.com/mzlogin/vim-markdown-toc/blob/8df20bed4c604f51b4ec87bed7f07dc107ba3645/ftplugin/markdown.vim#L280