-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
Content between TOC and next header gets removed #18
Comments
Why do you think that’s a bug? IMO it’s a feature 🤷♂️ What else would you like to put in a toc? |
I think I was not clear enough...
I would expect, with the ToC plugin, to end up with something like this:
But I end up with:
The intro text gets remove. |
Hmm, from all the tables of contents I’ve seen I think that they only house a list of the content. I don’t think I’ve seen alternative content being used. Why not go with: ...
This is my intro text, explaining what is on this page, lorem ipsum dolor sit amet.
## Table of Contents
* Title One
* Sub title A
* Sub title B
## Title One
### Sub title A
Some text from Sub title A
### Sub title B
Some text from Sub title B
... |
Well, this can be done this way of course. But I still think this is a bug, and it can be fixed quite easily. Paragraphs between ToC and first title should not simply disappear IMO. |
Currently we’re looking for a heading and replacing the whole content of that “section”. The same is done for Alternatively, we could look for comments, called “ranges”. See |
Feel free to open a PR there if you’d like to add this new feature. |
- if the usage section had no content, the consumer badges were being found under the TOC section. Given that the [TOC plugin expects to stomp the entire section](remarkjs/remark-toc#18), it was eating the consumer-badges target section - fixes form8ion#475
I have the same problem right now. I want to have some intro text after the ToC without its own heading. Is there a way to achieve this? |
My workaround, for now, is to add an "Intro" header to the intro section, let remark-toc skip it:
And then I hide the h2 tag with CSS (I wanna keep the empty space):
|
The same response (#18 (comment)) still holds. |
…tion so the text in between won't be replaced by auto-generated TOC remarkjs/remark-toc#18
@pascal-mugnier-sonarsource I created my won function to use as a plugin and shared it here: #40 (comment) |
…tion so the text in between won't be replaced by auto-generated TOC remarkjs/remark-toc#18
…tion so the text in between won't be replaced by auto-generated TOC remarkjs/remark-toc#18
If you have content between the TOC header and the next header, the plugin will remove it.
Exemple:
In this example,
Some teext here...
will get removed.I think this can be fixed by changing this line:
node.children.slice(result.index)
to
node.children.slice(result.endIndex)
The text was updated successfully, but these errors were encountered: