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

include section the toc is under in the toc #57

Open
PlasmaHH opened this issue Mar 15, 2019 · 6 comments
Open

include section the toc is under in the toc #57

PlasmaHH opened this issue Mar 15, 2019 · 6 comments

Comments

@PlasmaHH
Copy link

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

@mzlogin
Copy link
Owner

mzlogin commented Mar 16, 2019

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?

@PlasmaHH
Copy link
Author

Yes, exactly. Though other positions should probably work too ;)

@mzlogin
Copy link
Owner

mzlogin commented Mar 19, 2019

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

@PlasmaHH
Copy link
Author

This is just the style my/our readmes are constructed, for a bit more context imagine:

Project

TOC

## Abstract # Chapter 1 .... # Chapter 2 ....

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.

@mzlogin mzlogin closed this as completed Mar 20, 2019
@mzlogin mzlogin reopened this Mar 20, 2019
@mzlogin
Copy link
Owner

mzlogin commented Mar 20, 2019

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!

@PlasmaHH
Copy link
Author

Indeed it works as expected

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

No branches or pull requests

2 participants