vuepress / ecosystem

Official plugins and themes for VuePress2
https://ecosystem.vuejs.press
MIT License
28 stars 36 forks source link

feat(theme-default): auto sidebar per route and e2e test setup (close… #22

Closed nruffing closed 8 months ago

nruffing commented 8 months ago

Before submitting the PR, please make sure you do the following

What is the purpose of this pull request?

Description

The auto sidebar feature of the default theme is quite useful, especially in cases where the pages are autogenerated documentation from something like TypeDoc.

Currently you can only use the auto feature on all pages or manually specify the sidebar for every page. It would be great if you could turn the feature on per page as well.

This PR also contains the initial setup of the e2e tests for the default theme and a couple e2e tests of this new feature.

Screenshots

Before

After

closes vuepress/core#17 closes vuepress/core#19

Mister-Hope commented 8 months ago

@nruffing I have pushed some changes directly.

I found that some errors are thrown when clicking the auto sidebar. Please resolve it and better to add corresponding e2e testings for clicking them. Thanks!

image

I don't think this is because the code change, see https://github.com/vuepress/ecosystem/issues/27 I belived this could be solved by https://github.com/vuepress/ecosystem/pull/24 naturally once https://github.com/vuepress/core/pull/1447 is merged upstream

meteorlxy commented 8 months ago

I see. Let's release core first

Mister-Hope commented 8 months ago

I would suggest adding the new option as 'heading` instead of 'auto', as it would be great if we can also support 'structure', see https://theme-hope.vuejs.press/guide/layout/sidebar.html#generate-from-file-structure The docs sidebar is using "structure" keyword.

@nruffing

nruffing commented 8 months ago

I would suggest adding the new option as 'heading` instead of 'auto', as it would be great if we can also support 'structure', see https://theme-hope.vuejs.press/guide/layout/sidebar.html#generate-from-file-structure The docs sidebar is using "structure" keyword.

@nruffing

I see. That makes sense. I am going to make that change and reopen this PR.