Open 13protons opened 5 years ago
So you actually want a sidebar similar to table of contents? It makes sense, but I really want to know what sidebar do you want the following title to generate?
# title1
### title2
## title3
hmmm, here's a test with the existing markdown-it
TOC plugin that vuepress is already using:
The goal of the sidebar is probably not to emulate the toc
plugin exactly, but it seems to have some handle on when to hide a subtree and when to pick it back up that's out of sync with the default implementation used for the sidebar. That's really my only observation - internal consistency with two 'baked in' features.
Here's another screen cap that is better at showing the discrepancy
:
Thanks for your issue. I understand your question. The truth is, at present, when using some kinds of "abnormal" heading, neither the TOC nor the sidebar behave satisfactorily. We may provide a unified and comprehensive solution in a future release.
Thanks for the followup - might be a good place for a PR if I have time to dig in
@Shigma one last question while I have you - are these the two different implementations?:
If you want to optimize TOC grouping behavior, you can modify this method: https://github.com/vuejs/vuepress/blob/ff8df663f2a9b6c7c792c5572dd5bdd186fad9d1/packages/%40vuepress/core/lib/client/components/TOC.vue#L32-L54
And contribution welcome!
Bug report
Version
0.14.10
Steps to reproduce
[[toc]]
component to the pageThis works:
With expected output:
This doesn't (notice
###
preceding 'Underlying' vs##
)With this output highlighting difference between sidebar and TOC
What is expected?
Auto sidebar would index all headers on page (same as TOC)
What is actually happening?
Auto sidebar skips indexing headers if there's a gap in header hierarchy. It will render an h3 contained in an h2, contained in an h1, but will not render an h3 contained in an h1. the
[[toc]]
build-in does not have this problem.Other relevant information