`; the latter outputs `
` and the theme enables the style isolation by default (`isolateStyles: true`, which is an opt-in in `postcss.config` in VitePress). The theme also takes over the clicks of links inside the container, so they do not go through the SPA router, like in VitePress. Disabling `themePlugins.markdownRaw` makes `::: raw` render as plain text.
- **Reason**: Containers are a feature and should come from the official plugins; the styling is aligned by overriding the plugin CSS variables instead of replicating or mapping a set of VitePress container styles in the theme.
- **Benefits**: No container styles or rendering code in the theme; the container icons, the localized default titles and the auto-expanding `` before printing are maintained by the plugin; the appearance matches theme-classic and is only affected by the theme palette; plugin improvements automatically reach the theme.
- **Trade-off (differences from VitePress)**:
- The class names differ: VitePress uses `.custom-block` / `.custom-block-title`, here it is `.hint-container` / `.hint-container-title`; custom styles targeting the VitePress classes have to be rewritten.
- There is an icon before the title (part of the plugin styles), while the VitePress container titles have no icon.
- `::: tip {no-title}` renders a container without title (supported by the plugin, which only reads the marker at the end of the info string; `details` ignores it).
- Additional attributes on the token (such as `id` or an extra `class`) are not passed through to the container.
- The style isolation of `raw` is enabled by the theme by default and needs the site bundler to process the `vp-doc.css` / `base.css` of the theme with PostCSS: a site that customizes `css.postcss` (Vite) or the `postcss-loader` options has to make sure the plugin is merged. Use `themePlugins.markdownRaw: { isolateStyles: false }` to disable the isolation.
- `::: danger` outputs the `caution` type (the title is "Caution"), consistent with the compatibility mapping of theme-classic.
- **Plugin improvements already made**: `@vuepress/plugin-markdown-hint` now supports `{no-title}` and exposes the container spacing and radius as `--hint-container-*` / `--hint-details-*` CSS variables, so the theme aligns the layout with variables only (see plugin PR #1136). The remaining difference is that additional attributes on the token (such as `id` or an extra `class`) are not passed through to the output DOM.
## Active heading: the scroll listener belongs to the plugin
- **Approach**: The theme enables `@vuepress/plugin-active-header-links` with `headerLinkSelector: '.outline-link'`, so the plugin keeps `route.hash` in sync while scrolling. `useActiveAnchor()` of `composables/useActiveAnchor.ts` registers no scroll listener anymore; it only watches `route.hash` to add the `active` class to the matching `.outline-link` and to move the outline marker.
- **Reason**: The theme should only be a thin layout layer; the scroll listener is reusable common logic and the ecosystem already provides it in a plugin.
- **Benefits**: The scroll and hash logic exists only once and matches the other themes of the ecosystem; the theme has less code.
- **Trade-off**: The responsibility boundary has one more hop (the plugin writes the hash, the theme reads it), so debugging involves both sides; the plugin default selector is not `.outline-link`, so it has to be configured explicitly.
## Client API: the native `vuepress/client` API
- **Approach**: The ported layer has no VitePress compatibility layer (the former `src/client/app/*`): the theme composables (`useThemePageData`, `useThemePageFrontmatter`, `usePageRelativePath`, and `useThemeLocaleData` from `@vuepress/plugin-theme-data/client`, ...) read the native data of `vuepress/client` and organize it into the theme data API (`ThemePageData`, `ThemePageFrontmatter`, `ThemeLayout`, ...), whose shape and semantics follow `@vuepress/theme-classic`, with new fields documented separately.
- **Reason**: A compatibility layer adds reactive wrapping and runtime overhead; the user asked for a native implementation with zero performance loss.
- **Benefits**: No intermediate layer and a direct data flow; the theme code matches the other themes of the ecosystem and is easier to maintain.
- **Trade-off**: The internal composables are the theme's own API and have to stay equivalent to the data shape and semantics of `@vuepress/theme-classic`; new or temporarily missing fields are documented in [Config](./config.md) and [Migrating from Classic](./migrating-from-classic.md), so that two parallel conventions do not appear.
- **Interface notes**:
- The theme keeps neither the VitePress data shape nor the VitePress data composables (`useData`, `useRouter`, `useRoute`, ...). Site extensions use the native `vuepress/client` API; the theme's own layout state composable `useLayout()` returns the theme's `ThemeLayout` type for the ported components and for sites that extend the layout.
- VitePress callback payloads such as `nav[].link` and `editLink.pattern` no longer construct `VitePressData`; they receive the native VuePress page data (`page`), whose fields differ (e.g. `filePath` vs `filePathRelative`). Adapt on the site side if a VitePress-compatible payload is needed.
- i18n follows the VuePress model: the site declares languages in the VuePress `locales`, and the route locale is decided by the site `locales`; the theme neither overrides the `themeLocaleDataSymbol` of `@vuepress/plugin-theme-data` nor derives the language from the theme `locales` only. The theme `locales` only decides the theme config and texts of each language, and its keys are mapped to route locale paths at build time (`root` → `/`, others → `//` or the explicit `link`).
## Fonts
- **Approach**: The theme bundles the Inter webfont and keeps the Google Fonts `@import` of the upstream stylesheet.
- **Trade-off**: The external `@import` makes a network request; projects that must build fully offline should remove it.
## Theme options: an independent `ThemeConfig`
- **Approach**: The theme options are the theme's own `ThemeConfig` (`src/shared/types.ts`), containing only the fields the theme actually supports, exported from the package entries and used by `defaultTheme(options: ThemeOptions)` and `useThemeData()`. The nested types (`NavItem`, `Sidebar`, `Hero`, `Feature`, ...) stay in the `DefaultTheme` namespace for the components and the users.
- **Reason**: The VitePress default theme config contains many fields the theme does not implement or need; keeping its type would let users write configurations that pass the type check but do nothing at runtime. The option type should be the documentation, and a wrong field should fail at type-check time.
- **Benefits**: The option surface matches the implementation; VitePress-only fields are rejected by the type checker; the package entries export the full option types, so users get accurate hints while writing the config.
- **Trade-off**: A configuration written for the VitePress default theme cannot reuse the type as-is and has to be rewritten; the theme options do not automatically follow new VitePress fields.
## Layout resolution: a single `Layout` and the `type` field
- **Approach**: The theme registers only `Layout` (capitalized, following the ecosystem convention) and `NotFound`. The page type is decided by the theme's own frontmatter field `type` instead of VitePress' lowercase `layout`: `home` renders the home page, `doc` (default) the document page, `page` a blank page container, and `content` only the page content without the layout shell. `extendsPage` only fills in page data (`filePathRelative`, `routeMeta.title`) and does not rewrite the frontmatter; the components read the type through `usePageType()` (`useLayout().isHome`, `Layout.vue`, `VPContent.vue`). The VuePress `layout` frontmatter is only used as a registered layout name (custom layouts, `NotFound`).
- **Reason**: The user asked to keep only one layout when one is enough, instead of registering three layouts pointing at the same component; the explicit `type` replaces the VitePress compatibility layer and removes fields such as `originalLayout` that only existed for VitePress checks.
- **Benefits**: The layout registry is clean and the theme has a single layout entry; the page type is an explicit API and the component checks no longer depend on the VitePress frontmatter convention; `extendsPage` does not rewrite user data, so the behavior is predictable; custom layouts (e.g. `layout: CommentPage`) are not affected; the `NotFound` handling is decoupled from the home / doc checks.
- **Trade-off**: The page type is a theme-specific field; VitePress `layout: home|doc|page` is treated as a layout name by VuePress (which the theme does not register) and throws `[vuepress] Cannot resolve layout`, while `layout: false` is not a string and falls back to the full layout shell. The page type switching is handled entirely by `VPContent`; `NotFound` still has to be registered as a second layout, because VuePress sets `frontmatter.layout = 'NotFound'` only after `extendsPage` has run, so the theme cannot rewrite it earlier.
## Not ported from VitePress
Two features of the VitePress default theme are intentionally left out:
- **Carbon Ads**: the `carbonAds` option, the `VPCarbonAds` component and the `__CARBON__` build flag are not ported, and there is no equivalent.
- **Built-in search UI**: the local search box, the `@localSearchIndex` module, the search worker and the `search` theme option are not ported. Install one of the search plugins (`@vuepress/plugin-slimsearch`, `@vuepress/plugin-orama`, `@vuepress/plugin-flexsearch`, `@vuepress/plugin-search`, `@vuepress/plugin-meilisearch`, `@vuepress/plugin-docsearch`) instead — the theme mounts the `SearchBox` component they register.