--- icon: git-compare --- # Differences from VitePress The theme intentionally does not aim at a byte-for-byte copy of the VitePress default theme. This page lists the differences by concern, with the reason for each choice, the benefits and the trade-offs. ## Migrating from VitePress The theme borrows the layout and the styles of the VitePress default theme, but it is a VuePress theme, so a VitePress site is ported by moving its config and its content into VuePress instead of switching a package. The [VitePress documentation](https://vitepress.dev/) and the [VuePress guide](https://vuepress.vuejs.org/guide/) describe both sides, and [Migrating from Classic](./migrating-from-classic.md) covers the same kind of mapping for a site that used the former VuePress default theme. ## Class prefix: `vp-` instead of `VP` - **Approach**: All public classes of the ported layer are renamed from `VPFoo` to `vp-foo` (`VPNavBar*` becomes `vp-navbar*`); the root classes are `vp-theme-container` and `vp-not-found`. - **Reason**: The ecosystem requires all CSS classes to use the `vp-` prefix, and the site styles are already written with it. - **Benefits**: Consistent with the ecosystem; no conflict with the classes of third-party VitePress plugins; the component scoped styles keep working, because the selectors are renamed together. - **Trade-off**: VitePress example CSS targeting `.VPLayout`, `.VPButton` etc. does not apply, and custom styles have to be rewritten with the `vp-` names. Diffing against upstream is harder, so the vendored directory is excluded from some lint rules. ## Dark mode: `data-theme` only - **Approach**: The state is written as `data-theme="light|dark"` on `` instead of a `dark` class, and all `.dark` selectors of the ported styles are `[data-theme='dark']`. The storage key is `vuepress-color-scheme` (VitePress uses `vitepress-theme-appearance`). The state is created by `createDarkModeRef()` in `src/client/composables/useDarkMode.ts` (`usePreferredDark()` + `useStorage`, honoring `appearance` as `false` / `'force-dark'` / `'force-auto'` / object form) and provided both to the theme data and to `darkModeSymbol` from `@vuepress/helper/client`, so ecosystem plugins read the same state. `appearance` is written into `` at build time by the `templateBuildRenderer` of `defaultTheme()`, and the inline script of `templates/build.html` sets `data-theme` before the first paint using the storage and the system preference, so `'force-dark'` / `'force-auto'` do not flash the wrong color in a built site; dev mode bypasses the build template, so the first paint is decided by the storage and the system preference. - **Reason**: Ecosystem plugins and styles (`getDarkMode()` from `@vuepress/helper`, search styles, the Shiki light/dark themes) read and observe `document.documentElement.dataset.theme`. - **Benefits**: A single source of truth; the `dark` class and `data-theme` cannot disagree; plugins get the correct dark state automatically. - **Trade-off**: VitePress custom CSS written for `.dark` has to be rewritten with `[data-theme='dark']`, and the upstream dark rules cannot be reused as-is. In dev mode the site-level `appearance` may be inaccurate for the first paint, while the built site has no such issue. ## Search: the theme only provides the mount point - **Approach**: The navbar renders `` when a search plugin has registered that global component. The theme bundles no search implementation. - **Reason**: The VitePress local search UI is tightly coupled with VitePress internals (index format, worker, modal component), while the ecosystem already has several search plugins with i18n and refreshable indexes. - **Benefits**: Any backend can be used (slimsearch, orama, flexsearch, docsearch, meilisearch); the theme stays small; the index format is not maintained twice. - **Trade-off**: The search UI looks different from the VitePress local search, and a new plugin may need an alias for the CSS variables exposed by `styles/vars.css`. ## Copy code: provided by a plugin - **Approach**: `@vuepress/plugin-copy-code` is wired with the selector `[vp-content] ... pre`. - **Reason**: VitePress implements the copy button in its Markdown pre-wrapper, which is core behavior rather than theme behavior; the ecosystem plugin is the official replacement with its own icon, texts and styles. - **Benefits**: The implementation is shared, so the copy feedback, the mobile behavior and the fixes apply to every theme. - **Trade-off**: The button markup and styles come from the plugin; a site that renders content outside the `vp-content` root needs an extra selector. ## Code groups: provided by the Markdown Tab plugin - **Approach**: The theme enables `markdownTabPlugin({ codeTabs: true })`, so code groups use `::: code-tabs` + `@tab`. The plugin parses the markdown, renders the `` component and ships its own `.vp-code-tabs` styles and client-side switching. The theme no longer registers a `code-group` container renderer, and the VitePress `vp-code-group` styles are removed. - **Reason**: The theme does not aim at full VitePress syntax compatibility, it only borrows the layout and the styles of VitePress. When a plugin already covers a feature, the feature is not re-implemented in the theme. - **Benefits**: The plugin is ready to use and ships styles, persisted selection and same-`tab-id` syncing on its own; the theme has no own parsing or switching code; plugin improvements automatically reach the theme. - **Trade-off**: The syntax differs from VitePress (`::: code-group` + `[title]` does not work here, it has to be written as `::: code-tabs` + `@tab`), and the DOM and styles differ from the VitePress theme. - **Recorded plugin improvement**: The VitePress code group uses `` + `