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

[Feature request] New Default Theme for VuePress 2 #121

Open
pengzhanbo opened this issue May 10, 2024 · 7 comments
Open

[Feature request] New Default Theme for VuePress 2 #121

pengzhanbo opened this issue May 10, 2024 · 7 comments
Labels
enhancement New feature or request

Comments

@pengzhanbo
Copy link
Member

pengzhanbo commented May 10, 2024

Clear and concise description of the problem

We are in the process of creating a new default theme for the VuePress 2, which will replace the old default theme, with the old theme being renamed to @vuepress/theme-legacy.

We will list the updated content in this issue, discussing the differences between old and new themes, compatibility solutions, and other updates related to vuepress upstream and downstream.

Features

The new theme will follow the same style as the default theme of VitePress.

Differences

Configuration

  • SiteTtitle and logo: delete home / logo / logoDark / logoAlt, use siteTitle / logo / logoLink instead.

  • Nav:

    • Change the type to NavItem[], children was deprecated, use items instead
    • delete repo, use socialLinks instead
    • delete colorMode / colorModeSwitch, use appearance instead
    • support local nav
  • Sidebar:

    • rename options value auto to structure
    • children was deprecated, use items instead
  • DocFooter: latestUpdated support lastUpdatedFormatOptions

  • Code Block: Use shiki as the default highlighting. support line highlighting, colors diff errors and warning focus

  • containers: support tip / info / warning / danger / important, and github alerts.

Frontmatter

  • Replace layout with pageLayout in VitePress, as layout is already used for other purposes in VuePress.
  • Now you can use the outline to control the display levels of the TOC within the page. etc. [2, 3]

Note

More content will continue to be added during the development period.

Suggested solution

Currently working on vuepress/ecosystem branch:theme-default .

Alternative

No response

Additional context

No response

@Mister-Hope
Copy link
Member

the new theme should support https://theme-hope.vuejs.press/guide/layout/sidebar.html#generate-sidebar-from-file-structure

@pengzhanbo
Copy link
Member Author

the new theme should support theme-hope.vuejs.press/guide/layout/sidebar.html#generate-sidebar-from-file-structure

Implemented in the new theme.

@Mister-Hope
Copy link
Member

Q1

Why is some contents being removed in templateBuild, when darkmode is meant to be enabled, won't the screen flash?

@pengzhanbo
Copy link
Member Author

pengzhanbo commented May 14, 2024

Q1

Why is some contents being removed in templateBuild, when darkmode is meant to be enabled, won't the screen flash?

It does not flicker, when the appearance is set to force-dark, an inline script ;document.documentElement.classList.add('dark') will be inserted into the HTML;

for other values, it will be inserted differently:

;(() => {
  const preference = localStorage.getItem('vuepress-color-scheme') || fallbackPreference
  const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches
  if (!preference || preference === 'auto' ? prefersDark : preference === 'dark')
    document.documentElement.classList.add('dark')
})()

see node/config/resolvePageHead.ts

@Mister-Hope
Copy link
Member

If the default theme is based on CSS, then we can try if we can use lightning CSS.

@pengzhanbo
Copy link
Member Author

pengzhanbo commented May 18, 2024

If the default theme is based on CSS, then we can try if we can use lightning CSS.

While I would like to use lightning CSS, it may cause issues if the theme's users are using other plugins that contain scss.

Copy link

github-actions bot commented Jun 3, 2024

This issue is marked as stale because it has not had recent activity. Issues marked with stale will be closed if they have no activity within 7 days.

@github-actions github-actions bot added the stale label Jun 3, 2024
@pengzhanbo pengzhanbo added enhancement New feature or request and removed stale labels Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants