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

sidebar: auto has a bug #319

Closed
shaodahong opened this issue May 2, 2018 · 5 comments
Closed

sidebar: auto has a bug #319

shaodahong opened this issue May 2, 2018 · 5 comments

Comments

@shaodahong
Copy link
Contributor

shaodahong commented May 2, 2018

I have a markdown file with multiple ## and ###. I added sidebar: auto and found that the sidebar can only display the first md file.

I found vuepress/lib/default-theme/util.js :

if (pageSidebarConfig === 'auto') {
    return resolveHeaders(page)
}

This is wrong. It shouldn't resolve page, should be concat pages.

markdown file:

README.txt

Because github does not support uploading md file, change the suffix

@shaodahong
Copy link
Contributor Author

It is also related this #287

@shaodahong
Copy link
Contributor Author

#320

@ulivz
Copy link
Member

ulivz commented May 2, 2018

It isn't a bug.

If you don't set sidebar: auto, and also don't config themeConfig.sidebar at .vuepress/config.js, the sidebar will not display.

If you set sidebar: auto, the sidebar should only leverage the active page's headers as the sidebar's links. (h1/h2/h3)

If you configured themeConfig.sidebar, the sidebar will automatically displays the page's links according to your settings. the default depth is 1, which extracts the h2 headers (pageTitle/h1/h2). Setting it to 0 disables the header links, and the max value is 2(pageTitle/h1/h2/h3)

@ulivz ulivz closed this as completed May 2, 2018
@shaodahong
Copy link
Contributor Author

shaodahong commented May 2, 2018

I understand. but it is a bug

themeConfig.sidebar:

{
    title: 'test',
    collapsable: false,
    children: [
        '',//readme.md
        'vue',
    ]
}

If i don't set readme.md file sidebar: auto, the sidebar will show two articles (index.html vue.html) that I configured in themeConfig.sidebar

If i set readme.md file sidebar: auto, the sidebar only show one article, i don't know what this idea is, where is the sidebar of vue.html page headers?

@ulivz
Copy link
Member

ulivz commented May 2, 2018

since you said you understand, so why set sidebar: auto here?

sidebar: auto should be used when the folder only has 1 md file.

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