vim-markdown-toc
vim-markdown-toc copied to clipboard
include section the toc is under in the toc
Currently it looks like the plugin ignores all headings above the point where you insert it. This leads to the case that when it is inserted under a # heading and after the toc comes a ## heading, the generated markdown list starts with an indentation, which will not be rendered as part of the list. Therefore the plugin should have an option to also include all the headings that are before its insert point
Thanks for your suggestion.
Let me retell your scene,
# heading1-1
<-- you want to insert toc here
## heading2-1
# heading1-2
## heading2-2
is that right?
Yes, exactly. Though other positions should probably work too ;)
I think I get the drift. But I want to know, why don't you insert toc in the following two positions
<------------------- position 1
# heading1-1
## heading2-1
<------------------- position 2
# heading1-2
## heading2-2
This is just the style my/our readmes are constructed, for a bit more context imagine:
Project
TOC
The documents basically have an introductionary level1 chapter that contains the toc as a part of the introduction.
Btw. I found a hackish workaround, which relies on what maybe would be considered a bug by some. Putting # Project within html comments just after the toc makes it not displayed as text but parsed by the toc plugin. However this might be considered a bug in case it is expected to ignore things that would not be rendered. Also I am not sure if this works for all markdown renderers.
Hi~I add an option g:vmt_include_headings_before to support this.
So you can add let g:vmt_include_headings_before = 1 in your vimrc file now.
Could you please feedback your result? Thanks a lot!
Indeed it works as expected