diff --git a/CHANGELOG.md b/CHANGELOG.md index d53e8de8..e31cdc19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,50 @@ +## [2.0.0-alpha.12](https://github.com/vuejs/vitepress/compare/v2.0.0-alpha.11...v2.0.0-alpha.12) (2025-08-20) + +### Bug Fixes + +- **hmr:** don't load config twice on server restart ([d1a8061](https://github.com/vuejs/vitepress/commit/d1a8061eb438c730ccc62ce2d7158dbe89cc5292)) +- **hmr:** no need for server restart on theme change ([d3a1567](https://github.com/vuejs/vitepress/commit/d3a15673bd0846c7837bcc4ff5a2e3239a02f1f9)) +- **hmr:** hmr not working for snippet imports in dynamic routes ([914467e](https://github.com/vuejs/vitepress/commit/914467e17fb759a9722951a3fd7568eb3bc4d4e6)) +- **theme:** fix local nav alignment and increase touch area ([43b36c0](https://github.com/vuejs/vitepress/commit/43b36c0c19c2b4696f8c38fdaf4318786ea7ae8e)) +- **theme:** nav background doesn't extend fully and gap after sidebar with non-overlay scrollbars ([7df3052](https://github.com/vuejs/vitepress/commit/7df30525121a28a46cc6c802f3155ccff8effaca)), closes [#4653](https://github.com/vuejs/vitepress/issues/4653) +- **theme:** use clipboard-check instead of clipboard-copy for code copied icon ([1c8815d](https://github.com/vuejs/vitepress/commit/1c8815d53ed2d56b07938260df6566f1514f4bfc)) + +### Features + +- add markdown-it-cjk-friendly ([9fc8462](https://github.com/vuejs/vitepress/commit/9fc8462726ccf1cdb78b6171c9f1f5964e79ca22)), closes [#3762](https://github.com/vuejs/vitepress/issues/3762) [#4752](https://github.com/vuejs/vitepress/issues/4752) +- make postcssIsolateStyles idempotent ([0944777](https://github.com/vuejs/vitepress/commit/094477789328b80cff45cd973efa16b6a4db0a27)) + +### BREAKING CHANGES + +- [markdown-it-cjk-friendly](https://www.npmjs.com/package/markdown-it-cjk-friendly) is enabled by default. This intentionally deviates from the official commonmark spec for the benefit of CJK users. **For most users, no change is required.** If you were using hacks to patch `scanDelims`, you can remove those. To disable the plugin, set `markdown: { cjkFriendly: false }` in your vitepress config. +- `includeFiles` option in `postcssIsolateStyles` now defaults to `[/vp-doc\.css/, /base\.css/]`. You can remove explicit `includeFiles` if you were using it just to run it on `vp-doc.css`. To revert back to older behavior pass `includeFiles: [/base\.css/]`. The underlying implementation is changed and `transform` and `exclude` options are no longer supported. Use `postcss-prefix-selector` directly if you've advanced use cases. + +## [2.0.0-alpha.11](https://github.com/vuejs/vitepress/compare/v2.0.0-alpha.10...v2.0.0-alpha.11) (2025-08-14) + +### Bug Fixes + +- hmr working only once for markdown files ([8d8a5ac](https://github.com/vuejs/vitepress/commit/8d8a5ac281f090cd097bece792d9dd3ef00e5545)), closes [#4909](https://github.com/vuejs/vitepress/issues/4909) +- html entities encoded twice in toc plugin ([8abbe29](https://github.com/vuejs/vitepress/commit/8abbe298d545de17d34a9bc1eb72af4c5a4b41b8)), closes [#4908](https://github.com/vuejs/vitepress/issues/4908) + +## [2.0.0-alpha.10](https://github.com/vuejs/vitepress/compare/v2.0.0-alpha.9...v2.0.0-alpha.10) (2025-08-11) + +### Bug Fixes + +- **client:** base not stripped from relativePath in 404 pages ([b840877](https://github.com/vuejs/vitepress/commit/b840877aa83a5a24ffc1222e8a5a3dbf3e5105e8)), closes [#4850](https://github.com/vuejs/vitepress/issues/4850) +- hmr of style blocks in dynamic routes ([#4903](https://github.com/vuejs/vitepress/issues/4903)) ([3d0fafb](https://github.com/vuejs/vitepress/commit/3d0fafba545f4b5028cf43d86027dd44dab14421)) +- make paths in `watchedFiles` absolute as mentioned in the docs ([318c14f](https://github.com/vuejs/vitepress/commit/318c14fa7c9fb949d74b7d9fae416e917766cf05)) +- module graph causing unnecessary route regeneration on every update ([fc267ae](https://github.com/vuejs/vitepress/commit/fc267ae6b787e163d41666e090089821377ead43)) +- preserve externally added dynamic routes and pages ([fc267ae](https://github.com/vuejs/vitepress/commit/fc267ae6b787e163d41666e090089821377ead43)) +- **search:** input placeholder being cut off in smaller viewports ([162c6a6](https://github.com/vuejs/vitepress/commit/162c6a69bf56945daa20d126aa034c59ee0c8a2e)) +- **search:** style tweaks for when searches are empty ([8b23217](https://github.com/vuejs/vitepress/commit/8b232171cc321bd3dc86b4357622815269f0b6f4)) +- **types:** externalize markdown-it types ([5bf835b](https://github.com/vuejs/vitepress/commit/5bf835b5074e9567852d552bfb5115c6456026e8)) +- **types:** pass generics deeply to user config ([777e2ca](https://github.com/vuejs/vitepress/commit/777e2caaacd93ce41b046f6c9d5ba80cc43ba37c)) + +### Features + +- add source param to the deadlink check fn ([#4870](https://github.com/vuejs/vitepress/issues/4870)) ([8c027c2](https://github.com/vuejs/vitepress/commit/8c027c2a7c443074fd0d4890f7736b444f9254aa)) +- **theme:** add `rel="me"` to social links by default ([#4873](https://github.com/vuejs/vitepress/issues/4873)) ([34886c6](https://github.com/vuejs/vitepress/commit/34886c667d1305a79d64c957f8c52931ea122f47)) + ## [2.0.0-alpha.9](https://github.com/vuejs/vitepress/compare/v2.0.0-alpha.8...v2.0.0-alpha.9) (2025-07-26) ### Bug Fixes diff --git a/__tests__/unit/node/postcss/__snapshots__/isolateStyles.test.ts.snap b/__tests__/unit/node/postcss/__snapshots__/isolateStyles.test.ts.snap new file mode 100644 index 00000000..c781b64c --- /dev/null +++ b/__tests__/unit/node/postcss/__snapshots__/isolateStyles.test.ts.snap @@ -0,0 +1,77 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`node/postcss/isolateStyles > transforms selectors and skips keyframes 1`] = ` +" +/* simple classes */ +.example:not(:where(.vp-raw, .vp-raw *)) { color: red; } +.class-a:not(:where(.vp-raw, .vp-raw *)) { color: coral; } +.class-b:not(:where(.vp-raw, .vp-raw *)) { color: deepskyblue; } + +/* escaped colon in class */ +.baz\\:not\\(.bar\\):not(:where(.vp-raw, .vp-raw *)) { display: block; } +.disabled\\:opacity-50:not(:where(.vp-raw, .vp-raw *)):disabled { opacity: .5; } + +/* pseudos (class + element) */ +.button:not(:where(.vp-raw, .vp-raw *)):hover { color: pink; } +.button:not(:where(.vp-raw, .vp-raw *)):focus:hover { color: hotpink; } +.item:not(:where(.vp-raw, .vp-raw *))::before { content: '•'; } +:not(:where(.vp-raw, .vp-raw *))::first-letter { color: pink; } +:not(:where(.vp-raw, .vp-raw *))::before { content: ''; } + +/* universal + :not */ +*:not(:where(.vp-raw, .vp-raw *)) { background-color: red; } +*:not(:where(.vp-raw, .vp-raw *)):not(.b) { text-transform: uppercase; } + +/* combinators */ +.foo:hover .bar:not(:where(.vp-raw, .vp-raw *)) { background: blue; } +ul > li.active:not(:where(.vp-raw, .vp-raw *)) { color: green; } +a + b ~ c:not(:where(.vp-raw, .vp-raw *)) { color: orange; } + +/* ids + attribute selectors */ +#wow:not(:where(.vp-raw, .vp-raw *)) { color: yellow; } +[data-world] .d:not(:where(.vp-raw, .vp-raw *)) { padding: 10px 20px; } + +/* :root and chained tags */ +:not(:where(.vp-raw, .vp-raw *)):root { --bs-blue: #0d6efd; } +:root .a:not(:where(.vp-raw, .vp-raw *)) { --bs-green: #bada55; } +html:not(:where(.vp-raw, .vp-raw *)) { margin: 0; } +body:not(:where(.vp-raw, .vp-raw *)) { padding: 0; } +html body div:not(:where(.vp-raw, .vp-raw *)) { color: blue; } + +/* grouping with commas */ +.a:not(:where(.vp-raw, .vp-raw *)), .b:not(:where(.vp-raw, .vp-raw *)) { color: red; } + +/* multiple repeated groups to ensure stability */ +.a:not(:where(.vp-raw, .vp-raw *)), .b:not(:where(.vp-raw, .vp-raw *)) { color: coral; } +.a:not(:where(.vp-raw, .vp-raw *)) { animation: glow 1s linear infinite alternate; } + +/* nested blocks */ +.foo:not(:where(.vp-raw, .vp-raw *)) { + svg:not(:where(.vp-raw, .vp-raw *)) { display: none; } + .bar:not(:where(.vp-raw, .vp-raw *)) { display: inline; } +} + +/* standalone pseudos */ +:not(:where(.vp-raw, .vp-raw *)):first-child { color: pink; } +:not(:where(.vp-raw, .vp-raw *)):hover { color: blue; } +:not(:where(.vp-raw, .vp-raw *)):active { color: red; } + +/* keyframes (should be ignored) */ +@keyframes fade { + from { opacity: 0; } + to { opacity: 1; } +} +@-webkit-keyframes glow { + from { color: coral; } + to { color: red; } +} +@-moz-keyframes glow { + from { color: coral; } + to { color: red; } +} +@-o-keyframes glow { + from { color: coral; } + to { color: red; } +} +" +`; diff --git a/__tests__/unit/node/postcss/isolateStyles.test.ts b/__tests__/unit/node/postcss/isolateStyles.test.ts index 8f42eb4a..609a4463 100644 --- a/__tests__/unit/node/postcss/isolateStyles.test.ts +++ b/__tests__/unit/node/postcss/isolateStyles.test.ts @@ -1,44 +1,93 @@ -import { - postcssIsolateStyles, - splitSelectorPseudo -} from 'node/postcss/isolateStyles' - -// helper to run plugin transform on selector -function apply( - prefixPlugin: ReturnType, - selector: string -) { - // `prepare` is available on the runtime plugin but missing from the types, thus cast to `any` - const { Rule } = (prefixPlugin as any).prepare({ - root: { source: { input: { file: 'foo/base.css' } } } - }) - const rule = { selectors: [selector] } - Rule(rule, { result: {} }) - return rule.selectors[0] +import { postcssIsolateStyles } from 'node/postcss/isolateStyles' +import postcss from 'postcss' + +const INPUT_CSS = ` +/* simple classes */ +.example { color: red; } +.class-a { color: coral; } +.class-b { color: deepskyblue; } + +/* escaped colon in class */ +.baz\\:not\\(.bar\\) { display: block; } +.disabled\\:opacity-50:disabled { opacity: .5; } + +/* pseudos (class + element) */ +.button:hover { color: pink; } +.button:focus:hover { color: hotpink; } +.item::before { content: '•'; } +::first-letter { color: pink; } +::before { content: ''; } + +/* universal + :not */ +* { background-color: red; } +*:not(.b) { text-transform: uppercase; } + +/* combinators */ +.foo:hover .bar { background: blue; } +ul > li.active { color: green; } +a + b ~ c { color: orange; } + +/* ids + attribute selectors */ +#wow { color: yellow; } +[data-world] .d { padding: 10px 20px; } + +/* :root and chained tags */ +:root { --bs-blue: #0d6efd; } +:root .a { --bs-green: #bada55; } +html { margin: 0; } +body { padding: 0; } +html body div { color: blue; } + +/* grouping with commas */ +.a, .b { color: red; } + +/* multiple repeated groups to ensure stability */ +.a, .b { color: coral; } +.a { animation: glow 1s linear infinite alternate; } + +/* nested blocks */ +.foo { + svg { display: none; } + .bar { display: inline; } } -describe('node/postcss/isolateStyles', () => { - const plugin = postcssIsolateStyles() +/* standalone pseudos */ +:first-child { color: pink; } +:hover { color: blue; } +:active { color: red; } - test('splitSelectorPseudo skips escaped colon', () => { - const input = '.foo\\:bar' - const [selector, pseudo] = splitSelectorPseudo(input) - expect(selector).toBe(input) - expect(pseudo).toBe('') - }) +/* keyframes (should be ignored) */ +@keyframes fade { + from { opacity: 0; } + to { opacity: 1; } +} +@-webkit-keyframes glow { + from { color: coral; } + to { color: red; } +} +@-moz-keyframes glow { + from { color: coral; } + to { color: red; } +} +@-o-keyframes glow { + from { color: coral; } + to { color: red; } +} +` - test('splitSelectorPseudo splits on pseudo selectors', () => { - const input = '.button:hover' - const [selector, pseudo] = splitSelectorPseudo(input) - expect(selector).toBe('.button') - expect(pseudo).toBe(':hover') +describe('node/postcss/isolateStyles', () => { + test('transforms selectors and skips keyframes', () => { + const out = run(INPUT_CSS) + expect(out.css).toMatchSnapshot() }) - it('postcssIsolateStyles inserts :not(...) in the right place', () => { - const input = '.disabled\\:opacity-50:disabled' - const result = apply(plugin, input) - expect(result).toBe( - '.disabled\\:opacity-50:not(:where(.vp-raw, .vp-raw *)):disabled' - ) + test('idempotent (running twice produces identical CSS)', () => { + const first = run(INPUT_CSS).css + const second = run(first).css + expect(second).toBe(first) }) }) + +function run(css: string, from = 'src/styles/vp-doc.css') { + return postcss([postcssIsolateStyles()]).process(css, { from }) +} diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 8ef544e6..adaf4daa 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -124,13 +124,13 @@ export default defineConfig({ }, locales: { - root: { label: 'English' }, - zh: { label: '简体中文' }, - pt: { label: 'Português' }, - ru: { label: 'Русский' }, - es: { label: 'Español' }, - ko: { label: '한국어' }, - fa: { label: 'فارسی' } + root: { label: 'English', lang: 'en-US', dir: 'ltr' }, + zh: { label: '简体中文', lang: 'zh-Hans', dir: 'ltr' }, + pt: { label: 'Português', lang: 'pt-BR', dir: 'ltr' }, + ru: { label: 'Русский', lang: 'ru-RU', dir: 'ltr' }, + es: { label: 'Español', lang: 'es', dir: 'ltr' }, + ko: { label: '한국어', lang: 'ko-KR', dir: 'ltr' }, + fa: { label: 'فارسی', lang: 'fa-IR', dir: 'rtl' } }, vite: { diff --git a/docs/config.ts b/docs/config.ts index a09a3a67..a1669b76 100644 --- a/docs/config.ts +++ b/docs/config.ts @@ -5,7 +5,6 @@ const require = createRequire(import.meta.url) const pkg = require('vitepress/package.json') export default defineAdditionalConfig({ - lang: 'en-US', description: 'Vite & Vue powered static site generator.', themeConfig: { diff --git a/docs/en/guide/getting-started.md b/docs/en/guide/getting-started.md index 6382b204..79cb3180 100644 --- a/docs/en/guide/getting-started.md +++ b/docs/en/guide/getting-started.md @@ -18,23 +18,19 @@ VitePress can be used on its own, or be installed into an existing project. In b ::: code-group ```sh [npm] -$ npm add -D vitepress +$ npm add -D vitepress@next ``` ```sh [pnpm] -$ pnpm add -D vitepress +$ pnpm add -D vitepress@next ``` ```sh [yarn] -$ yarn add -D vitepress -``` - -```sh [yarn (pnp)] -$ yarn add -D vitepress vue +$ yarn add -D vitepress@next vue ``` ```sh [bun] -$ bun add -D vitepress +$ bun add -D vitepress@next ``` ::: diff --git a/docs/en/guide/markdown.md b/docs/en/guide/markdown.md index 89d826d5..c3342474 100644 --- a/docs/en/guide/markdown.md +++ b/docs/en/guide/markdown.md @@ -277,11 +277,11 @@ Wraps in a `
` } ``` - It uses [`postcss-prefix-selector`](https://github.com/RadValentin/postcss-prefix-selector) under the hood. You can pass its options like this: + You can pass its options like this: ```js postcssIsolateStyles({ - includeFiles: [/vp-doc\.css/] // defaults to /base\.css/ + includeFiles: [/custom\.css/] // defaults to [/vp-doc\.css/, /base\.css/] }) ``` diff --git a/docs/en/guide/what-is-vitepress.md b/docs/en/guide/what-is-vitepress.md index 3827cc44..3407c76d 100644 --- a/docs/en/guide/what-is-vitepress.md +++ b/docs/en/guide/what-is-vitepress.md @@ -50,8 +50,8 @@ Unlike many traditional SSGs where each navigation results in a full page reload ## What About VuePress? -VitePress is the spiritual successor of VuePress. The original VuePress was based on Vue 2 and webpack. With Vue 3 and Vite under the hood, VitePress provides significantly better DX, better production performance, a more polished default theme, and a more flexible customization API. +VitePress is the spiritual successor of VuePress 1. The original VuePress 1 was based on Vue 2 and webpack. With Vue 3 and Vite under the hood, VitePress provides significantly better DX, better production performance, a more polished default theme, and a more flexible customization API. -The API difference between VitePress and VuePress mostly lies in theming and customization. If you are using VuePress 1 with the default theme, it should be relatively straightforward to migrate to VitePress. +The API difference between VitePress and VuePress 1 mostly lies in theming and customization. If you are using VuePress 1 with the default theme, it should be relatively straightforward to migrate to VitePress. -There has also been effort invested into VuePress 2, which also supports Vue 3 and Vite with more compatibility with VuePress 1. However, maintaining two SSGs in parallel isn't sustainable, so the Vue team has decided to focus on VitePress as the main recommended SSG in the long run. +Maintaining two SSGs in parallel isn't sustainable, so the Vue team has decided to focus on VitePress as the main recommended SSG in the long run. Now VuePress 1 has been deprecated, and VuePress 2 has been handed over to the VuePress community team for further development and maintenance. diff --git a/docs/en/reference/site-config.md b/docs/en/reference/site-config.md index 6795cfc8..c24a7bae 100644 --- a/docs/en/reference/site-config.md +++ b/docs/en/reference/site-config.md @@ -24,7 +24,7 @@ export default { } ``` -:::details Dynamic (Async) Config +::: details Dynamic (Async) Config If you need to dynamically generate the config, you can also default export a function. For example: diff --git a/docs/es/config.ts b/docs/es/config.ts index 572a83d3..a7a4618a 100644 --- a/docs/es/config.ts +++ b/docs/es/config.ts @@ -5,7 +5,6 @@ const require = createRequire(import.meta.url) const pkg = require('vitepress/package.json') export default defineAdditionalConfig({ - lang: 'es-CO', description: 'Generador de Sitios Estáticos desarrollado con Vite y Vue.', themeConfig: { @@ -25,7 +24,7 @@ export default defineAdditionalConfig({ footer: { message: 'Liberado bajo la licencia MIT', - copyright: `Derechos reservados © 2019-${new Date().getFullYear()} Evan You` + copyright: 'Todos los derechos reservados © 2019-PRESENTE Evan You' }, docFooter: { diff --git a/docs/es/guide/getting-started.md b/docs/es/guide/getting-started.md index 994ea889..056071d5 100644 --- a/docs/es/guide/getting-started.md +++ b/docs/es/guide/getting-started.md @@ -18,19 +18,19 @@ VitePress puede ser usado solo, o ser instalado en un proyecto ya existente. En ::: code-group ```sh [npm] -$ npm add -D vitepress +$ npm add -D vitepress@next ``` ```sh [pnpm] -$ pnpm add -D vitepress +$ pnpm add -D vitepress@next ``` ```sh [yarn] -$ yarn add -D vitepress +$ yarn add -D vitepress@next ``` ```sh [bun] -$ bun add -D vitepress +$ bun add -D vitepress@next ``` ::: diff --git a/docs/es/guide/markdown.md b/docs/es/guide/markdown.md index dda0de79..ebbd0d5e 100644 --- a/docs/es/guide/markdown.md +++ b/docs/es/guide/markdown.md @@ -256,11 +256,11 @@ La clase `vp-raw` también puede ser usada directamente en elementos. El aislami } ``` - El utiliza [`postcss-prefix-selector`](https://github.com/RadValentin/postcss-prefix-selector) internamente. Puede pasar opciones así: + Puede pasar opciones así: ```js postcssIsolateStyles({ - includeFiles: [/vp-doc\.css/] // o padrão é /base\.css/ + includeFiles: [/custom\.css/] // o padrão é [/vp-doc\.css/, /base\.css/] }) ``` diff --git a/docs/es/reference/site-config.md b/docs/es/reference/site-config.md index aa4e9af2..d7daa924 100644 --- a/docs/es/reference/site-config.md +++ b/docs/es/reference/site-config.md @@ -24,7 +24,7 @@ export default { } ``` -:::details Configuración dinámica (Assíncrona) +::: details Configuración dinámica (Assíncrona) Si necesitas generar dinamicamente la configuración, también puedes exportar por defecto una función. Por ejemplo: @@ -594,7 +594,7 @@ export default { `transformHead` es un enlace de compilación para transformar el encabezado antes de generar cada página. Esto le permite agregar entradas de encabezado que no se pueden agregar estáticamente a la configuración de VitePress. Sólo necesita devolver entradas adicionales, que se fusionarán automáticamente con las existentes. -:::warning +::: warning No mutes ningún elemento dentro `context`. ::: @@ -662,7 +662,7 @@ export default { - Tipo: `(code: string, id: string, context: TransformContext) => Awaitable` `transformHtml` es un gancho de compilación para transformar el contenido de cada página antes de guardarla en el disco. -:::warning +::: warning No mute ningún elemento dentro del `context`. Además, modificar el contenido HTML puede provocar problemas de hidratación en tiempo de ejecución. ::: @@ -679,7 +679,7 @@ export default { `transformPageData` es un gancho para transformar los datos de cada página. Puedes hacer mutaciones directamente en `pageData` o devolver valores modificados que se fusionarán con los datos de la página. -:::warning +::: warning No mute ningún elemento dentro del `context` y tenga cuidado ya que esto puede afectar el rendimiento del servidor de desarrollo, especialmente si tiene algunas solicitudes de red o cálculos pesados (como generar imágenes) en el gancho. Puede consultar `process.env.NODE_ENV === 'production'` para ver la lógica condicional. ::: diff --git a/docs/fa/config.ts b/docs/fa/config.ts index d2041bbf..5b3ff395 100644 --- a/docs/fa/config.ts +++ b/docs/fa/config.ts @@ -5,9 +5,7 @@ const require = createRequire(import.meta.url) const pkg = require('vitepress/package.json') export default defineAdditionalConfig({ - lang: 'fa-IR', description: 'ژنراتور استاتیک وب‌سایت با Vite و Vue', - dir: 'rtl', // prettier-ignore head: [ diff --git a/docs/fa/guide/getting-started.md b/docs/fa/guide/getting-started.md index a1d497b9..394c5ecb 100644 --- a/docs/fa/guide/getting-started.md +++ b/docs/fa/guide/getting-started.md @@ -18,23 +18,19 @@ ::: code-group ```sh [npm] -$ npm add -D vitepress +$ npm add -D vitepress@next ``` ```sh [pnpm] -$ pnpm add -D vitepress +$ pnpm add -D vitepress@next ``` ```sh [yarn] -$ yarn add -D vitepress -``` - -```sh [yarn (pnp)] -$ yarn add -D vitepress vue +$ yarn add -D vitepress@next vue ``` ```sh [bun] -$ bun add -D vitepress +$ bun add -D vitepress@next ``` ::: diff --git a/docs/fa/guide/markdown.md b/docs/fa/guide/markdown.md index 91db2dc7..4e17bd31 100644 --- a/docs/fa/guide/markdown.md +++ b/docs/fa/guide/markdown.md @@ -255,11 +255,11 @@ export default defineConfig({ } ``` - این از [`postcss-prefix-selector`](https://github.com/RadValentin/postcss-prefix-selector) استفاده می‌کند. می‌توانید گزینه‌های آن را به این صورت پاس بدهید: + می‌توانید گزینه‌های آن را به این صورت پاس بدهید: ```js postcssIsolateStyles({ - includeFiles: [/vp-doc\.css/] // به طور پیش‌فرض /base\.css/ + includeFiles: [/custom\.css/] // به طور پیش‌فرض [/vp-doc\.css/, /base\.css/] }) ``` diff --git a/docs/fa/reference/site-config.md b/docs/fa/reference/site-config.md index 5a12875d..d3e0ebac 100644 --- a/docs/fa/reference/site-config.md +++ b/docs/fa/reference/site-config.md @@ -24,7 +24,7 @@ export default { } ``` -:::details تنظیمات پویا (غیرهمزمان) +::: details تنظیمات پویا (غیرهمزمان) اگر نیاز دارید به طور پویا تنظیمات را تولید کنید، می‌توانید یک تابع صادر کنید. به عنوان مثال: @@ -354,7 +354,7 @@ export default { وقتی تنظیم شود به `true`، ویت‌پرس `.html` انتهایی را از URL ها حذف می‌کند. همچنین ببینید [تولید URL تمیز](../guide/routing#generating-clean-url). -::: هشدار نیاز به پشتیبانی سرور +::: warning هشدار نیاز به پشتیبانی سرور فعال کردن این ممکن است نیاز به پیکربندی اضافی در پلتفرم میزبان شما داشته باشد. برای اینکه کار کند، سرور شما باید بتواند `/foo.html` را زمانی که `/foo` بازدید می‌شود **بدون ریدایرکت** سرو کند. ::: diff --git a/docs/ko/config.ts b/docs/ko/config.ts index 7f9f73f5..a9e40dd6 100644 --- a/docs/ko/config.ts +++ b/docs/ko/config.ts @@ -5,7 +5,6 @@ const require = createRequire(import.meta.url) const pkg = require('vitepress/package.json') export default defineAdditionalConfig({ - lang: 'ko-KR', description: 'Vite 및 Vue 기반 정적 사이트 생성기.', themeConfig: { diff --git a/docs/ko/guide/getting-started.md b/docs/ko/guide/getting-started.md index 912618a1..632e9078 100644 --- a/docs/ko/guide/getting-started.md +++ b/docs/ko/guide/getting-started.md @@ -19,23 +19,19 @@ VitePress는 단독으로 사용하거나 기존 프로젝트에 설치할 수 ::: code-group ```sh [npm] -$ npm add -D vitepress +$ npm add -D vitepress@next ``` ```sh [pnpm] -$ pnpm add -D vitepress +$ pnpm add -D vitepress@next ``` ```sh [yarn] -$ yarn add -D vitepress -``` - -```sh [yarn (pnp)] -$ yarn add -D vitepress vue +$ yarn add -D vitepress@next vue ``` ```sh [bun] -$ bun add -D vitepress +$ bun add -D vitepress@next ``` ::: diff --git a/docs/ko/guide/markdown.md b/docs/ko/guide/markdown.md index 5f03bbf6..f2003ca6 100644 --- a/docs/ko/guide/markdown.md +++ b/docs/ko/guide/markdown.md @@ -255,11 +255,11 @@ export default defineConfig({ } ``` - 이것은 기본적으로 [`postcss-prefix-selector`](https://github.com/RadValentin/postcss-prefix-selector)를 사용합니다. 다음과 같이 옵션을 전달할 수 있습니다: + 다음과 같이 옵션을 전달할 수 있습니다: ```js postcssIsolateStyles({ - includeFiles: [/vp-doc\.css/] // 기본값은 /base\.css/ + includeFiles: [/custom\.css/] // 기본값은 [/vp-doc\.css/, /base\.css/] }) ``` diff --git a/docs/package.json b/docs/package.json index 2a6b7aa8..f0aa0873 100644 --- a/docs/package.json +++ b/docs/package.json @@ -15,7 +15,7 @@ "open-cli": "^8.0.0", "postcss-rtlcss": "^5.7.1", "vitepress": "workspace:*", - "vitepress-plugin-group-icons": "^1.6.1", - "vitepress-plugin-llms": "^1.7.1" + "vitepress-plugin-group-icons": "^1.6.3", + "vitepress-plugin-llms": "^1.7.3" } } diff --git a/docs/pt/config.ts b/docs/pt/config.ts index f2e5eff1..e1b55278 100644 --- a/docs/pt/config.ts +++ b/docs/pt/config.ts @@ -5,7 +5,6 @@ const require = createRequire(import.meta.url) const pkg = require('vitepress/package.json') export default defineAdditionalConfig({ - lang: 'pt-BR', description: 'Gerador de Site Estático desenvolvido com Vite e Vue.', themeConfig: { diff --git a/docs/pt/guide/getting-started.md b/docs/pt/guide/getting-started.md index ea40c6e2..c0dba3a9 100644 --- a/docs/pt/guide/getting-started.md +++ b/docs/pt/guide/getting-started.md @@ -18,23 +18,19 @@ VitePress pode ser usado sozinho, ou ser instalado em um projeto já existente. ::: code-group ```sh [npm] -$ npm add -D vitepress +$ npm add -D vitepress@next ``` ```sh [pnpm] -$ pnpm add -D vitepress +$ pnpm add -D vitepress@next ``` ```sh [yarn] -$ yarn add -D vitepress -``` - -```sh [yarn (pnp)] -$ yarn add -D vitepress vue +$ yarn add -D vitepress@next vue ``` ```sh [bun] -$ bun add -D vitepress +$ bun add -D vitepress@next ``` ::: diff --git a/docs/pt/guide/markdown.md b/docs/pt/guide/markdown.md index 766dc9ea..c4186270 100644 --- a/docs/pt/guide/markdown.md +++ b/docs/pt/guide/markdown.md @@ -255,11 +255,11 @@ A classe `vp-raw` também pode ser usada diretamente em elementos. O isolamento } ``` - Ele utiliza [`postcss-prefix-selector`](https://github.com/RadValentin/postcss-prefix-selector) internamente. Você pode passar opções assim: + Você pode passar opções assim: ```js postcssIsolateStyles({ - includeFiles: [/vp-doc\.css/] // o padrão é /base\.css/ + includeFiles: [/custom\.css/] // o padrão é [/vp-doc\.css/, /base\.css/] }) ``` diff --git a/docs/pt/reference/site-config.md b/docs/pt/reference/site-config.md index d013f931..66281311 100644 --- a/docs/pt/reference/site-config.md +++ b/docs/pt/reference/site-config.md @@ -24,7 +24,7 @@ export default { } ``` -:::details Configuração Dinâmica (Assíncrona) +::: details Configuração Dinâmica (Assíncrona) Se você precisar gerar dinamicamente a configuração, também pode exportar por padrão uma função. Por exemplo: @@ -594,7 +594,7 @@ export default { `transformHead` é um gancho de compilação para transformar o cabeçalho antes de gerar cada página. Isso permite adicionar entradas no cabeçalho que não podem ser adicionadas estaticamente à configuração VitePress. Você só precisa retornar entradas extras, que serão mescladas automaticamente com as existentes. -:::warning +::: warning Não faça mutações em qualquer item dentro de `context`. ::: @@ -662,7 +662,7 @@ export default { - Tipo: `(code: string, id: string, context: TransformContext) => Awaitable` `transformHtml` é um gancho de compilação para transformar o conteúdo de cada página antes de salvá-lo no disco. -:::warning +::: warning Não faça mutações em qualquer item dentro de `context`. Além disso, modificar o conteúdo HTML pode causar problemas de hidratação em tempo de execução. ::: @@ -679,7 +679,7 @@ export default { `transformPageData` é um gancho para transformar os dados de cada página. Você pode fazer mutações diretamente em `pageData` ou retornar valores alterados que serão mesclados nos dados da página. -:::warning +::: warning Não faça mutações em qualquer item dentro de `context` e tenha cuidado pois isso pode impactar no desempenho do servidor de desenvolvimento, especialmente se você tiver algumas solicitações de rede ou computações pesadas (como gerar imagens) no gancho. Você pode verificar `process.env.NODE_ENV === 'production'` para lógica condicional. ::: diff --git a/docs/ru/config.ts b/docs/ru/config.ts index 2cd7695c..12364145 100644 --- a/docs/ru/config.ts +++ b/docs/ru/config.ts @@ -5,7 +5,6 @@ const require = createRequire(import.meta.url) const pkg = require('vitepress/package.json') export default defineAdditionalConfig({ - lang: 'ru-RU', description: 'Генератор статических сайтов на основе Vite и Vue.', themeConfig: { diff --git a/docs/ru/guide/getting-started.md b/docs/ru/guide/getting-started.md index 8dd2d440..4ca5ff8c 100644 --- a/docs/ru/guide/getting-started.md +++ b/docs/ru/guide/getting-started.md @@ -18,23 +18,19 @@ VitePress можно использовать самостоятельно ил ::: code-group ```sh [npm] -$ npm add -D vitepress +$ npm add -D vitepress@next ``` ```sh [pnpm] -$ pnpm add -D vitepress +$ pnpm add -D vitepress@next ``` ```sh [yarn] -$ yarn add -D vitepress -``` - -```sh [yarn (pnp)] -$ yarn add -D vitepress vue +$ yarn add -D vitepress@next vue ``` ```sh [bun] -$ bun add -D vitepress +$ bun add -D vitepress@next ``` ::: diff --git a/docs/ru/guide/markdown.md b/docs/ru/guide/markdown.md index a0738273..2bd1a5c1 100644 --- a/docs/ru/guide/markdown.md +++ b/docs/ru/guide/markdown.md @@ -281,11 +281,11 @@ console.log('Привет, VitePress!') } ``` - Он использует [`postcss-prefix-selector`](https://github.com/RadValentin/postcss-prefix-selector) под капотом. Вы можете передать ему параметры следующим образом: + Вы можете передать ему параметры следующим образом: ```js postcssIsolateStyles({ - includeFiles: [/vp-doc\.css/] // по умолчанию /base\.css/ + includeFiles: [/custom\.css/] // по умолчанию [/vp-doc\.css/, /base\.css/] }) ``` diff --git a/docs/ru/guide/what-is-vitepress.md b/docs/ru/guide/what-is-vitepress.md index eb683940..715ecc89 100644 --- a/docs/ru/guide/what-is-vitepress.md +++ b/docs/ru/guide/what-is-vitepress.md @@ -1,6 +1,6 @@ # Что такое VitePress? {#what-is-vitepress} -VitePress — это [Генератор статических сайтов](https://en.wikipedia.org/wiki/Static_site_generator) (ГСС), предназначенный для быстрого создания сайтов, ориентированных на контент. В двух словах, VitePress берёт ваш исходный контент, написанный в [Markdown](https://ru.wikipedia.org/wiki/Markdown), применяет к нему тему и генерирует статические HTML-страницы, которые можно легко развернуть в любом месте. +VitePress — это [Генератор статических сайтов](https://en.wikipedia.org/wiki/Static_site_generator) (ГСС), предназначенный для быстрого создания сайтов, ориентированных на контент. В двух словах, VitePress берёт ваш исходный контент, написанный на [Markdown](https://ru.wikipedia.org/wiki/Markdown), применяет к нему тему и генерирует статические HTML-страницы, которые можно легко развернуть в любом месте.
@@ -50,8 +50,8 @@ VitePress стремится обеспечить отличные возмож ## Что насчёт VuePress? {#what-about-vuepress} -VitePress — это духовный наследник VuePress. Оригинальный VuePress был основан на Vue 2 и webpack. Благодаря Vue 3 и Vite под капотом, VitePress обеспечивает значительно лучший опыт разработки, лучшую производительность, более отточенную тему по умолчанию и более гибкий API для настройки. +VitePress — это духовный преемник VuePress 1. Оригинальный VuePress 1 был основан на Vue 2 и webpack. С Vue 3 и Vite под капотом VitePress обеспечивает значительно лучший опыт разработки (DX), лучшую производительность в продакшене, более отточенную стандартную тему и более гибкий API для кастомизации. -Разница в API между VitePress и VuePress заключается в основном в тематическом оформлении и настройке. Если вы используете VuePress 1 с темой по умолчанию, то переход на VitePress будет относительно простым. +Различия в API между VitePress и VuePress 1 в основном касаются тем и кастомизации. Если вы используете VuePress 1 со стандартной темой, миграция на VitePress должна быть относительно простой. -Также были приложены усилия для создания VuePress 2, который также поддерживает Vue 3 и Vite с большей совместимостью с VuePress 1. Однако поддерживать два генератора параллельно не представляется возможным, поэтому команда Vue решила сосредоточиться на VitePress как основном рекомендуемом генераторе статических сайтов в долгосрочной перспективе. +Поддержка двух генераторов статических сайтов (SSG) параллельно не является устойчивой, поэтому команда Vue решила сосредоточиться на VitePress как на основном рекомендуемом SSG в долгосрочной перспективе. Теперь VuePress 1 признан устаревшим, а VuePress 2 передан команде сообщества VuePress для дальнейшей разработки и поддержки. diff --git a/docs/ru/reference/site-config.md b/docs/ru/reference/site-config.md index 4877506a..74508e04 100644 --- a/docs/ru/reference/site-config.md +++ b/docs/ru/reference/site-config.md @@ -24,7 +24,7 @@ export default { } ``` -:::details Динамическая (асинхронная) конфигурация +::: details Динамическая (асинхронная) конфигурация Если вам нужно генерировать конфигурацию динамически, вы также можете экспортировать функцию по умолчанию. Например: diff --git a/docs/zh/config.ts b/docs/zh/config.ts index 86bcf959..5159a6e9 100644 --- a/docs/zh/config.ts +++ b/docs/zh/config.ts @@ -5,7 +5,6 @@ const require = createRequire(import.meta.url) const pkg = require('vitepress/package.json') export default defineAdditionalConfig({ - lang: 'zh-Hans', description: '由 Vite 和 Vue 驱动的静态站点生成器', themeConfig: { @@ -25,7 +24,7 @@ export default defineAdditionalConfig({ footer: { message: '基于 MIT 许可发布', - copyright: `版权所有 © 2019-${new Date().getFullYear()} 尤雨溪` + copyright: '版权所有 © 2019-至今 尤雨溪' }, docFooter: { diff --git a/docs/zh/guide/extending-default-theme.md b/docs/zh/guide/extending-default-theme.md index 0ee60e41..a23cebd1 100644 --- a/docs/zh/guide/extending-default-theme.md +++ b/docs/zh/guide/extending-default-theme.md @@ -14,7 +14,7 @@ VitePress 默认的主题已经针对文档进行了优化,并且可以进行 这些高级自定义配置将需要使用自定义主题来“拓展”默认主题。 -:::tip +::: tip 在继续之前,请确保首先阅读[自定义主题](./custom-theme)以了解其工作原理。 ::: diff --git a/docs/zh/guide/getting-started.md b/docs/zh/guide/getting-started.md index 2073483a..183b32df 100644 --- a/docs/zh/guide/getting-started.md +++ b/docs/zh/guide/getting-started.md @@ -18,23 +18,19 @@ VitePress 可以单独使用,也可以安装到现有项目中。在这两种 ::: code-group ```sh [npm] -$ npm add -D vitepress +$ npm add -D vitepress@next ``` ```sh [pnpm] -$ pnpm add -D vitepress +$ pnpm add -D vitepress@next ``` ```sh [yarn] -$ yarn add -D vitepress -``` - -```sh [yarn (pnp)] -$ yarn add -D vitepress vue +$ yarn add -D vitepress@next vue ``` ```sh [bun] -$ bun add -D vitepress +$ bun add -D vitepress@next ``` ::: @@ -73,7 +69,7 @@ $ bun vitepress init <<< @/snippets/init.ansi -:::tip Vue 作为 peer dependency +::: tip Vue 作为 peer dependency 如果打算使用 Vue 组件或 API 进行自定义,还应该明确地将 `vue` 安装为 dependency。 ::: @@ -96,7 +92,7 @@ $ bun vitepress init `docs` 目录作为 VitePress 站点的项目**根目录**。`.vitepress` 目录是 VitePress 配置文件、开发服务器缓存、构建输出和可选主题自定义代码的位置。 -:::tip +::: tip 默认情况下,VitePress 将其开发服务器缓存存储在 `.vitepress/cache` 中,并将生产构建输出存储在 `.vitepress/dist` 中。如果使用 Git,应该将它们添加到 `.gitignore` 文件中。也可以手动[配置](../reference/site-config#outdir)这些位置。 ::: diff --git a/docs/zh/guide/markdown.md b/docs/zh/guide/markdown.md index a16affbd..cda368ee 100644 --- a/docs/zh/guide/markdown.md +++ b/docs/zh/guide/markdown.md @@ -255,11 +255,11 @@ Wraps in a `
` } ``` - 它在底层使用 [`postcss-prefix-selector`](https://github.com/RadValentin/postcss-prefix-selector)。你可以像这样传递它的选项: + 你可以像这样传递它的选项: ```js postcssIsolateStyles({ - includeFiles: [/vp-doc\.css/] // 默认为 /base\.css/ + includeFiles: [/custom\.css/] // 默认为 [/vp-doc\.css/, /base\.css/] }) ``` diff --git a/docs/zh/guide/routing.md b/docs/zh/guide/routing.md index 56332317..c48722ad 100644 --- a/docs/zh/guide/routing.md +++ b/docs/zh/guide/routing.md @@ -123,7 +123,7 @@ src/getting-started.md --> /getting-started.html ## 生成简洁的 URL {#generating-clean-url} -:::warning 需要服务器支持 +::: warning 需要服务器支持 要使 VitePress 提供简洁 URL,需要服务器端支持。 ::: diff --git a/docs/zh/guide/using-vue.md b/docs/zh/guide/using-vue.md index be181fee..f9acaad4 100644 --- a/docs/zh/guide/using-vue.md +++ b/docs/zh/guide/using-vue.md @@ -67,7 +67,7 @@ The count is: {{ count }} ``` -:::warning 避免在 Markdown 中使用 `