From c34769c2e67969881b9cc8abbccf6d3cc6a5b647 Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Mon, 13 Jul 2026 14:01:03 +0800 Subject: [PATCH 001/136] fix(theme): remove font-synthesis style (#5309) --- src/client/theme-default/styles/base.css | 1 - 1 file changed, 1 deletion(-) diff --git a/src/client/theme-default/styles/base.css b/src/client/theme-default/styles/base.css index 4472602f..e8e4f9e4 100644 --- a/src/client/theme-default/styles/base.css +++ b/src/client/theme-default/styles/base.css @@ -40,7 +40,6 @@ font-weight: 400; color: var(--vp-c-text-1); background-color: var(--vp-c-bg); - font-synthesis: style; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; From 9ee401d7adefc39fd960990cc032be5464e4eb27 Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Mon, 13 Jul 2026 16:55:22 +0800 Subject: [PATCH 002/136] fix(theme): preserve url params when switching languages (#5312) --- .../theme-default/composables/langs.test.ts | 25 +++++++++++++------ src/client/theme-default/composables/langs.ts | 12 ++++++--- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/__tests__/unit/client/theme-default/composables/langs.test.ts b/__tests__/unit/client/theme-default/composables/langs.test.ts index dc91bbe7..cf9760c1 100644 --- a/__tests__/unit/client/theme-default/composables/langs.test.ts +++ b/__tests__/unit/client/theme-default/composables/langs.test.ts @@ -1,5 +1,5 @@ import { resolveLocaleLink } from 'client/theme-default/composables/langs' -import type { VitePressData } from 'vitepress' +import type { Route, VitePressData } from 'vitepress' import type { DefaultTheme } from 'vitepress/theme' import { ref } from 'vue' @@ -24,29 +24,38 @@ function createData( } as unknown as VitePressData } +function createRoute(query = '', hash = '#install') { + return { + query, + hash + } as unknown as Route +} + describe('client/theme-default/composables/langs', () => { test('resolves corresponding links with the default router', () => { - expect(resolveLocaleLink(createData({}), 'fr', '/fr/', '/', true)).toBe( - '/fr/guide/getting-started.html#install' - ) + expect( + resolveLocaleLink(createData({}), createRoute(), 'fr', '/fr/', '/', true) + ).toBe('/fr/guide/getting-started.html#install') }) test('resolves clean index links with the default router', () => { expect( resolveLocaleLink( createData({}, 'en/guide/index.md', true, '#intro'), + createRoute('?query', '#intro'), 'fr', '/fr/', '/en/', true ) - ).toBe('/fr/guide/#intro') + ).toBe('/fr/guide/?query#intro') }) test('keeps locale root links when i18n routing is disabled', () => { expect( resolveLocaleLink( createData({ i18nRouting: false }), + createRoute(), 'fr', '/fr/', '/', @@ -62,8 +71,8 @@ describe('client/theme-default/composables/langs', () => { } }) - expect(resolveLocaleLink(data, 'fr', '/fr/', '/', true)).toBe( - '/fr/mapped/guide/getting-started.md#install' - ) + expect( + resolveLocaleLink(data, createRoute(), 'fr', '/fr/', '/', true) + ).toBe('/fr/mapped/guide/getting-started.md#install') }) }) diff --git a/src/client/theme-default/composables/langs.ts b/src/client/theme-default/composables/langs.ts index 9c10a1e9..e13d5b69 100644 --- a/src/client/theme-default/composables/langs.ts +++ b/src/client/theme-default/composables/langs.ts @@ -1,11 +1,13 @@ import { computed } from 'vue' import type { DefaultTheme } from 'vitepress/theme' import type { VitePressData } from '../../app/data' +import { useRoute, type Route } from '../../app/router' import { ensureStartingSlash } from '../support/utils' import { useData } from './data' export function useLangs({ correspondingLink = false } = {}) { const data = useData() + const route = useRoute() const { site, localeIndex } = data const currentLang = computed(() => ({ label: site.value.locales[localeIndex.value]?.label, @@ -22,6 +24,7 @@ export function useLangs({ correspondingLink = false } = {}) { text: value.label, link: resolveLocaleLink( data, + route, key, value.link || (key === 'root' ? '/' : `/${key}/`), currentLang.value.link, @@ -38,16 +41,17 @@ export function useLangs({ correspondingLink = false } = {}) { export function resolveLocaleLink( data: VitePressData, + route: Route, targetLocale: string, targetLink: string, currentLink: string, correspondingLink: boolean ) { - const { site, page, theme, hash } = data + const { site, page, theme } = data const i18nRouting = theme.value.i18nRouting if (correspondingLink && typeof i18nRouting === 'function') { - return i18nRouting(data, hash.value, targetLocale) + return i18nRouting(data, route.hash, targetLocale) } return ( @@ -56,7 +60,9 @@ export function resolveLocaleLink( i18nRouting !== false && correspondingLink, page.value.relativePath.slice(currentLink.length - 1), !site.value.cleanUrls - ) + hash.value + ) + + route.query + + route.hash ) } From 262b78f1cac9e2dc7721176dd36b7d2e77d7aaa4 Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Tue, 14 Jul 2026 01:27:35 +0800 Subject: [PATCH 003/136] refactor: improve relative image path normalization (#5314) --- .../unit/node/markdown/plugins/image.test.ts | 33 +++++++++++++++++++ src/node/markdown/plugins/image.ts | 3 +- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 __tests__/unit/node/markdown/plugins/image.test.ts diff --git a/__tests__/unit/node/markdown/plugins/image.test.ts b/__tests__/unit/node/markdown/plugins/image.test.ts new file mode 100644 index 00000000..416ea785 --- /dev/null +++ b/__tests__/unit/node/markdown/plugins/image.test.ts @@ -0,0 +1,33 @@ +import { MarkdownItAsync } from 'markdown-it-async' +import { imagePlugin } from 'node/markdown/plugins/image' + +describe('node/markdown/plugins/image', () => { + const md = new MarkdownItAsync() + imagePlugin(md as any) + + test('default image output', async () => { + const html = await md.renderAsync('![logo](foo.png)') + expect(html.trim()).toMatchInlineSnapshot( + `"

logo

"` + ) + }) + + test.for([ + ['foo.png', './foo.png'], + ['./foo.png', './foo.png'], + ['../foo.png', '../foo.png'], + ['../../foo.png', '../../foo.png'], + ['/foo.png', '/foo.png'], + ['https://example.com/foo.png', 'https://example.com/foo.png'] + ])('normalizes image src: %s → %s', async ([src, expected]) => { + const html = await md.renderAsync(`![logo](${src})`) + expect(html).toContain(`src="${expected}"`) + }) + + test('adds loading="lazy" attribute when lazyLoading is enabled', async () => { + const mdLazy = new MarkdownItAsync() + imagePlugin(mdLazy as any, { lazyLoading: true }) + const html = await mdLazy.renderAsync('![logo](foo.png)') + expect(html).toContain('loading="lazy"') + }) +}) diff --git a/src/node/markdown/plugins/image.ts b/src/node/markdown/plugins/image.ts index 40f0b296..d8d01570 100644 --- a/src/node/markdown/plugins/image.ts +++ b/src/node/markdown/plugins/image.ts @@ -20,7 +20,8 @@ export const imagePlugin = ( const token = tokens[idx] let url = token.attrGet('src') if (url && !EXTERNAL_URL_RE.test(url)) { - if (!/^\.?\//.test(url)) url = './' + url + // Normalize relative "foo.png" to "./foo.png" and decode for processing by bundlers + if (!/^\.*?\//.test(url)) url = './' + url token.attrSet('src', decodeURIComponent(url)) } if (lazyLoading) { From dcb7a75532c5472060ec379d25a5fafbc7932637 Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Tue, 14 Jul 2026 06:09:41 +0530 Subject: [PATCH 004/136] refactor!: make the route the single source of truth for the URL hash Replace the standalone `useData().hash` ref (backed by its own `hashchange` listener in `initData`) with the `hash` already tracked on the route, so the current URL is observed in one place and behaves consistently during SSR. - `isActive()` no longer reads `location.hash` at call time; it takes the current hash as an argument (plus an optional `skipHashCheck`) and `matchPath` is now required, making it pure and SSR-safe - nav bar menus, nav screen menus, and menu links now react to hash-only navigation too - sidebar active-state tracking is reworked on top of the route: items without a link are handled, and collapsed groups reliably auto-expand when a child link becomes active (including on hash changes) - prev/next links now properly ignore query strings and hashes when deduplicating sidebar candidates (via `normalize`) and when matching the current page - custom `i18nRouting` functions receive the whole current `Route` instead of only the hash string; language menu links are resolved from the route (en + ru docs updated) - `useLangs()` / `resolveLocaleLink()` are refactored with self-documenting, JSDoc'd options (`linkToCorrespondingPage`, `targetLocaleLink`, `currentLocaleLink`), and `resolveLocaleLink` gained focused unit tests covering locale-home links, corresponding links, cleanUrls, index pages, root-locale switching, and custom routing functions - unavoidable hydration mismatches are silenced with `data-allow-mismatch` (viewport-dependent inline styles, per-locale alternate links that embed the current query/hash) - the `Route` interface moved to the shared types so `DefaultTheme.I18nRouting` can reference it; the `vitepress` type export is unchanged - misc cleanups: `uniqBy` moved to theme support utils, `smartComputed` comparator now called as `(newValue, oldValue)`, import ordering BREAKING CHANGE: `useData().hash` has been removed. Read the hash from `useRoute()` instead. BREAKING CHANGE: custom `themeConfig.i18nRouting` functions now receive the current `Route` as their second argument instead of the hash string: `(data, route, targetLocale) => string`. Use `route.hash` for the previous value; `route.path`, `route.query`, and `route.data` are available as well. --- .../theme-default/composables/langs.test.ts | 174 ++++++++++++------ .../theme-default/support/sidebar.test.ts | 10 +- docs/en/reference/default-theme-config.md | 8 +- docs/ru/reference/default-theme-config.md | 8 +- src/client/app/components/Content.ts | 2 +- src/client/app/composables/head.ts | 2 +- src/client/app/data.ts | 22 +-- src/client/app/router.ts | 10 +- src/client/index.ts | 4 +- .../theme-default/components/VPCarbonAds.vue | 6 +- src/client/theme-default/components/VPDoc.vue | 1 - .../components/VPHomeContent.vue | 1 + .../components/VPLocalNavOutlineDropdown.vue | 3 +- .../theme-default/components/VPMenuLink.vue | 15 +- .../components/VPNavBarExtra.vue | 5 +- .../components/VPNavBarMenuGroup.vue | 16 +- .../components/VPNavBarMenuLink.vue | 15 +- .../components/VPNavBarTranslations.vue | 5 +- .../components/VPNavScreenMenuGroupLink.vue | 15 +- .../components/VPNavScreenMenuLink.vue | 15 +- .../components/VPNavScreenTranslations.vue | 5 +- .../theme-default/composables/flyout.ts | 2 +- src/client/theme-default/composables/langs.ts | 95 ++++++---- .../theme-default/composables/layout.ts | 2 +- .../theme-default/composables/prev-next.ts | 25 +-- .../theme-default/composables/sidebar.ts | 59 +++--- .../theme-default/support/reactivity.ts | 8 +- src/client/theme-default/support/sidebar.ts | 16 +- src/client/theme-default/support/utils.ts | 8 + src/shared/shared.ts | 19 +- types/default-theme.d.ts | 4 +- types/shared.d.ts | 18 +- 32 files changed, 357 insertions(+), 241 deletions(-) diff --git a/__tests__/unit/client/theme-default/composables/langs.test.ts b/__tests__/unit/client/theme-default/composables/langs.test.ts index cf9760c1..39fe021c 100644 --- a/__tests__/unit/client/theme-default/composables/langs.test.ts +++ b/__tests__/unit/client/theme-default/composables/langs.test.ts @@ -3,13 +3,34 @@ import type { Route, VitePressData } from 'vitepress' import type { DefaultTheme } from 'vitepress/theme' import { ref } from 'vue' -function createData( - themeConfig: DefaultTheme.Config, - relativePath = 'guide/getting-started.md', - cleanUrls = false, - hash = '#install' +// `currentPage` is the current page's relative path (like +// `route.data.relativePath`, but with a leading slash), plus any query and +// hash of the current URL. +function resolve( + currentPage: string, + { + themeConfig = {}, + cleanUrls = false, + targetLocale = 'fr', + targetLocaleLink = '/fr/', + currentLocaleLink = '/', + linkToCorrespondingPage = true + }: { + themeConfig?: DefaultTheme.Config + cleanUrls?: boolean + targetLocale?: string + targetLocaleLink?: string + currentLocaleLink?: string + linkToCorrespondingPage?: boolean + } = {} ) { - return { + const { pathname, search, hash } = new URL(currentPage, 'http://a.com') + const route = { + data: { relativePath: pathname.slice(1) }, + query: search, + hash + } as Route + const data = { site: ref({ cleanUrls, locales: { @@ -18,61 +39,108 @@ function createData( }, themeConfig }), - page: ref({ relativePath }), - theme: ref(themeConfig), - hash: ref(hash) + theme: ref(themeConfig) } as unknown as VitePressData -} -function createRoute(query = '', hash = '#install') { - return { - query, - hash - } as unknown as Route + return resolveLocaleLink(data, route, { + targetLocale, + targetLocaleLink, + currentLocaleLink, + linkToCorrespondingPage + }) } describe('client/theme-default/composables/langs', () => { - test('resolves corresponding links with the default router', () => { - expect( - resolveLocaleLink(createData({}), createRoute(), 'fr', '/fr/', '/', true) - ).toBe('/fr/guide/getting-started.html#install') - }) - - test('resolves clean index links with the default router', () => { - expect( - resolveLocaleLink( - createData({}, 'en/guide/index.md', true, '#intro'), - createRoute('?query', '#intro'), - 'fr', - '/fr/', - '/en/', - true - ) - ).toBe('/fr/guide/?query#intro') - }) + describe('resolveLocaleLink', () => { + describe('locale home links (linkToCorrespondingPage: false)', () => { + test('links to the target locale home', () => { + expect( + resolve('/guide/getting-started.md', { + linkToCorrespondingPage: false + }) + ).toBe('/fr/') + }) - test('keeps locale root links when i18n routing is disabled', () => { - expect( - resolveLocaleLink( - createData({ i18nRouting: false }), - createRoute(), - 'fr', - '/fr/', - '/', - true - ) - ).toBe('/fr/#install') - }) + test('preserves query and hash', () => { + expect( + resolve('/guide/getting-started.md?a=1#install', { + linkToCorrespondingPage: false + }) + ).toBe('/fr/?a=1#install') + }) - test('uses custom i18n routing functions for corresponding links', () => { - const data = createData({ - i18nRouting(data, hash, targetLocale) { - return `${data.site.value.locales[targetLocale].link}mapped/${data.page.value.relativePath}${hash}` - } + test('ignores custom i18n routing functions', () => { + expect( + resolve('/guide/getting-started.md', { + linkToCorrespondingPage: false, + themeConfig: { i18nRouting: () => '/custom/' } + }) + ).toBe('/fr/') + }) }) - expect( - resolveLocaleLink(data, createRoute(), 'fr', '/fr/', '/', true) - ).toBe('/fr/mapped/guide/getting-started.md#install') + describe('corresponding page links (linkToCorrespondingPage: true)', () => { + test('rewrites the current page path into the target locale', () => { + expect(resolve('/guide/getting-started.md#install')).toBe( + '/fr/guide/getting-started.html#install' + ) + }) + + test('drops the .html extension when clean URLs are enabled', () => { + expect( + resolve('/guide/getting-started.md#install', { cleanUrls: true }) + ).toBe('/fr/guide/getting-started#install') + }) + + test('resolves index pages to directory links', () => { + expect(resolve('/guide/index.md')).toBe('/fr/guide/') + expect(resolve('/guide/index.md', { cleanUrls: true })).toBe( + '/fr/guide/' + ) + }) + + test('resolves the site root page to the target locale home', () => { + expect(resolve('/index.md')).toBe('/fr/') + }) + + test('strips the current locale prefix before rewriting', () => { + expect( + resolve('/en/guide/index.md?query#intro', { + currentLocaleLink: '/en/', + cleanUrls: true + }) + ).toBe('/fr/guide/?query#intro') + }) + + test('rewrites into the root locale', () => { + expect( + resolve('/fr/guide/getting-started.md#install', { + targetLocale: 'root', + targetLocaleLink: '/', + currentLocaleLink: '/fr/' + }) + ).toBe('/guide/getting-started.html#install') + }) + + test('links to the target locale home when i18n routing is disabled', () => { + expect( + resolve('/guide/getting-started.md#install', { + themeConfig: { i18nRouting: false } + }) + ).toBe('/fr/#install') + }) + + test('delegates to custom i18n routing functions', () => { + expect( + resolve('/guide/getting-started.md#install', { + themeConfig: { + i18nRouting(data, route, targetLocale) { + return `${data.site.value.locales[targetLocale].link}mapped/${route.data.relativePath}${route.hash}` + } + } + }) + ).toBe('/fr/mapped/guide/getting-started.md#install') + }) + }) }) }) diff --git a/__tests__/unit/client/theme-default/support/sidebar.test.ts b/__tests__/unit/client/theme-default/support/sidebar.test.ts index 7232757c..c5a4d44f 100644 --- a/__tests__/unit/client/theme-default/support/sidebar.test.ts +++ b/__tests__/unit/client/theme-default/support/sidebar.test.ts @@ -188,8 +188,8 @@ describe('client/theme-default/support/sidebar', () => { ] } - expect(hasActiveLink('active-1', item)).toBe(true) - expect(hasActiveLink('inactive', item)).toBe(false) + expect(hasActiveLink('active-1', '', item)).toBe(true) + expect(hasActiveLink('inactive', '', item)).toBe(false) }) test('checks `SidebarItem[]`', () => { @@ -210,9 +210,9 @@ describe('client/theme-default/support/sidebar', () => { } ] - expect(hasActiveLink('active-1', item)).toBe(true) - expect(hasActiveLink('active-3', item)).toBe(true) - expect(hasActiveLink('inactive', item)).toBe(false) + expect(hasActiveLink('active-1', '', item)).toBe(true) + expect(hasActiveLink('active-3', '', item)).toBe(true) + expect(hasActiveLink('inactive', '', item)).toBe(false) }) }) }) diff --git a/docs/en/reference/default-theme-config.md b/docs/en/reference/default-theme-config.md index cc4ffd0e..02c221ec 100644 --- a/docs/en/reference/default-theme-config.md +++ b/docs/en/reference/default-theme-config.md @@ -25,23 +25,23 @@ export default { ## i18nRouting -- Type: `boolean | ((data: VitePressData, hash: string, targetLocale: string) => string)` +- Type: `boolean | ((data: VitePressData, route: Route, targetLocale: string) => string)` Changing locale to say `zh` will change the URL from `/foo` (or `/en/foo/`) to `/zh/foo`. You can disable this behavior by setting `themeConfig.i18nRouting` to `false`. -Set `themeConfig.i18nRouting` to a function to customize the locale link. The function receives the current VitePress data, the current hash, and the target locale key, and returns the target link. +Set `themeConfig.i18nRouting` to a function to customize the locale link. The function receives the current VitePress data, the current route, and the target locale key, and returns the target link. ```ts import { defineConfig } from 'vitepress' export default defineConfig({ themeConfig: { - i18nRouting(data, hash, targetLocale) { + i18nRouting(data, route, targetLocale) { const target = data.site.value.locales[targetLocale] const targetLink = target.link || (targetLocale === 'root' ? '/' : `/${targetLocale}/`) - return `${targetLink}${data.page.value.relativePath.replace(/\.md$/, '')}${hash}` + return `${targetLink}${route.data.relativePath.replace(/\.md$/, '')}${route.hash}` } } }) diff --git a/docs/ru/reference/default-theme-config.md b/docs/ru/reference/default-theme-config.md index 796b5bb4..afd17954 100644 --- a/docs/ru/reference/default-theme-config.md +++ b/docs/ru/reference/default-theme-config.md @@ -25,23 +25,23 @@ export default { ## i18nRouting -- Тип: `boolean | ((data: VitePressData, hash: string, targetLocale: string) => string)` +- Тип: `boolean | ((data: VitePressData, route: Route, targetLocale: string) => string)` При смене локали на `ru` URL изменится с `/foo` (или `/en/foo/`) на `/ru/foo`. Вы можете отключить это поведение, установив для параметра `themeConfig.i18nRouting` значение `false`. -Установите для `themeConfig.i18nRouting` функцию, чтобы настроить ссылки для переключения локали. Эта функция получает текущие данные VitePress, текущий хеш и ключ целевой локали, а затем возвращает ссылку для перехода на неё. +Установите для `themeConfig.i18nRouting` функцию, чтобы настроить ссылку локали. Эта функция получает текущие данные VitePress, текущий маршрут и ключ целевой локали, а затем возвращает целевую ссылку. ```ts import { defineConfig } from 'vitepress' export default defineConfig({ themeConfig: { - i18nRouting(data, hash, targetLocale) { + i18nRouting(data, route, targetLocale) { const target = data.site.value.locales[targetLocale] const targetLink = target.link || (targetLocale === 'root' ? '/' : `/${targetLocale}/`) - return `${targetLink}${data.page.value.relativePath.replace(/\.md$/, '')}${hash}` + return `${targetLink}${route.data.relativePath.replace(/\.md$/, '')}${route.hash}` } } }) diff --git a/src/client/app/components/Content.ts b/src/client/app/components/Content.ts index 12456451..d21ed2aa 100644 --- a/src/client/app/components/Content.ts +++ b/src/client/app/components/Content.ts @@ -10,8 +10,8 @@ export const Content = defineComponent({ as: { type: [Object, String], default: 'div' } }, setup(props) { - const route = useRoute() const { frontmatter, site } = useData() + const route = useRoute() watch(frontmatter, runCbs, { deep: true, flush: 'post' }) return () => h( diff --git a/src/client/app/composables/head.ts b/src/client/app/composables/head.ts index 13fb9bb0..2b63d5cf 100644 --- a/src/client/app/composables/head.ts +++ b/src/client/app/composables/head.ts @@ -3,9 +3,9 @@ import { createTitle, mergeHead, type HeadConfig, + type Route, type SiteData } from '../../shared' -import type { Route } from '../router' export function useUpdateHead(route: Route, siteDataByRouteRef: Ref) { let isFirstUpdate = true diff --git a/src/client/app/data.ts b/src/client/app/data.ts index 89297dba..c612dbb7 100644 --- a/src/client/app/data.ts +++ b/src/client/app/data.ts @@ -6,19 +6,17 @@ import { readonly, ref, shallowRef, - watch, type InjectionKey, type Ref } from 'vue' import { APPEARANCE_KEY, createTitle, - inBrowser, resolveSiteDataByRoute, + type Route, type SiteData, type VitePressData } from '../shared' -import type { Route } from './router' export const dataSymbol: InjectionKey = Symbol() export type { VitePressData } from '../shared' @@ -48,21 +46,6 @@ export function initData(route: Route): VitePressData { }) : ref(false) - const hashRef = ref(inBrowser ? location.hash : '') - - if (inBrowser) { - window.addEventListener('hashchange', () => { - hashRef.value = location.hash - }) - } - - watch( - () => route.data, - () => { - hashRef.value = inBrowser ? location.hash : '' - } - ) - return { site, theme: computed(() => site.value.themeConfig), @@ -76,8 +59,7 @@ export function initData(route: Route): VitePressData { description: computed( () => route.data.description || site.value.description ), - isDark, - hash: computed(() => hashRef.value) + isDark } } diff --git a/src/client/app/router.ts b/src/client/app/router.ts index 5d3d86f1..818f46fb 100644 --- a/src/client/app/router.ts +++ b/src/client/app/router.ts @@ -1,18 +1,10 @@ import type { Component, InjectionKey } from 'vue' import { inject, markRaw, nextTick, reactive, readonly } from 'vue' -import type { Awaitable, PageData, PageDataPayload } from '../shared' +import type { Awaitable, PageData, PageDataPayload, Route } from '../shared' import { notFoundPageData, treatAsHtml } from '../shared' import { siteDataRef } from './data' import { inBrowser, withBase } from './utils' -export interface Route { - path: string - hash: string - query: string - data: PageData - component: Component | null -} - export interface Router { /** * Current route. diff --git a/src/client/index.ts b/src/client/index.ts index 47074c43..8b0bc15e 100644 --- a/src/client/index.ts +++ b/src/client/index.ts @@ -2,8 +2,8 @@ // so the user can do `import { useRoute, useData } from 'vitepress'` // generic types -export type { Route, Router } from './app/router' -export type { VitePressData } from './shared' +export type { Router } from './app/router' +export type { Route, VitePressData } from './shared' // theme types export type { EnhanceAppContext, Theme } from './app/theme' diff --git a/src/client/theme-default/components/VPCarbonAds.vue b/src/client/theme-default/components/VPCarbonAds.vue index b8fc77a2..ca034ccb 100644 --- a/src/client/theme-default/components/VPCarbonAds.vue +++ b/src/client/theme-default/components/VPCarbonAds.vue @@ -1,10 +1,10 @@ diff --git a/src/client/theme-default/components/VPNavBarExtra.vue b/src/client/theme-default/components/VPNavBarExtra.vue index 7201623b..1ddde9b9 100644 --- a/src/client/theme-default/components/VPNavBarExtra.vue +++ b/src/client/theme-default/components/VPNavBarExtra.vue @@ -8,7 +8,9 @@ import VPSocialLinks from './VPSocialLinks.vue' import VPSwitchAppearance from './VPSwitchAppearance.vue' const { site, theme } = useData() -const { localeLinks, currentLang } = useLangs({ correspondingLink: true }) +const { localeLinks, currentLang } = useLangs({ + linkToCorrespondingPage: true +}) const hasExtraContent = computed( () => @@ -38,6 +40,7 @@ const hasExtraContent = computed( :hreflang="locale.lang" rel="alternate" :dir="locale.dir" + data-allow-mismatch="attribute" /> diff --git a/src/client/theme-default/components/VPNavBarMenuGroup.vue b/src/client/theme-default/components/VPNavBarMenuGroup.vue index 4d014a49..61004f3f 100644 --- a/src/client/theme-default/components/VPNavBarMenuGroup.vue +++ b/src/client/theme-default/components/VPNavBarMenuGroup.vue @@ -1,19 +1,24 @@ diff --git a/src/client/theme-default/components/VPNavScreenMenu.vue b/src/client/theme-default/components/VPNavScreenMenu.vue index 77f358cb..8fa72da2 100644 --- a/src/client/theme-default/components/VPNavScreenMenu.vue +++ b/src/client/theme-default/components/VPNavScreenMenu.vue @@ -8,19 +8,21 @@ const { theme } = useData() diff --git a/src/client/theme-default/components/VPNavScreenMenuGroup.vue b/src/client/theme-default/components/VPNavScreenMenuGroup.vue index f5d78e66..78baed24 100644 --- a/src/client/theme-default/components/VPNavScreenMenuGroup.vue +++ b/src/client/theme-default/components/VPNavScreenMenuGroup.vue @@ -31,8 +31,8 @@ function toggle() { -
- -
+ + diff --git a/src/client/theme-default/components/VPNavScreenMenuGroupSection.vue b/src/client/theme-default/components/VPNavScreenMenuGroupSection.vue index a7e2cd38..e094a707 100644 --- a/src/client/theme-default/components/VPNavScreenMenuGroupSection.vue +++ b/src/client/theme-default/components/VPNavScreenMenuGroupSection.vue @@ -11,7 +11,11 @@ defineProps<{ diff --git a/src/client/theme-default/components/VPSidebarItem.vue b/src/client/theme-default/components/VPSidebarItem.vue index d71d1062..e4c63f2b 100644 --- a/src/client/theme-default/components/VPSidebarItem.vue +++ b/src/client/theme-default/components/VPSidebarItem.vue @@ -94,16 +94,16 @@ function onCaretClick() { -
- -
+ + diff --git a/src/client/theme-default/components/VPSocialLinks.vue b/src/client/theme-default/components/VPSocialLinks.vue index 062f7f62..f30b86c9 100644 --- a/src/client/theme-default/components/VPSocialLinks.vue +++ b/src/client/theme-default/components/VPSocialLinks.vue @@ -11,17 +11,17 @@ withDefaults(defineProps<{ diff --git a/src/client/theme-default/components/VPSponsorsGrid.vue b/src/client/theme-default/components/VPSponsorsGrid.vue index 65dbe81b..370e5af0 100644 --- a/src/client/theme-default/components/VPSponsorsGrid.vue +++ b/src/client/theme-default/components/VPSponsorsGrid.vue @@ -22,8 +22,8 @@ useSponsorsGrid({ el, size: props.size }) diff --git a/src/client/theme-default/components/VPTeamMembers.vue b/src/client/theme-default/components/VPTeamMembers.vue index 0337eb5a..6b83e4a6 100644 --- a/src/client/theme-default/components/VPTeamMembers.vue +++ b/src/client/theme-default/components/VPTeamMembers.vue @@ -17,11 +17,11 @@ const classes = computed(() => [props.size, `count-${props.members.length}`]) @@ -63,4 +63,15 @@ const classes = computed(() => [props.size, `count-${props.members.length}`]) margin: 0 auto; max-width: 1152px; } + +/* Reset styles from vp-doc if used in markdown */ +.vp-doc .VPTeamMembers .container { + list-style: none; + margin: 0 auto; + padding: 0; +} +.vp-doc .VPTeamMembers .item { + margin: 0; + padding: 0; +} diff --git a/src/client/theme-default/styles/components/vp-sponsor.css b/src/client/theme-default/styles/components/vp-sponsor.css index 9e677ab9..79de6b73 100644 --- a/src/client/theme-default/styles/components/vp-sponsor.css +++ b/src/client/theme-default/styles/components/vp-sponsor.css @@ -153,3 +153,11 @@ .dark .vp-sponsor-grid-image { filter: grayscale(1) invert(1); } + +/* Reset styles from vp-doc if used in markdown */ +.vp-doc .vp-sponsor-grid, +.vp-doc .vp-sponsor-grid-item { + list-style: none; + margin: 0; + padding: 0; +} From 70a918751b7c64dbecf3bd29edc2204014cbb84e Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Fri, 17 Jul 2026 13:29:05 +0530 Subject: [PATCH 014/136] docs: update vite's domain --- CHANGELOG.md | 2 +- docs/en/guide/asset-handling.md | 2 +- docs/en/guide/extending-default-theme.md | 4 ++-- docs/en/guide/getting-started.md | 2 +- docs/en/guide/ssr-compat.md | 2 +- docs/en/guide/using-vue.md | 2 +- docs/en/guide/what-is-vitepress.md | 4 ++-- docs/en/reference/site-config.md | 4 ++-- docs/es/guide/asset-handling.md | 2 +- docs/es/guide/extending-default-theme.md | 4 ++-- docs/es/guide/getting-started.md | 2 +- docs/es/guide/ssr-compat.md | 2 +- docs/es/guide/using-vue.md | 2 +- docs/es/guide/what-is-vitepress.md | 4 ++-- docs/es/reference/site-config.md | 4 ++-- docs/fa/guide/asset-handling.md | 2 +- docs/fa/guide/extending-default-theme.md | 4 ++-- docs/fa/guide/getting-started.md | 2 +- docs/fa/guide/ssr-compat.md | 2 +- docs/fa/guide/using-vue.md | 2 +- docs/fa/guide/what-is-vitepress.md | 4 ++-- docs/fa/reference/site-config.md | 4 ++-- docs/ja/guide/asset-handling.md | 2 +- docs/ja/guide/extending-default-theme.md | 4 ++-- docs/ja/guide/getting-started.md | 2 +- docs/ja/guide/ssr-compat.md | 2 +- docs/ja/guide/using-vue.md | 2 +- docs/ja/guide/what-is-vitepress.md | 4 ++-- docs/ja/reference/site-config.md | 4 ++-- docs/ko/guide/asset-handling.md | 2 +- docs/ko/guide/extending-default-theme.md | 4 ++-- docs/ko/guide/getting-started.md | 2 +- docs/ko/guide/ssr-compat.md | 2 +- docs/ko/guide/using-vue.md | 2 +- docs/ko/guide/what-is-vitepress.md | 4 ++-- docs/ko/reference/site-config.md | 4 ++-- docs/pt/guide/asset-handling.md | 2 +- docs/pt/guide/extending-default-theme.md | 4 ++-- docs/pt/guide/getting-started.md | 2 +- docs/pt/guide/ssr-compat.md | 2 +- docs/pt/guide/using-vue.md | 2 +- docs/pt/guide/what-is-vitepress.md | 4 ++-- docs/pt/reference/site-config.md | 4 ++-- docs/ru/guide/asset-handling.md | 2 +- docs/ru/guide/extending-default-theme.md | 4 ++-- docs/ru/guide/getting-started.md | 2 +- docs/ru/guide/ssr-compat.md | 2 +- docs/ru/guide/using-vue.md | 2 +- docs/ru/guide/what-is-vitepress.md | 2 +- docs/ru/reference/site-config.md | 4 ++-- docs/zh/guide/asset-handling.md | 2 +- docs/zh/guide/extending-default-theme.md | 4 ++-- docs/zh/guide/getting-started.md | 2 +- docs/zh/guide/ssr-compat.md | 2 +- docs/zh/guide/using-vue.md | 2 +- docs/zh/guide/what-is-vitepress.md | 4 ++-- docs/zh/reference/site-config.md | 4 ++-- 57 files changed, 80 insertions(+), 80 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b39ee7c..94b87b81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -820,7 +820,7 @@ Users who intentionally reference non-existent files or want to document include ### BREAKING CHANGES -- VitePress now runs on Vite 5. Please refer https://vitejs.dev/guide/migration for breaking changes and migration guide if you're relying on some Vite-specific things. +- VitePress now runs on Vite 5. Please refer https://vite.dev/guide/migration for breaking changes and migration guide if you're relying on some Vite-specific things. # [1.0.0-rc.25](https://github.com/vuejs/vitepress/compare/v1.0.0-rc.24...v1.0.0-rc.25) (2023-11-05) diff --git a/docs/en/guide/asset-handling.md b/docs/en/guide/asset-handling.md index 00819d1a..63394fd0 100644 --- a/docs/en/guide/asset-handling.md +++ b/docs/en/guide/asset-handling.md @@ -6,7 +6,7 @@ description: Learn how to reference and handle static assets such as images, med ## Referencing Static Assets -All Markdown files are compiled into Vue components and processed by [Vite](https://vitejs.dev/guide/assets.html). You can, **and should**, reference any assets using relative URLs: +All Markdown files are compiled into Vue components and processed by [Vite](https://vite.dev/guide/assets.html). You can, **and should**, reference any assets using relative URLs: ```md ![An image](./image.png) diff --git a/docs/en/guide/extending-default-theme.md b/docs/en/guide/extending-default-theme.md index 5ff15f5b..8a109e34 100644 --- a/docs/en/guide/extending-default-theme.md +++ b/docs/en/guide/extending-default-theme.md @@ -119,7 +119,7 @@ export default { } satisfies Theme ``` -Since we are using Vite, you can also leverage Vite's [glob import feature](https://vitejs.dev/guide/features.html#glob-import) to auto register a directory of components. +Since we are using Vite, you can also leverage Vite's [glob import feature](https://vite.dev/guide/features.html#glob-import) to auto register a directory of components. ## Layout Slots @@ -309,7 +309,7 @@ Coming soon. ## Overriding Internal Components -You can use Vite's [aliases](https://vitejs.dev/config/shared-options.html#resolve-alias) to replace default theme components with your custom ones: +You can use Vite's [aliases](https://vite.dev/config/shared-options.html#resolve-alias) to replace default theme components with your custom ones: ```ts import { fileURLToPath, URL } from 'node:url' diff --git a/docs/en/guide/getting-started.md b/docs/en/guide/getting-started.md index 31e45695..a181192d 100644 --- a/docs/en/guide/getting-started.md +++ b/docs/en/guide/getting-started.md @@ -45,7 +45,7 @@ $ deno add -D vitepress@next ::: tip NOTE -VitePress is an ESM-only package. Don't use `require()` to import it, and make sure your nearest `package.json` contains `"type": "module"`, or change the file extension of your relevant files like `.vitepress/config.js` to `.mjs`/`.mts`. Refer to [Vite's troubleshooting guide](http://vitejs.dev/guide/troubleshooting.html#this-package-is-esm-only) for more details. Also, inside async CJS contexts, you can use `await import('vitepress')` instead. +VitePress is an ESM-only package. Don't use `require()` to import it, and make sure your nearest `package.json` contains `"type": "module"`, or change the file extension of your relevant files like `.vitepress/config.js` to `.mjs`/`.mts`. Refer to [Vite's troubleshooting guide](http://vite.dev/guide/troubleshooting.html#this-package-is-esm-only) for more details. Also, inside async CJS contexts, you can use `await import('vitepress')` instead. ::: diff --git a/docs/en/guide/ssr-compat.md b/docs/en/guide/ssr-compat.md index 99171ad6..f532b16a 100644 --- a/docs/en/guide/ssr-compat.md +++ b/docs/en/guide/ssr-compat.md @@ -39,7 +39,7 @@ onMounted(() => { ### Conditional Import -You can also conditionally import a dependency using the `import.meta.env.SSR` flag (part of [Vite env variables](https://vitejs.dev/guide/env-and-mode.html#env-variables)): +You can also conditionally import a dependency using the `import.meta.env.SSR` flag (part of [Vite env variables](https://vite.dev/guide/env-and-mode.html#env-variables)): ```js if (!import.meta.env.SSR) { diff --git a/docs/en/guide/using-vue.md b/docs/en/guide/using-vue.md index a9b9a389..4d6c7e87 100644 --- a/docs/en/guide/using-vue.md +++ b/docs/en/guide/using-vue.md @@ -204,7 +204,7 @@ Note that this might prevent certain tokens from being syntax highlighted proper ## Using CSS Pre-processors -VitePress has [built-in support](https://vitejs.dev/guide/features.html#css-pre-processors) for CSS pre-processors: `.scss`, `.sass`, `.less`, `.styl` and `.stylus` files. There is no need to install Vite-specific plugins for them, but the corresponding pre-processor itself must be installed: +VitePress has [built-in support](https://vite.dev/guide/features.html#css-pre-processors) for CSS pre-processors: `.scss`, `.sass`, `.less`, `.styl` and `.stylus` files. There is no need to install Vite-specific plugins for them, but the corresponding pre-processor itself must be installed: ``` # .scss and .sass diff --git a/docs/en/guide/what-is-vitepress.md b/docs/en/guide/what-is-vitepress.md index b63eb7ea..fd6930e1 100644 --- a/docs/en/guide/what-is-vitepress.md +++ b/docs/en/guide/what-is-vitepress.md @@ -16,7 +16,7 @@ Just want to try it out? Skip to the [Quickstart](./getting-started). - **Documentation** - VitePress ships with a default theme designed for technical documentation. It powers this page you are reading right now, along with the documentation for [Vite](https://vitejs.dev/), [Rollup](https://rollupjs.org/), [Pinia](https://pinia.vuejs.org/), [VueUse](https://vueuse.org/), [Vitest](https://vitest.dev/), [D3](https://d3js.org/), [UnoCSS](https://unocss.dev/), [Iconify](https://iconify.design/) and [many more](https://github.com/search?q=/%22vitepress%22:+/+path:/(?:package%7Cdeno)%5C.jsonc?$/+NOT+is:fork+NOT+is:archived&type=code). + VitePress ships with a default theme designed for technical documentation. It powers this page you are reading right now, along with the documentation for [Vite](https://vite.dev/), [Rollup](https://rollupjs.org/), [Pinia](https://pinia.vuejs.org/), [VueUse](https://vueuse.org/), [Vitest](https://vitest.dev/), [D3](https://d3js.org/), [UnoCSS](https://unocss.dev/), [Iconify](https://iconify.design/) and [many more](https://github.com/search?q=/%22vitepress%22:+/+path:/(?:package%7Cdeno)%5C.jsonc?$/+NOT+is:fork+NOT+is:archived&type=code). The [official Vue.js documentation](https://vuejs.org/) is also based on VitePress, but uses a custom theme shared between multiple translations. @@ -30,7 +30,7 @@ Just want to try it out? Skip to the [Quickstart](./getting-started). VitePress aims to provide a great Developer Experience (DX) when working with Markdown content. -- **[Vite-Powered:](https://vitejs.dev/)** instant server start, with edits always instantly reflected (<100ms) without page reload. +- **[Vite-Powered:](https://vite.dev/)** instant server start, with edits always instantly reflected (<100ms) without page reload. - **[Built-in Markdown Extensions:](./markdown)** Frontmatter, tables, syntax highlighting... you name it. Specifically, VitePress provides many advanced features for working with code blocks, making it ideal for highly technical documentation. diff --git a/docs/en/reference/site-config.md b/docs/en/reference/site-config.md index b5f4c8f2..8ddae74a 100644 --- a/docs/en/reference/site-config.md +++ b/docs/en/reference/site-config.md @@ -461,7 +461,7 @@ export default { - Type: `string` - Default: `./.vitepress/cache` -The directory for cache files, relative to [project root](../guide/routing#root-and-source-directory). See also: [cacheDir](https://vitejs.dev/config/shared-options.html#cachedir). +The directory for cache files, relative to [project root](../guide/routing#root-and-source-directory). See also: [cacheDir](https://vite.dev/config/shared-options.html#cachedir). ```ts export default { @@ -560,7 +560,7 @@ Set `markdown.headers` to `true` or pass [`@mdit-vue/plugin-headers`](https://gi - Type: `import('vite').UserConfig` -Pass raw [Vite Config](https://vitejs.dev/config/) to internal Vite dev server / bundler. +Pass raw [Vite Config](https://vite.dev/config/) to internal Vite dev server / bundler. ```js export default { diff --git a/docs/es/guide/asset-handling.md b/docs/es/guide/asset-handling.md index c3580347..30c9034d 100644 --- a/docs/es/guide/asset-handling.md +++ b/docs/es/guide/asset-handling.md @@ -6,7 +6,7 @@ description: Aprende cómo referenciar y manejar recursos estáticos como imáge ## Referenciando Assets Estáticos {#referencing-static-assets} -Todos los archivos Markdown son compilados en componentes Vue y procesados por [Vite](https://vitejs.dev/guide/assets.html). Usted puede **y debe** referenciar cualquier asset usando URLs relativas: +Todos los archivos Markdown son compilados en componentes Vue y procesados por [Vite](https://vite.dev/guide/assets.html). Usted puede **y debe** referenciar cualquier asset usando URLs relativas: ```md ![Una imagen](./imagen.png) diff --git a/docs/es/guide/extending-default-theme.md b/docs/es/guide/extending-default-theme.md index b9b9a67f..1e4a7885 100644 --- a/docs/es/guide/extending-default-theme.md +++ b/docs/es/guide/extending-default-theme.md @@ -119,7 +119,7 @@ export default { } satisfies Theme ``` -Como estamos usando Vite, puede también aprovechar la [funcionalidad de importación glob](https://vitejs.dev/guide/features.html#glob-import) de Vite para registrar automaticamente un directorio de componetes. +Como estamos usando Vite, puede también aprovechar la [funcionalidad de importación glob](https://vite.dev/guide/features.html#glob-import) de Vite para registrar automaticamente un directorio de componetes. ## _Slots_ en el Layout {#layout-slots} @@ -309,7 +309,7 @@ En breve. ## Substituyendo Componentes Internos {#overriding-internal-components} -Puede usar los [aliases](https://vitejs.dev/config/shared-options.html#resolve-alias) Vite para substituir los componentes del tema por defecto por los suyos personalizados: +Puede usar los [aliases](https://vite.dev/config/shared-options.html#resolve-alias) Vite para substituir los componentes del tema por defecto por los suyos personalizados: ```ts import { fileURLToPath, URL } from 'node:url' diff --git a/docs/es/guide/getting-started.md b/docs/es/guide/getting-started.md index 10408445..9461c808 100644 --- a/docs/es/guide/getting-started.md +++ b/docs/es/guide/getting-started.md @@ -41,7 +41,7 @@ $ bun add -D vitepress@next ::: tip NOTA -VitePress es un paquete apenas para ESM. No use `require()` para importarlo, y asegurese de que el `package.json` más cercano contiene `"type": "module"`, o cambie la extensión de archivo de sus archivos relevantes como `.vitepress/config.js` a `.mjs`/`.mts`. Consulte la [Guía de resolución de problemas Vite](http://vitejs.dev/guide/troubleshooting.html#this-package-is-esm-only) para más detalles. Además de eso, dentro de contextos de JavaScript asíncronos, puede usar `await import('vitepress')`. +VitePress es un paquete apenas para ESM. No use `require()` para importarlo, y asegurese de que el `package.json` más cercano contiene `"type": "module"`, o cambie la extensión de archivo de sus archivos relevantes como `.vitepress/config.js` a `.mjs`/`.mts`. Consulte la [Guía de resolución de problemas Vite](http://vite.dev/guide/troubleshooting.html#this-package-is-esm-only) para más detalles. Además de eso, dentro de contextos de JavaScript asíncronos, puede usar `await import('vitepress')`. ::: diff --git a/docs/es/guide/ssr-compat.md b/docs/es/guide/ssr-compat.md index 38021653..77ca3dac 100644 --- a/docs/es/guide/ssr-compat.md +++ b/docs/es/guide/ssr-compat.md @@ -39,7 +39,7 @@ onMounted(() => { ### Importación Condicional {#conditional-import} -También puede importar una dependencia condicionalmente utilizando la bandera `import.meta.env.SSR` (que forma parte de las [variables de entorno Vite](https://vitejs.dev/guide/env-and-mode.html#env-variables)): +También puede importar una dependencia condicionalmente utilizando la bandera `import.meta.env.SSR` (que forma parte de las [variables de entorno Vite](https://vite.dev/guide/env-and-mode.html#env-variables)): ```js if (!import.meta.env.SSR) { diff --git a/docs/es/guide/using-vue.md b/docs/es/guide/using-vue.md index 2682acfd..7d6fe5a2 100644 --- a/docs/es/guide/using-vue.md +++ b/docs/es/guide/using-vue.md @@ -204,7 +204,7 @@ Observe que esto puede impedir que ciertos tokens sean realzados correctamente. ## Usando Preprocesadores CSS {#using-css-pre-processors} -VitePress poseé [soporte embutido](https://vitejs.dev/guide/features.html#css-pre-processors) para preprocesadores CSS: archivos `.scss`, `.sass`, `.less`, `.styl` e `.stylus`. No es necesario instalar plugins específicos de Vite para ellos, pero el propio preprocesados correspondiente debe ser instalado: +VitePress poseé [soporte embutido](https://vite.dev/guide/features.html#css-pre-processors) para preprocesadores CSS: archivos `.scss`, `.sass`, `.less`, `.styl` e `.stylus`. No es necesario instalar plugins específicos de Vite para ellos, pero el propio preprocesados correspondiente debe ser instalado: ``` # .scss e .sass diff --git a/docs/es/guide/what-is-vitepress.md b/docs/es/guide/what-is-vitepress.md index 22c4b946..0a57e85e 100644 --- a/docs/es/guide/what-is-vitepress.md +++ b/docs/es/guide/what-is-vitepress.md @@ -16,7 +16,7 @@ VitePress es un [Generador de Sitios Estáticos](https://en.wikipedia.org/wiki/S - **Documentación** - VitePress incluye un tema por defecto diseñado para documentación técnica. Este tema es el que se utiliza en la página que estás leyendo ahora, así como en la documentación de [Vite](https://vitejs.dev/), [Rollup](https://rollupjs.org/), [Pinia](https://pinia.vuejs.org/), [VueUse](https://vueuse.org/), [Vitest](https://vitest.dev/), [D3](https://d3js.org/), [UnoCSS](https://unocss.dev/), [Iconify](https://iconify.design/) y [muchos otros](https://github.com/search?q=/%22vitepress%22:+/+path:/(?:package%7Cdeno)%5C.jsonc?$/+NOT+is:fork+NOT+is:archived&type=code). + VitePress incluye un tema por defecto diseñado para documentación técnica. Este tema es el que se utiliza en la página que estás leyendo ahora, así como en la documentación de [Vite](https://vite.dev/), [Rollup](https://rollupjs.org/), [Pinia](https://pinia.vuejs.org/), [VueUse](https://vueuse.org/), [Vitest](https://vitest.dev/), [D3](https://d3js.org/), [UnoCSS](https://unocss.dev/), [Iconify](https://iconify.design/) y [muchos otros](https://github.com/search?q=/%22vitepress%22:+/+path:/(?:package%7Cdeno)%5C.jsonc?$/+NOT+is:fork+NOT+is:archived&type=code). La [documentación oficial Vue.js](https://vuejs.org/) también está basada en VitePress, pero utiliza un tema personalizado compartido entre varias traducciones. @@ -30,7 +30,7 @@ VitePress es un [Generador de Sitios Estáticos](https://en.wikipedia.org/wiki/S VitePress busca ofrecer una excelente Experiencia de Desarrollador (DX) al trabajar con contenido Markdown. -- **[Con tecnología Vite:](https://vitejs.dev/)** inicio instantáneo del servidor, con los cambios reflejados al instante (<100ms) sin recargar la página. +- **[Con tecnología Vite:](https://vite.dev/)** inicio instantáneo del servidor, con los cambios reflejados al instante (<100ms) sin recargar la página. - **[Extensiones Markdown Integradas:](./markdown)** Frontmatter, tablas, destaque de sintaxis... tú decides. Específicamente, VitePress proporciona muchos recursos para trabajar con bloques de código, tornándolo ideal para documentación altamente técnica. diff --git a/docs/es/reference/site-config.md b/docs/es/reference/site-config.md index 21792600..3884b45d 100644 --- a/docs/es/reference/site-config.md +++ b/docs/es/reference/site-config.md @@ -430,7 +430,7 @@ export default { - Tipo: `string` - Predeterminado: `./.vitepress/cache` -El directorio para los archivos de caché, en relación con el [raiz del proyecto](../guide/routing#root-and-source-directory). Vea también: [cacheDir](https://vitejs.dev/config/shared-options.html#cachedir). +El directorio para los archivos de caché, en relación con el [raiz del proyecto](../guide/routing#root-and-source-directory). Vea también: [cacheDir](https://vite.dev/config/shared-options.html#cachedir). ```ts export default { @@ -525,7 +525,7 @@ Consulte la [declaración de tipo y jsdocs](https://github.com/vuejs/vitepress/b - Tipo: `import('vite').UserConfig` -Pase la [Configuración Vite](https://vitejs.dev/config/) sin procesar al servidor interno / empaquetador Vite. +Pase la [Configuración Vite](https://vite.dev/config/) sin procesar al servidor interno / empaquetador Vite. ```js export default { diff --git a/docs/fa/guide/asset-handling.md b/docs/fa/guide/asset-handling.md index cda20c7d..ade26214 100644 --- a/docs/fa/guide/asset-handling.md +++ b/docs/fa/guide/asset-handling.md @@ -6,7 +6,7 @@ description: نحوه ارجاع و مدیریت منابع ایستا مانن ## ارجاع به منابع ایستا {#referencing-static-assets} -تمام فایل‌های Markdown به کامپوننت‌های Vue تبدیل و توسط [Vite](https://vitejs.dev/guide/assets.html) پردازش می‌شوند. شما می‌توانید، **و باید**، هر نوع دارایی را با استفاده از URL‌های نسبی مرجع قرار دهید: +تمام فایل‌های Markdown به کامپوننت‌های Vue تبدیل و توسط [Vite](https://vite.dev/guide/assets.html) پردازش می‌شوند. شما می‌توانید، **و باید**، هر نوع دارایی را با استفاده از URL‌های نسبی مرجع قرار دهید: ```md ![تصویر](./image.png) diff --git a/docs/fa/guide/extending-default-theme.md b/docs/fa/guide/extending-default-theme.md index 76418ed2..ccea29a6 100644 --- a/docs/fa/guide/extending-default-theme.md +++ b/docs/fa/guide/extending-default-theme.md @@ -119,7 +119,7 @@ export default { } satisfies Theme ``` -از آنجا که از Vite استفاده می‌کنیم، می‌توانید از ویژگی [import glob](https://vitejs.dev/guide/features.html#glob-import) در Vite برای خودکار ثبت یک پوشه از مولفه‌ها استفاده کنید. +از آنجا که از Vite استفاده می‌کنیم، می‌توانید از ویژگی [import glob](https://vite.dev/guide/features.html#glob-import) در Vite برای خودکار ثبت یک پوشه از مولفه‌ها استفاده کنید. ## slot ‌های طرح {#layout-slots} @@ -311,7 +311,7 @@ provide('toggle-appearance', async ({ clientX: x, clientY: y }: MouseEvent) => { ## جایگزینی کامپوننت‌های داخلی {#overriding-internal-components} -شما می‌توانید با استفاده از [alias های Vite](https://vitejs.dev/config/shared-options.html#resolve-alias)، کامپوننت‌های تم پیش‌فرض را با کامپوننت‌های سفارشی خود جایگزین کنید: +شما می‌توانید با استفاده از [alias های Vite](https://vite.dev/config/shared-options.html#resolve-alias)، کامپوننت‌های تم پیش‌فرض را با کامپوننت‌های سفارشی خود جایگزین کنید: ```ts import { fileURLToPath, URL } from 'node:url' diff --git a/docs/fa/guide/getting-started.md b/docs/fa/guide/getting-started.md index d9d7d660..97775e0d 100644 --- a/docs/fa/guide/getting-started.md +++ b/docs/fa/guide/getting-started.md @@ -41,7 +41,7 @@ $ bun add -D vitepress@next ::: tip نکته -ویت‌پرس یک بسته فقط ESM است. از `require()` برای وارد کردن آن استفاده نکنید و اطمینان حاصل کنید که نزدیک‌ترین `package.json` شما شامل `"type": "module"` است، یا پسوند فایل‌های مربوطه خود مانند `.vitepress/config.js` را به `.mjs`/`.mts` تغییر دهید. برای جزئیات بیشتر به [راهنمای عیب‌یابی Vite](http://vitejs.dev/guide/troubleshooting.html#this-package-is-esm-only) مراجعه کنید. همچنین، در زمینه‌های async CJS می‌توانید از `await import('vitepress')` استفاده کنید. +ویت‌پرس یک بسته فقط ESM است. از `require()` برای وارد کردن آن استفاده نکنید و اطمینان حاصل کنید که نزدیک‌ترین `package.json` شما شامل `"type": "module"` است، یا پسوند فایل‌های مربوطه خود مانند `.vitepress/config.js` را به `.mjs`/`.mts` تغییر دهید. برای جزئیات بیشتر به [راهنمای عیب‌یابی Vite](http://vite.dev/guide/troubleshooting.html#this-package-is-esm-only) مراجعه کنید. همچنین، در زمینه‌های async CJS می‌توانید از `await import('vitepress')` استفاده کنید. ::: diff --git a/docs/fa/guide/ssr-compat.md b/docs/fa/guide/ssr-compat.md index 75e698a7..76f91f90 100644 --- a/docs/fa/guide/ssr-compat.md +++ b/docs/fa/guide/ssr-compat.md @@ -39,7 +39,7 @@ onMounted(() => { ### وارد کردن شرطی {#conditional-import} -می‌توانید همچنین وابستگی را با استفاده از `import.meta.env.SSR` (قسمتی از [متغیرهای env Vite](https://vitejs.dev/guide/env-and-mode.html#env-variables)) به شرط وارد کنید: +می‌توانید همچنین وابستگی را با استفاده از `import.meta.env.SSR` (قسمتی از [متغیرهای env Vite](https://vite.dev/guide/env-and-mode.html#env-variables)) به شرط وارد کنید: ```js if (!import.meta.env.SSR) { diff --git a/docs/fa/guide/using-vue.md b/docs/fa/guide/using-vue.md index 1b618f60..d0b25e46 100644 --- a/docs/fa/guide/using-vue.md +++ b/docs/fa/guide/using-vue.md @@ -205,7 +205,7 @@ Hello {{ 1 + 1 }} ## استفاده از پیش‌پردازنده‌های CSS {#using-css-pre-processors} -ویت‌پرس از [پشتیبانی داخلی](https://vitejs.dev/guide/features.html#css-pre-processors) برای پیش‌پردازنده‌های CSS مانند فایل‌های `.scss`، `.sass`، `.less`، `.styl` و `.stylus` پشتیبانی می‌کند. برای استفاده از آنها نیازی به نصب پلاگین‌های خاص Vite نیست، اما خود پیش‌پردازنده مربوطه باید نصب شده باشد: +ویت‌پرس از [پشتیبانی داخلی](https://vite.dev/guide/features.html#css-pre-processors) برای پیش‌پردازنده‌های CSS مانند فایل‌های `.scss`، `.sass`، `.less`، `.styl` و `.stylus` پشتیبانی می‌کند. برای استفاده از آنها نیازی به نصب پلاگین‌های خاص Vite نیست، اما خود پیش‌پردازنده مربوطه باید نصب شده باشد: ``` # .scss و .sass diff --git a/docs/fa/guide/what-is-vitepress.md b/docs/fa/guide/what-is-vitepress.md index 44fde866..6ddb879b 100644 --- a/docs/fa/guide/what-is-vitepress.md +++ b/docs/fa/guide/what-is-vitepress.md @@ -16,7 +16,7 @@ description: ویت‌پرس یک تولیدکننده سایت ایستا بر - **مستندسازی** - ویت‌پرس با یک تم پیش‌فرض طراحی شده برای مستندات فنی ارائه می‌شود. این صفحه‌ای که اکنون در حال خواندن آن هستید و همچنین مستندات [Vite](https://vitejs.dev/)، [Rollup](https://rollupjs.org/)، [Pinia](https://pinia.vuejs.org/)، [VueUse](https://vueuse.org/)، [Vitest](https://vitest.dev/)، [D3](https://d3js.org/)، [UnoCSS](https://unocss.dev/)، [Iconify](https://iconify.design/) و [بسیاری دیگر](https://github.com/search?q=/%22vitepress%22:+/+path:/(?:package%7Cdeno)%5C.jsonc?$/+NOT+is:fork+NOT+is:archived&type=code) با استفاده از ویت‌پرس ساخته شده‌اند. + ویت‌پرس با یک تم پیش‌فرض طراحی شده برای مستندات فنی ارائه می‌شود. این صفحه‌ای که اکنون در حال خواندن آن هستید و همچنین مستندات [Vite](https://vite.dev/)، [Rollup](https://rollupjs.org/)، [Pinia](https://pinia.vuejs.org/)، [VueUse](https://vueuse.org/)، [Vitest](https://vitest.dev/)، [D3](https://d3js.org/)، [UnoCSS](https://unocss.dev/)، [Iconify](https://iconify.design/) و [بسیاری دیگر](https://github.com/search?q=/%22vitepress%22:+/+path:/(?:package%7Cdeno)%5C.jsonc?$/+NOT+is:fork+NOT+is:archived&type=code) با استفاده از ویت‌پرس ساخته شده‌اند. [مستندات رسمی Vue.js](https://vuejs.org/) نیز بر پایه ویت‌پرس ساخته شده است، اما از یک تم سفارشی که بین چندین ترجمه مشترک است استفاده می‌کند. @@ -30,7 +30,7 @@ description: ویت‌پرس یک تولیدکننده سایت ایستا بر ویت‌پرس هدف ارائه یک تجربه عالی برای توسعه دهنده (DX) هنگام کار با محتوای Markdown را دارد. -- **[قدرت گرفته از Vite:](https://vitejs.dev/)** شروع سرور فوری، با بازتاب ویرایش‌ها به صورت آنی (<100ms) بدون بارگذاری مجدد صفحه. +- **[قدرت گرفته از Vite:](https://vite.dev/)** شروع سرور فوری، با بازتاب ویرایش‌ها به صورت آنی (<100ms) بدون بارگذاری مجدد صفحه. - **[افزونه‌های داخلی Markdown:](./markdown)** استفاده از Frontmatter، جداول، syntax highlighting... هرچه که بخواهید. ویت‌پرس به ویژه ویژگی‌های پیشرفته زیادی برای کار با بلوک‌های کد فراهم می‌کند، که آن را برای مستندات فنی بسیار مناسب می‌کند. diff --git a/docs/fa/reference/site-config.md b/docs/fa/reference/site-config.md index b0dbaea1..82a3c55b 100644 --- a/docs/fa/reference/site-config.md +++ b/docs/fa/reference/site-config.md @@ -432,7 +432,7 @@ export default { - نوع: `string` - پیش‌فرض: `./.vitepress/cache` -دایرکتوری برای فایل‌های کش، نسبت به [ریشه پروژه](../guide/routing#root-and-source-directory). همچنین ببینید: [cacheDir](https://vitejs.dev/config/shared-options.html#cachedir). +دایرکتوری برای فایل‌های کش، نسبت به [ریشه پروژه](../guide/routing#root-and-source-directory). همچنین ببینید: [cacheDir](https://vite.dev/config/shared-options.html#cachedir). ```ts export default { @@ -529,7 +529,7 @@ export default { - نوع: `import('vite').UserConfig` -پیکربندی خام [Vite Config](https://vitejs.dev/config/) را به سرور توسعه داخلی / بسته‌بند Vite ارسال کنید. +پیکربندی خام [Vite Config](https://vite.dev/config/) را به سرور توسعه داخلی / بسته‌بند Vite ارسال کنید. ```js export default { diff --git a/docs/ja/guide/asset-handling.md b/docs/ja/guide/asset-handling.md index 319963ca..42ae9d61 100644 --- a/docs/ja/guide/asset-handling.md +++ b/docs/ja/guide/asset-handling.md @@ -6,7 +6,7 @@ description: VitePressで画像、メディア、フォントなどの静的ア ## 静的アセットの参照 {#referencing-static-assets} -すべての Markdown ファイルは Vue コンポーネントにコンパイルされ、[Vite](https://vitejs.dev/guide/assets.html) によって処理されます。Markdown 内では、相対 URL を使ってアセットを参照することが **推奨されます**。 +すべての Markdown ファイルは Vue コンポーネントにコンパイルされ、[Vite](https://vite.dev/guide/assets.html) によって処理されます。Markdown 内では、相対 URL を使ってアセットを参照することが **推奨されます**。 ```md ![画像](./image.png) diff --git a/docs/ja/guide/extending-default-theme.md b/docs/ja/guide/extending-default-theme.md index 8e26243c..2abe4d84 100644 --- a/docs/ja/guide/extending-default-theme.md +++ b/docs/ja/guide/extending-default-theme.md @@ -122,7 +122,7 @@ export default { } satisfies Theme ``` -Vite を使っているため、Vite の [glob import 機能](https://vitejs.dev/guide/features.html#glob-import) を利用してディレクトリ内のコンポーネントを自動登録することもできます。 +Vite を使っているため、Vite の [glob import 機能](https://vite.dev/guide/features.html#glob-import) を利用してディレクトリ内のコンポーネントを自動登録することもできます。 ## レイアウトスロット {#layout-slots} @@ -311,7 +311,7 @@ provide('toggle-appearance', async ({ clientX: x, clientY: y }: MouseEvent) => { ## 内部コンポーネントの置き換え {#overriding-internal-components} -Vite の [エイリアス](https://vitejs.dev/config/shared-options.html#resolve-alias) を使って、デフォルトテーマのコンポーネントを独自のものに置き換えられます。 +Vite の [エイリアス](https://vite.dev/config/shared-options.html#resolve-alias) を使って、デフォルトテーマのコンポーネントを独自のものに置き換えられます。 ```ts import { fileURLToPath, URL } from 'node:url' diff --git a/docs/ja/guide/getting-started.md b/docs/ja/guide/getting-started.md index 5e164aa1..91a85076 100644 --- a/docs/ja/guide/getting-started.md +++ b/docs/ja/guide/getting-started.md @@ -40,7 +40,7 @@ $ bun add -D vitepress@next ::: ::: tip 注意 -VitePress は ESM 専用パッケージです。`require()` を使ってインポートせず、最も近い `package.json` に `"type": "module"` を含めるか、`.vitepress/config.js` を `.mjs` / `.mts` に変更してください。詳しくは [Vite のトラブルシューティングガイド](http://vitejs.dev/guide/troubleshooting.html#this-package-is-esm-only) を参照してください。また、非同期 CJS コンテキスト内では `await import('vitepress')` を使用できます。 +VitePress は ESM 専用パッケージです。`require()` を使ってインポートせず、最も近い `package.json` に `"type": "module"` を含めるか、`.vitepress/config.js` を `.mjs` / `.mts` に変更してください。詳しくは [Vite のトラブルシューティングガイド](http://vite.dev/guide/troubleshooting.html#this-package-is-esm-only) を参照してください。また、非同期 CJS コンテキスト内では `await import('vitepress')` を使用できます。 ::: ### セットアップウィザード {#setup-wizard} diff --git a/docs/ja/guide/ssr-compat.md b/docs/ja/guide/ssr-compat.md index ec94a4a4..01a58c38 100644 --- a/docs/ja/guide/ssr-compat.md +++ b/docs/ja/guide/ssr-compat.md @@ -39,7 +39,7 @@ onMounted(() => { ### 条件付きインポート {#conditional-import} -[`import.meta.env.SSR`](https://vitejs.dev/guide/env-and-mode.html#env-variables) フラグ(Vite の環境変数の一部)を使って、依存関係を条件付きでインポートすることもできます。 +[`import.meta.env.SSR`](https://vite.dev/guide/env-and-mode.html#env-variables) フラグ(Vite の環境変数の一部)を使って、依存関係を条件付きでインポートすることもできます。 ```js if (!import.meta.env.SSR) { diff --git a/docs/ja/guide/using-vue.md b/docs/ja/guide/using-vue.md index 9cbc7608..cdbbb01f 100644 --- a/docs/ja/guide/using-vue.md +++ b/docs/ja/guide/using-vue.md @@ -203,7 +203,7 @@ Hello {{ 1 + 1 }} ## CSS プリプロセッサの利用 {#using-css-pre-processors} -VitePress は CSS プリプロセッサ(`.scss`、`.sass`、`.less`、`.styl`、`.stylus`)を[標準サポート](https://vitejs.dev/guide/features.html#css-pre-processors)しています。Vite 固有のプラグインは不要ですが、各プリプロセッサ本体のインストールは必要です。 +VitePress は CSS プリプロセッサ(`.scss`、`.sass`、`.less`、`.styl`、`.stylus`)を[標準サポート](https://vite.dev/guide/features.html#css-pre-processors)しています。Vite 固有のプラグインは不要ですが、各プリプロセッサ本体のインストールは必要です。 ``` # .scss / .sass diff --git a/docs/ja/guide/what-is-vitepress.md b/docs/ja/guide/what-is-vitepress.md index 1920adaf..0c9e9fc0 100644 --- a/docs/ja/guide/what-is-vitepress.md +++ b/docs/ja/guide/what-is-vitepress.md @@ -16,7 +16,7 @@ VitePress は、高速でコンテンツ中心の Web サイトを構築する - **ドキュメント** - VitePress には技術ドキュメント向けに設計されたデフォルトテーマが同梱されています。今あなたが読んでいるこのページのほか、[Vite](https://vitejs.dev/)、[Rollup](https://rollupjs.org/)、[Pinia](https://pinia.vuejs.org/)、[VueUse](https://vueuse.org/)、[Vitest](https://vitest.dev/)、[D3](https://d3js.org/)、[UnoCSS](https://unocss.dev/)、[Iconify](https://iconify.design/) など、[まだまだたくさん](https://github.com/search?q=/%22vitepress%22:+/+path:/(?:package%7Cdeno)%5C.jsonc?$/+NOT+is:fork+NOT+is:archived&type=code)のドキュメントサイトで使われています。 + VitePress には技術ドキュメント向けに設計されたデフォルトテーマが同梱されています。今あなたが読んでいるこのページのほか、[Vite](https://vite.dev/)、[Rollup](https://rollupjs.org/)、[Pinia](https://pinia.vuejs.org/)、[VueUse](https://vueuse.org/)、[Vitest](https://vitest.dev/)、[D3](https://d3js.org/)、[UnoCSS](https://unocss.dev/)、[Iconify](https://iconify.design/) など、[まだまだたくさん](https://github.com/search?q=/%22vitepress%22:+/+path:/(?:package%7Cdeno)%5C.jsonc?$/+NOT+is:fork+NOT+is:archived&type=code)のドキュメントサイトで使われています。 [公式の Vue.js ドキュメント](https://vuejs.org/) も VitePress をベースにしています(複数言語で共有されるカスタムテーマを使用)。 @@ -30,7 +30,7 @@ VitePress は、高速でコンテンツ中心の Web サイトを構築する VitePress は、Markdown コンテンツを扱う際の優れた開発体験(DX)を目指しています。 -- **[Vite 駆動](https://vitejs.dev/)**:即時サーバー起動、編集はページリロードなしで常に瞬時(<100ms)に反映。 +- **[Vite 駆動](https://vite.dev/)**:即時サーバー起動、編集はページリロードなしで常に瞬時(<100ms)に反映。 - **[ビルトインの Markdown 拡張](./markdown)**:Frontmatter、表、シンタックスハイライト…必要なものはひと通り。特にコードブロック周りの機能が充実しており、高度な技術ドキュメントに最適です。 diff --git a/docs/ja/reference/site-config.md b/docs/ja/reference/site-config.md index 5f23ec71..a8e7f04b 100644 --- a/docs/ja/reference/site-config.md +++ b/docs/ja/reference/site-config.md @@ -430,7 +430,7 @@ export default { - 型: `string` - 既定値: `./.vitepress/cache` -キャッシュファイル用ディレクトリ([プロジェクトルート](../guide/routing#root-and-source-directory) からの相対パス)。参考: [cacheDir](https://vitejs.dev/config/shared-options.html#cachedir) +キャッシュファイル用ディレクトリ([プロジェクトルート](../guide/routing#root-and-source-directory) からの相対パス)。参考: [cacheDir](https://vite.dev/config/shared-options.html#cachedir) ```ts export default { @@ -527,7 +527,7 @@ export default { - 型: `import('vite').UserConfig` -内部の Vite 開発サーバ/バンドラへ生の [Vite Config](https://vitejs.dev/config/) を渡します。 +内部の Vite 開発サーバ/バンドラへ生の [Vite Config](https://vite.dev/config/) を渡します。 ```js export default { diff --git a/docs/ko/guide/asset-handling.md b/docs/ko/guide/asset-handling.md index 5d7a9bbb..3b9efb02 100644 --- a/docs/ko/guide/asset-handling.md +++ b/docs/ko/guide/asset-handling.md @@ -6,7 +6,7 @@ description: VitePress에서 이미지, 미디어, 글꼴 등 정적 에셋을 ## 정적 에셋 참조하기 {#referencing-static-assets} -모든 마크다운 파일은 Vue 컴포넌트로 컴파일되어 [Vite](https://vitejs.dev/guide/assets.html)에 의해 처리됩니다. 모든 에셋은 상대 URL을 사용하여 참조할 수 있으며, **참조해야 합니다**: +모든 마크다운 파일은 Vue 컴포넌트로 컴파일되어 [Vite](https://vite.dev/guide/assets.html)에 의해 처리됩니다. 모든 에셋은 상대 URL을 사용하여 참조할 수 있으며, **참조해야 합니다**: ```md ![이미지](./image.png) diff --git a/docs/ko/guide/extending-default-theme.md b/docs/ko/guide/extending-default-theme.md index e87bfa1a..2c450b8b 100644 --- a/docs/ko/guide/extending-default-theme.md +++ b/docs/ko/guide/extending-default-theme.md @@ -119,7 +119,7 @@ export default { } satisfies Theme ``` -Vite를 사용하므로, Vite의 [glob import 기능](https://vitejs.dev/guide/features.html#glob-import)을 활용하여 컴포넌트 디렉터리를 자동으로 등록할 수 있습니다. +Vite를 사용하므로, Vite의 [glob import 기능](https://vite.dev/guide/features.html#glob-import)을 활용하여 컴포넌트 디렉터리를 자동으로 등록할 수 있습니다. ## 레이아웃 슬롯 {#layout-slots} @@ -309,7 +309,7 @@ provide('toggle-appearance', async ({ clientX: x, clientY: y }: MouseEvent) => { ## 내부 컴포넌트 재정의하기 {#overriding-internal-components} -Vite의 [별칭](https://vitejs.dev/config/shared-options.html#resolve-alias)을 사용하여 기본 테마 컴포넌트를 커스텀 컴포넌트로 대체할 수 있습니다: +Vite의 [별칭](https://vite.dev/config/shared-options.html#resolve-alias)을 사용하여 기본 테마 컴포넌트를 커스텀 컴포넌트로 대체할 수 있습니다: ```ts import { fileURLToPath, URL } from 'node:url' diff --git a/docs/ko/guide/getting-started.md b/docs/ko/guide/getting-started.md index ca6e743b..807dca71 100644 --- a/docs/ko/guide/getting-started.md +++ b/docs/ko/guide/getting-started.md @@ -41,7 +41,7 @@ $ bun add -D vitepress@next ::: tip 참고 -VitePress는 ESM 전용 패키지입니다. `require()`를 사용하여 가져오지 마시고, `package.json`에 `"type": "module"`이 포함되어 있는지 확인하거나, 관련 파일(예: `.vitepress/config.js`)의 확장자를 `.mjs`/`.mts`로 변경하세요. 자세한 내용은 [Vite 문제 해결 가이드](http://vitejs.dev/ko/guide/troubleshooting.html#this-package-is-esm-only)를 참고하세요. 또한, 비동기 CJS 컨텍스트에서는 `await import('vitepress')`를 사용할 수 있습니다. +VitePress는 ESM 전용 패키지입니다. `require()`를 사용하여 가져오지 마시고, `package.json`에 `"type": "module"`이 포함되어 있는지 확인하거나, 관련 파일(예: `.vitepress/config.js`)의 확장자를 `.mjs`/`.mts`로 변경하세요. 자세한 내용은 [Vite 문제 해결 가이드](http://vite.dev/ko/guide/troubleshooting.html#this-package-is-esm-only)를 참고하세요. 또한, 비동기 CJS 컨텍스트에서는 `await import('vitepress')`를 사용할 수 있습니다. ::: diff --git a/docs/ko/guide/ssr-compat.md b/docs/ko/guide/ssr-compat.md index 9e58ec18..a2e9cc63 100644 --- a/docs/ko/guide/ssr-compat.md +++ b/docs/ko/guide/ssr-compat.md @@ -39,7 +39,7 @@ onMounted(() => { ### 조건부 가져오기 {#conditional-import} -`import.meta.env.SSR` 플래그([Vite 환경 변수](https://vitejs.dev/guide/env-and-mode.html#env-variables)의 일부)를 사용하여 종속성을 조건부로 "import" 할 수도 있습니다: +`import.meta.env.SSR` 플래그([Vite 환경 변수](https://vite.dev/guide/env-and-mode.html#env-variables)의 일부)를 사용하여 종속성을 조건부로 "import" 할 수도 있습니다: ```js if (!import.meta.env.SSR) { diff --git a/docs/ko/guide/using-vue.md b/docs/ko/guide/using-vue.md index 9f595b7f..5c93dabc 100644 --- a/docs/ko/guide/using-vue.md +++ b/docs/ko/guide/using-vue.md @@ -204,7 +204,7 @@ Vue 보간 문법을 회피하려면, `` 또는 다른 엘리먼트에 `v- ## CSS 전처리기 사용하기 {#using-css-pre-processors} -VitePress는 CSS 전처리기인 `.scss`, `.sass`, `.less`, `.styl`, `.stylus` 파일에 대해 [기본 지원](https://vitejs.dev/guide/features.html#css-pre-processors)을 제공합니다. 이를 위해 Vite 전용 플러그인을 설치할 필요는 없지만, 해당 전처리기 자체는 설치해야 합니다: +VitePress는 CSS 전처리기인 `.scss`, `.sass`, `.less`, `.styl`, `.stylus` 파일에 대해 [기본 지원](https://vite.dev/guide/features.html#css-pre-processors)을 제공합니다. 이를 위해 Vite 전용 플러그인을 설치할 필요는 없지만, 해당 전처리기 자체는 설치해야 합니다: ``` # .scss 및 .sass diff --git a/docs/ko/guide/what-is-vitepress.md b/docs/ko/guide/what-is-vitepress.md index 2c2cdaf2..20e23725 100644 --- a/docs/ko/guide/what-is-vitepress.md +++ b/docs/ko/guide/what-is-vitepress.md @@ -16,7 +16,7 @@ VitePress는 빠르고 컨텐츠 중심의 웹사이트를 구축하기 위해 - **문서화** - VitePress는 기술 문서를 위해 설계된 기본 테마가 함께 제공됩니다. 지금 읽고 있는 이 페이지와 [Vite](https://vitejs.dev/), [Rollup](https://rollupjs.org/), [Pinia](https://pinia.vuejs.org/), [VueUse](https://vueuse.org/), [Vitest](https://vitest.dev/), [D3](https://d3js.org/), [UnoCSS](https://unocss.dev/), [Iconify](https://iconify.design/) 및 [다양한 프로젝트](https://github.com/search?q=/%22vitepress%22:+/+path:/(?:package%7Cdeno)%5C.jsonc?$/+NOT+is:fork+NOT+is:archived&type=code) 문서는 모두 이 테마를 기반으로 합니다. + VitePress는 기술 문서를 위해 설계된 기본 테마가 함께 제공됩니다. 지금 읽고 있는 이 페이지와 [Vite](https://vite.dev/), [Rollup](https://rollupjs.org/), [Pinia](https://pinia.vuejs.org/), [VueUse](https://vueuse.org/), [Vitest](https://vitest.dev/), [D3](https://d3js.org/), [UnoCSS](https://unocss.dev/), [Iconify](https://iconify.design/) 및 [다양한 프로젝트](https://github.com/search?q=/%22vitepress%22:+/+path:/(?:package%7Cdeno)%5C.jsonc?$/+NOT+is:fork+NOT+is:archived&type=code) 문서는 모두 이 테마를 기반으로 합니다. [Vue.js 공식 문서](https://vuejs.org/)도 VitePress 기반으로 되어 있으며, 여러 번역본에 걸쳐 공유되는 커스텀 테마를 사용합니다. @@ -30,7 +30,7 @@ VitePress는 빠르고 컨텐츠 중심의 웹사이트를 구축하기 위해 VitePress는 마크다운 컨텐츠를 다룰 때 훌륭한 개발자 경험(DX)을 제공하고자 합니다. -- **[Vite로 작동](https://vitejs.dev/)**: 즉각적인 서버 시작 가능, 페이지 새로고침 없이 즉시(<100ms) 수정 사항 반영. +- **[Vite로 작동](https://vite.dev/)**: 즉각적인 서버 시작 가능, 페이지 새로고침 없이 즉시(<100ms) 수정 사항 반영. - **[내장된 마크다운 확장 기능](./markdown)**: 서문, 표, 구문 강조 등 무엇이든 가능. 특히 VitePress는 코드 블록 작업을 위한 고급 기능을 많이 제공하여 기술적 문서에 이상적. diff --git a/docs/ko/reference/site-config.md b/docs/ko/reference/site-config.md index d5482754..53e94d52 100644 --- a/docs/ko/reference/site-config.md +++ b/docs/ko/reference/site-config.md @@ -430,7 +430,7 @@ export default { - 타입: `string` - 기본값: `./.vitepress/cache` -캐시 파일을 위한 디렉터리입니다. [프로젝트 루트](../guide/routing#root-and-source-directory)에 상대적입니다. [cacheDir](https://vitejs.dev/config/shared-options.html#cachedir)을 참고하세요. +캐시 파일을 위한 디렉터리입니다. [프로젝트 루트](../guide/routing#root-and-source-directory)에 상대적입니다. [cacheDir](https://vite.dev/config/shared-options.html#cachedir)을 참고하세요. ```ts export default { @@ -527,7 +527,7 @@ export default { - 타입: `import('vite').UserConfig` -내부 Vite 개발 서버/번들러에 직접 [Vite 구성](https://vitejs.dev/config/)을 전달합니다. +내부 Vite 개발 서버/번들러에 직접 [Vite 구성](https://vite.dev/config/)을 전달합니다. ```js export default { diff --git a/docs/pt/guide/asset-handling.md b/docs/pt/guide/asset-handling.md index f7b4a937..620beb49 100644 --- a/docs/pt/guide/asset-handling.md +++ b/docs/pt/guide/asset-handling.md @@ -6,7 +6,7 @@ description: Aprenda a referenciar e manipular ativos estáticos como imagens, m ## Referenciando Ativos Estáticos {#referencing-static-assets} -Todos os arquivos Markdown são compilados em componentes Vue e processados por [Vite](https://vitejs.dev/guide/assets.html). Você pode **e deve** referenciar quaisquer ativos usando URLs relativas: +Todos os arquivos Markdown são compilados em componentes Vue e processados por [Vite](https://vite.dev/guide/assets.html). Você pode **e deve** referenciar quaisquer ativos usando URLs relativas: ```md ![Uma imagem](./imagem.png) diff --git a/docs/pt/guide/extending-default-theme.md b/docs/pt/guide/extending-default-theme.md index 31527390..99db5b75 100644 --- a/docs/pt/guide/extending-default-theme.md +++ b/docs/pt/guide/extending-default-theme.md @@ -119,7 +119,7 @@ export default { } satisfies Theme ``` -Como estamos usando Vite, você também pode aproveitar a [funcionalidade de importação glob](https://vitejs.dev/guide/features.html#glob-import) do Vite para registrar automaticamente um diretório de componentes. +Como estamos usando Vite, você também pode aproveitar a [funcionalidade de importação glob](https://vite.dev/guide/features.html#glob-import) do Vite para registrar automaticamente um diretório de componentes. ## _Slots_ no Layout {#layout-slots} @@ -309,7 +309,7 @@ Em breve. ## Substituindo Componentes Internos {#overriding-internal-components} -Você pode usar os [aliases](https://vitejs.dev/config/shared-options.html#resolve-alias) Vite para substituir os componentes do tema padrão pelos seus personalizados: +Você pode usar os [aliases](https://vite.dev/config/shared-options.html#resolve-alias) Vite para substituir os componentes do tema padrão pelos seus personalizados: ```ts import { fileURLToPath, URL } from 'node:url' diff --git a/docs/pt/guide/getting-started.md b/docs/pt/guide/getting-started.md index 056626ff..5f083143 100644 --- a/docs/pt/guide/getting-started.md +++ b/docs/pt/guide/getting-started.md @@ -41,7 +41,7 @@ $ bun add -D vitepress@next ::: tip NOTA -VitePress é um pacote apenas para ESM. Não use `require()` para importá-lo, e certifique de que o `package.json` mais próximo contém `"type": "module"`, ou mude a extensão do arquivo de seus arquivos releavantes como `.vitepress/config.js` para `.mjs`/`.mts`. Refira-se ao [Guia de resolução de problemas Vite](http://vitejs.dev/guide/troubleshooting.html#this-package-is-esm-only) para mais detalhes. Além disso, dentro de contextos de JavaScript comum assíncronos, você pode usar `await import('vitepress')`. +VitePress é um pacote apenas para ESM. Não use `require()` para importá-lo, e certifique de que o `package.json` mais próximo contém `"type": "module"`, ou mude a extensão do arquivo de seus arquivos releavantes como `.vitepress/config.js` para `.mjs`/`.mts`. Refira-se ao [Guia de resolução de problemas Vite](http://vite.dev/guide/troubleshooting.html#this-package-is-esm-only) para mais detalhes. Além disso, dentro de contextos de JavaScript comum assíncronos, você pode usar `await import('vitepress')`. ::: diff --git a/docs/pt/guide/ssr-compat.md b/docs/pt/guide/ssr-compat.md index fcd36f38..ecd95d81 100644 --- a/docs/pt/guide/ssr-compat.md +++ b/docs/pt/guide/ssr-compat.md @@ -39,7 +39,7 @@ onMounted(() => { ### Importação Condicional {#conditional-import} -Você também pode importar condicionalmente uma dependência usando o sinalizador `import.meta.env.SSR` (parte das [variáveis de ambiente Vite](https://vitejs.dev/guide/env-and-mode.html#env-variables)): +Você também pode importar condicionalmente uma dependência usando o sinalizador `import.meta.env.SSR` (parte das [variáveis de ambiente Vite](https://vite.dev/guide/env-and-mode.html#env-variables)): ```js if (!import.meta.env.SSR) { diff --git a/docs/pt/guide/using-vue.md b/docs/pt/guide/using-vue.md index 5878bebc..d4fdd415 100644 --- a/docs/pt/guide/using-vue.md +++ b/docs/pt/guide/using-vue.md @@ -203,7 +203,7 @@ Observe que isso pode impedir que certos tokens sejam realçados corretamente. ## Usando Pré-processadores CSS {#using-css-pre-processors} -O VitePress possui [suporte embutido](https://vitejs.dev/guide/features.html#css-pre-processors) para pré-processadores CSS: arquivos `.scss`, `.sass`, `.less`, `.styl` e `.stylus`. Não é necessário instalar plugins específicos do Vite para eles, mas o próprio pré-processador correspondente deve ser instalado: +O VitePress possui [suporte embutido](https://vite.dev/guide/features.html#css-pre-processors) para pré-processadores CSS: arquivos `.scss`, `.sass`, `.less`, `.styl` e `.stylus`. Não é necessário instalar plugins específicos do Vite para eles, mas o próprio pré-processador correspondente deve ser instalado: ``` # .scss e .sass diff --git a/docs/pt/guide/what-is-vitepress.md b/docs/pt/guide/what-is-vitepress.md index 45b83db9..e11e7031 100644 --- a/docs/pt/guide/what-is-vitepress.md +++ b/docs/pt/guide/what-is-vitepress.md @@ -16,7 +16,7 @@ Quer apenas experimentar? Pule para o [Início Rápido](./getting-started). - **Documentação** - VitePress vem com um tema padrão projetado para documentação técnica. Ele alimenta esta página que você está lendo agora, juntamente com a documentação [Vite](https://vitejs.dev/), [Rollup](https://rollupjs.org/), [Pinia](https://pinia.vuejs.org/), [VueUse](https://vueuse.org/), [Vitest](https://vitest.dev/), [D3](https://d3js.org/), [UnoCSS](https://unocss.dev/), [Iconify](https://iconify.design/) e [muitos outros](https://github.com/search?q=/%22vitepress%22:+/+path:/(?:package%7Cdeno)%5C.jsonc?$/+NOT+is:fork+NOT+is:archived&type=code). + VitePress vem com um tema padrão projetado para documentação técnica. Ele alimenta esta página que você está lendo agora, juntamente com a documentação [Vite](https://vite.dev/), [Rollup](https://rollupjs.org/), [Pinia](https://pinia.vuejs.org/), [VueUse](https://vueuse.org/), [Vitest](https://vitest.dev/), [D3](https://d3js.org/), [UnoCSS](https://unocss.dev/), [Iconify](https://iconify.design/) e [muitos outros](https://github.com/search?q=/%22vitepress%22:+/+path:/(?:package%7Cdeno)%5C.jsonc?$/+NOT+is:fork+NOT+is:archived&type=code). A [documentação oficial Vue.js](https://vuejs.org/) também é baseada em VitePress, mas usa um tema personalizado compartilhado entre várias traduções. @@ -30,7 +30,7 @@ Quer apenas experimentar? Pule para o [Início Rápido](./getting-started). VitePress visa proporcionar excelente Experiência de Desenvolvedor (DX) ao trabalhar com conteúdo em Markdown. -- **[Alimentado por Vite:](https://vitejs.dev/)** inicialização instantânea do servidor, com edições sempre refletidas instantaneamente (<100ms) sem recarregamento de página. +- **[Alimentado por Vite:](https://vite.dev/)** inicialização instantânea do servidor, com edições sempre refletidas instantaneamente (<100ms) sem recarregamento de página. - **[Extensões Markdown Integradas:](./markdown)** Frontmatter, tabelas, destaque de sintaxe... você escolhe. Especificamente, VitePress fornece muitos recursos avançados para trabalhar com blocos de código, tornando-o ideal para documentação altamente técnica. diff --git a/docs/pt/reference/site-config.md b/docs/pt/reference/site-config.md index 88b639f3..d1125d1d 100644 --- a/docs/pt/reference/site-config.md +++ b/docs/pt/reference/site-config.md @@ -430,7 +430,7 @@ export default { - Tipo: `string` - Padrão: `./.vitepress/cache` -O diretório para arquivos de cache, relativo à [raiz do projeto](../guide/routing#root-and-source-directory). Veja também: [cacheDir](https://vitejs.dev/config/shared-options.html#cachedir). +O diretório para arquivos de cache, relativo à [raiz do projeto](../guide/routing#root-and-source-directory). Veja também: [cacheDir](https://vite.dev/config/shared-options.html#cachedir). ```ts export default { @@ -525,7 +525,7 @@ Verifique a [declaração de tipo e jsdocs](https://github.com/vuejs/vitepress/b - Tipo: `import('vite').UserConfig` -Passe a [Configuração Vite](https://vitejs.dev/config/) crua para o servidor interno / empacotador Vite. +Passe a [Configuração Vite](https://vite.dev/config/) crua para o servidor interno / empacotador Vite. ```js export default { diff --git a/docs/ru/guide/asset-handling.md b/docs/ru/guide/asset-handling.md index 692e2c97..fd1852a4 100644 --- a/docs/ru/guide/asset-handling.md +++ b/docs/ru/guide/asset-handling.md @@ -6,7 +6,7 @@ description: Узнайте, как ссылаться на статически ## Ссылки на статические ресурсы {#referencing-static-assets} -Все файлы Markdown компилируются в компоненты Vue и обрабатываются [Vite](https://vitejs.dev/guide/assets.html). Вы можете, **и должны**, ссылаться на любые ресурсы, используя относительные URL: +Все файлы Markdown компилируются в компоненты Vue и обрабатываются [Vite](https://vite.dev/guide/assets.html). Вы можете, **и должны**, ссылаться на любые ресурсы, используя относительные URL: ```md ![Изображение](./image.png) diff --git a/docs/ru/guide/extending-default-theme.md b/docs/ru/guide/extending-default-theme.md index c3883625..6b7c011a 100644 --- a/docs/ru/guide/extending-default-theme.md +++ b/docs/ru/guide/extending-default-theme.md @@ -120,7 +120,7 @@ export default { } satisfies Theme ``` -Поскольку мы используем Vite, можно применять [глобальную функцию импорта](https://vitejs.dev/guide/features.html#glob-import) Vite для автоматической регистрации каталога компонентов. +Поскольку мы используем Vite, можно применять [глобальную функцию импорта](https://vite.dev/guide/features.html#glob-import) Vite для автоматической регистрации каталога компонентов. ## Слоты макета {#layout-slots} @@ -310,7 +310,7 @@ provide('toggle-appearance', async ({ clientX: x, clientY: y }: MouseEvent) => { ## Переопределение внутренних компонентов {#overriding-internal-components} -Вы можете использовать [псевдонимы](https://vitejs.dev/config/shared-options.html#resolve-alias) Vite, чтобы заменить стандартные компоненты темы на свои собственные: +Вы можете использовать [псевдонимы](https://vite.dev/config/shared-options.html#resolve-alias) Vite, чтобы заменить стандартные компоненты темы на свои собственные: ```ts import { fileURLToPath, URL } from 'node:url' diff --git a/docs/ru/guide/getting-started.md b/docs/ru/guide/getting-started.md index e88ddc00..873ebafc 100644 --- a/docs/ru/guide/getting-started.md +++ b/docs/ru/guide/getting-started.md @@ -45,7 +45,7 @@ $ deno add -D vitepress@next ::: tip ПРИМЕЧАНИЕ -VitePress — это пакет, предназначенный только для ESM. Не используйте `require()` для импорта, и убедитесь, что ближайший `package.json` содержит `"type": "module"`, или измените расширение соответствующих файлов, например, `.vitepress/config.js` на `.mjs`/`.mts`. Более подробную информацию см. в [Руководстве по устранению неполадок Vite](https://vitejs.dev/guide/troubleshooting.html#this-package-is-esm-only). Кроме того, внутри асинхронных контекстов CJS можно использовать `await import('vitepress')` вместо этого. +VitePress — это пакет, предназначенный только для ESM. Не используйте `require()` для импорта, и убедитесь, что ближайший `package.json` содержит `"type": "module"`, или измените расширение соответствующих файлов, например, `.vitepress/config.js` на `.mjs`/`.mts`. Более подробную информацию см. в [Руководстве по устранению неполадок Vite](https://vite.dev/guide/troubleshooting.html#this-package-is-esm-only). Кроме того, внутри асинхронных контекстов CJS можно использовать `await import('vitepress')` вместо этого. ::: diff --git a/docs/ru/guide/ssr-compat.md b/docs/ru/guide/ssr-compat.md index 5473d368..42dc06ca 100644 --- a/docs/ru/guide/ssr-compat.md +++ b/docs/ru/guide/ssr-compat.md @@ -39,7 +39,7 @@ onMounted(() => { ### Условный импорт {#conditional-import} -Вы также можете условно импортировать зависимость с помощью флага `import.meta.env.SSR` (часть [env-переменных Vite](https://vitejs.dev/guide/env-and-mode.html#env-variables)): +Вы также можете условно импортировать зависимость с помощью флага `import.meta.env.SSR` (часть [env-переменных Vite](https://vite.dev/guide/env-and-mode.html#env-variables)): ```js if (!import.meta.env.SSR) { diff --git a/docs/ru/guide/using-vue.md b/docs/ru/guide/using-vue.md index f0e933b1..9650af4e 100644 --- a/docs/ru/guide/using-vue.md +++ b/docs/ru/guide/using-vue.md @@ -201,7 +201,7 @@ HTML, обёрнутый ``, будет отображаться как е ## Использование препроцессоров CSS {#using-css-pre-processors} -VitePress имеет [встроенную поддержку](https://vitejs.dev/guide/features.html#css-pre-processors) для препроцессоров CSS: файлы `.scss`, `.sass`, `.less`, `.styl` и `.stylus`. Для них не нужно устанавливать специфические для Vite плагины, но сам соответствующий препроцессор должен быть установлен: +VitePress имеет [встроенную поддержку](https://vite.dev/guide/features.html#css-pre-processors) для препроцессоров CSS: файлы `.scss`, `.sass`, `.less`, `.styl` и `.stylus`. Для них не нужно устанавливать специфические для Vite плагины, но сам соответствующий препроцессор должен быть установлен: ::: code-group diff --git a/docs/ru/guide/what-is-vitepress.md b/docs/ru/guide/what-is-vitepress.md index ea21140c..d70b1308 100644 --- a/docs/ru/guide/what-is-vitepress.md +++ b/docs/ru/guide/what-is-vitepress.md @@ -30,7 +30,7 @@ VitePress — это [Генератор статических сайтов](ht VitePress стремится обеспечить отличные возможности для разработчиков при работе с содержимым в формате Markdown. -- **[На базе Vite:](https://vitejs.dev/)** мгновенный запуск сервера, правки всегда отражаются мгновенно (<100 мс) без перезагрузки страницы. +- **[На базе Vite:](https://vite.dev/)** мгновенный запуск сервера, правки всегда отражаются мгновенно (<100 мс) без перезагрузки страницы. - **[Встроенные расширения Markdown:](./markdown)** Frontmatter, таблицы, подсветка синтаксиса... называйте как хотите. В частности, VitePress предоставляет множество расширенных возможностей для работы с блоками кода, что делает его идеальным для создания технической документации. diff --git a/docs/ru/reference/site-config.md b/docs/ru/reference/site-config.md index eff970c4..bc54a368 100644 --- a/docs/ru/reference/site-config.md +++ b/docs/ru/reference/site-config.md @@ -461,7 +461,7 @@ export default { - Тип: `string` - По умолчанию: `./.vitepress/cache` -Каталог для файлов кэша, относительно [корня проекта](../guide/routing#root-and-source-directory). См. также: [cacheDir](https://vitejs.dev/config/shared-options.html#cachedir). +Каталог для файлов кэша, относительно [корня проекта](../guide/routing#root-and-source-directory). См. также: [cacheDir](https://vite.dev/config/shared-options.html#cachedir). ```ts export default { @@ -560,7 +560,7 @@ export default { - Тип: `import('vite').UserConfig` -Передаёт необработанную [конфигурацию Vite](https://vitejs.dev/config/) внутреннему серверу разработки / сборщику Vite. +Передаёт необработанную [конфигурацию Vite](https://vite.dev/config/) внутреннему серверу разработки / сборщику Vite. ```js export default { diff --git a/docs/zh/guide/asset-handling.md b/docs/zh/guide/asset-handling.md index 2d0328dc..209a96d3 100644 --- a/docs/zh/guide/asset-handling.md +++ b/docs/zh/guide/asset-handling.md @@ -6,7 +6,7 @@ description: 了解如何在 VitePress 中引用和处理静态资源,如图 ## 引用静态资源 {#referencing-static-assets} -所有的 Markdown 文件都会被编译成 Vue 组件,并由 [Vite](https://cn.vitejs.dev/guide/assets.html) 处理。可以**并且应该**使用相对路径来引用资源: +所有的 Markdown 文件都会被编译成 Vue 组件,并由 [Vite](https://cn.vite.dev/guide/assets.html) 处理。可以**并且应该**使用相对路径来引用资源: ```md ![An image](./image.png) diff --git a/docs/zh/guide/extending-default-theme.md b/docs/zh/guide/extending-default-theme.md index 88488fa7..974fca81 100644 --- a/docs/zh/guide/extending-default-theme.md +++ b/docs/zh/guide/extending-default-theme.md @@ -119,7 +119,7 @@ export default { } satisfies Theme ``` -因为我们使用 Vite,还可以利用 Vite 的 [glob 导入功能](https://cn.vitejs.dev/guide/features.html#glob-import)来自动注册一个组件目录。 +因为我们使用 Vite,还可以利用 Vite 的 [glob 导入功能](https://cn.vite.dev/guide/features.html#glob-import)来自动注册一个组件目录。 ## 布局插槽 {#layout-slots} @@ -308,7 +308,7 @@ provide('toggle-appearance', async ({ clientX: x, clientY: y }: MouseEvent) => { ## 重写内部组件 {#overriding-internal-components} -可以使用 Vite 的 [aliases](https://vitejs.dev/config/shared-options.html#resolve-alias) 来用自定义组件替换默认主题的组件: +可以使用 Vite 的 [aliases](https://vite.dev/config/shared-options.html#resolve-alias) 来用自定义组件替换默认主题的组件: ```ts import { fileURLToPath, URL } from 'node:url' diff --git a/docs/zh/guide/getting-started.md b/docs/zh/guide/getting-started.md index 847c117a..1f4bf0c1 100644 --- a/docs/zh/guide/getting-started.md +++ b/docs/zh/guide/getting-started.md @@ -41,7 +41,7 @@ $ bun add -D vitepress@next ::: tip 注意 -VitePress 是仅 ESM 的软件包。不要使用 `require()` 导入它,并确保最新的 `package.json` 包含 `"type": "module"`,或者更改相关文件的文件扩展名,例如 `.vitepress/config.js` 到 `.mjs`/`.mts`。更多详情请参考 [Vite 故障排除指南](http://vitejs.dev/guide/troubleshooting.html#this-package-is-esm-only)。此外,在异步 CJS 上下文中,可以使用 `await import('vitepress')` 代替。 +VitePress 是仅 ESM 的软件包。不要使用 `require()` 导入它,并确保最新的 `package.json` 包含 `"type": "module"`,或者更改相关文件的文件扩展名,例如 `.vitepress/config.js` 到 `.mjs`/`.mts`。更多详情请参考 [Vite 故障排除指南](http://vite.dev/guide/troubleshooting.html#this-package-is-esm-only)。此外,在异步 CJS 上下文中,可以使用 `await import('vitepress')` 代替。 ::: diff --git a/docs/zh/guide/ssr-compat.md b/docs/zh/guide/ssr-compat.md index c4f4dfd8..16b567cc 100644 --- a/docs/zh/guide/ssr-compat.md +++ b/docs/zh/guide/ssr-compat.md @@ -39,7 +39,7 @@ onMounted(() => { ### 条件导入 {#conditional-import} -也可以使用 `import.meta.env.SSR` 标志 ([Vite 环境变量](https://cn.vitejs.dev/guide/env-and-mode.html#env-variables)的一部分) 来有条件地导入依赖项: +也可以使用 `import.meta.env.SSR` 标志 ([Vite 环境变量](https://cn.vite.dev/guide/env-and-mode.html#env-variables)的一部分) 来有条件地导入依赖项: ```js if (!import.meta.env.SSR) { diff --git a/docs/zh/guide/using-vue.md b/docs/zh/guide/using-vue.md index 6c378a8d..de868f39 100644 --- a/docs/zh/guide/using-vue.md +++ b/docs/zh/guide/using-vue.md @@ -204,7 +204,7 @@ Hello {{ 1 + 1 }} ## 使用 CSS 预处理器 {#using-css-pre-processors} -VitePress [内置支持](https://cn.vitejs.dev/guide/features.html#css-pre-processors) CSS 预处理器:`.scss`、`.sass`、.`less`、`.styl` 和 `.stylus` 文件。无需为它们安装 Vite 专用插件,但必须安装相应的预处理器: +VitePress [内置支持](https://cn.vite.dev/guide/features.html#css-pre-processors) CSS 预处理器:`.scss`、`.sass`、.`less`、`.styl` 和 `.stylus` 文件。无需为它们安装 Vite 专用插件,但必须安装相应的预处理器: ``` # .scss and .sass diff --git a/docs/zh/guide/what-is-vitepress.md b/docs/zh/guide/what-is-vitepress.md index 25fdc01c..f2dae037 100644 --- a/docs/zh/guide/what-is-vitepress.md +++ b/docs/zh/guide/what-is-vitepress.md @@ -16,7 +16,7 @@ VitePress 是一个[静态站点生成器](https://en.wikipedia.org/wiki/Static_ - **文档** - VitePress 附带一个专为技术文档设计的默认主题。你现在正在阅读的这个页面以及 [Vite](https://vitejs.dev/)、[Rollup](https://rollupjs.org/)、[Pinia](https://pinia.vuejs.org/)、[VueUse](https://vueuse.org/)、[Vitest](https://vitest.dev/)、[D3](https://d3js.org/)、[UnoCSS](https://unocss.dev/)、[Iconify](https://iconify.design/) [等](https://github.com/search?q=/%22vitepress%22:+/+path:/(?:package%7Cdeno)%5C.jsonc?$/+NOT+is:fork+NOT+is:archived&type=code)文档都是基于这个主题的。 + VitePress 附带一个专为技术文档设计的默认主题。你现在正在阅读的这个页面以及 [Vite](https://vite.dev/)、[Rollup](https://rollupjs.org/)、[Pinia](https://pinia.vuejs.org/)、[VueUse](https://vueuse.org/)、[Vitest](https://vitest.dev/)、[D3](https://d3js.org/)、[UnoCSS](https://unocss.dev/)、[Iconify](https://iconify.design/) [等](https://github.com/search?q=/%22vitepress%22:+/+path:/(?:package%7Cdeno)%5C.jsonc?$/+NOT+is:fork+NOT+is:archived&type=code)文档都是基于这个主题的。 [Vue.js 官方文档](https://cn.vuejs.org/)也是基于 VitePress 的。但是为了可以在不同的翻译文档之间切换,它自定义了自己的主题。 @@ -30,7 +30,7 @@ VitePress 是一个[静态站点生成器](https://en.wikipedia.org/wiki/Static_ VitePress 旨在使用 Markdown 生成内容时提供出色的开发体验。 -- **[Vite 驱动](https://cn.vitejs.dev/)**:即时服务器启动,始终立即反映 (<100ms) 编辑变化,无需重新加载页面。 +- **[Vite 驱动](https://cn.vite.dev/)**:即时服务器启动,始终立即反映 (<100ms) 编辑变化,无需重新加载页面。 - **[内置 Markdown 扩展](./markdown)**:frontmatter、表格、语法高亮……应有尽有。具体来说,VitePress 提供了许多用于处理代码块的高级功能,使其真正成为技术文档的理想选择。 diff --git a/docs/zh/reference/site-config.md b/docs/zh/reference/site-config.md index 35133b98..e47cb364 100644 --- a/docs/zh/reference/site-config.md +++ b/docs/zh/reference/site-config.md @@ -430,7 +430,7 @@ export default { - 类型:`string` - 默认值: `./.vitepress/cache` -缓存文件的目录,相对于[项目根目录](../guide/routing#root-and-source-directory)。另请参阅:[cacheDir](https://vitejs.dev/config/shared-options.html#cachedir)。 +缓存文件的目录,相对于[项目根目录](../guide/routing#root-and-source-directory)。另请参阅:[cacheDir](https://vite.dev/config/shared-options.html#cachedir)。 ```ts export default { @@ -525,7 +525,7 @@ export default { - 类型:`import('vite').UserConfig` -将原始 [Vite 配置](https://vitejs.dev/config/)传递给内部 Vite 开发服务器 / bundler。 +将原始 [Vite 配置](https://vite.dev/config/)传递给内部 Vite 开发服务器 / bundler。 ```js export default { From 711840222700804dbb6fb39ee9b9580a3e6220e7 Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Fri, 17 Jul 2026 13:30:04 +0530 Subject: [PATCH 015/136] fix(theme): safari not showing external link icon properly --- docs/.vitepress/config.ts | 5 +---- src/client/theme-default/styles/components/vp-doc.css | 2 ++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index f13da450..0a5413ee 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -144,10 +144,7 @@ export default defineConfig({ } }), prod && llmstxt({ workDir: 'en', ignoreFiles: ['index.md'] }) - ], - experimental: { - enableNativePlugin: true - } + ] }, // prettier-ignore diff --git a/src/client/theme-default/styles/components/vp-doc.css b/src/client/theme-default/styles/components/vp-doc.css index 904427fc..9dbfe4b5 100644 --- a/src/client/theme-default/styles/components/vp-doc.css +++ b/src/client/theme-default/styles/components/vp-doc.css @@ -576,6 +576,8 @@ -webkit-mask-size: 11px 11px; mask-size: 11px 11px; /*rtl:raw:transform: scaleX(-1);*/ + vertical-align: bottom; + font-size: 10px; } .vp-external-link-icon::after { From 3b560a0efa8bdbf6f621413b3e8a27b19f4a638f Mon Sep 17 00:00:00 2001 From: chencu <82279230+chencu5958@users.noreply.github.com> Date: Sun, 19 Jul 2026 06:25:07 +0800 Subject: [PATCH 016/136] feat: support `note`, `important`, `caution` markdown containers (#5161) closes #4427 closes #3928 --- __tests__/e2e/markdown-extensions/index.md | 12 ++++++++++++ src/node/markdown/plugins/containers.ts | 9 +++++++++ 2 files changed, 21 insertions(+) diff --git a/__tests__/e2e/markdown-extensions/index.md b/__tests__/e2e/markdown-extensions/index.md index 3446b4ef..c95d60e0 100644 --- a/__tests__/e2e/markdown-extensions/index.md +++ b/__tests__/e2e/markdown-extensions/index.md @@ -56,6 +56,18 @@ This is a dangerous warning. This is a details block. ::: +::: note +This is a note. +::: + +::: important +This is an important note. +::: + +::: caution +This is a caution note. +::: + ### Custom Title ::: danger STOP diff --git a/src/node/markdown/plugins/containers.ts b/src/node/markdown/plugins/containers.ts index 39efce17..20a49167 100644 --- a/src/node/markdown/plugins/containers.ts +++ b/src/node/markdown/plugins/containers.ts @@ -14,6 +14,15 @@ export const containerPlugin = ( .use(...createContainer('warning', options?.warningLabel || 'WARNING', md)) .use(...createContainer('danger', options?.dangerLabel || 'DANGER', md)) .use(...createContainer('details', options?.detailsLabel || 'Details', md)) + .use(...createContainer('note', options?.noteLabel || 'NOTE', md)) + .use( + ...createContainer( + 'important', + options?.importantLabel || 'IMPORTANT', + md + ) + ) + .use(...createContainer('caution', options?.cautionLabel || 'CAUTION', md)) // explicitly escape Vue syntax .use(container, 'v-pre', { render: (tokens: Token[], idx: number) => From 028ee31b06c398368f2dfa401c132c64964ec223 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=B0=E5=86=BB=E5=A4=A7=E8=A5=BF=E7=93=9C?= <34816426+bd-dxg@users.noreply.github.com> Date: Sun, 19 Jul 2026 16:20:44 +0800 Subject: [PATCH 017/136] docs: add base path prefix docs to sidebar reference (#5324) Co-authored-by: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> --- docs/en/reference/default-theme-sidebar.md | 60 ++++++++++++++++++++++ docs/zh/reference/default-theme-sidebar.md | 60 ++++++++++++++++++++++ 2 files changed, 120 insertions(+) diff --git a/docs/en/reference/default-theme-sidebar.md b/docs/en/reference/default-theme-sidebar.md index cd44425d..559cd61d 100644 --- a/docs/en/reference/default-theme-sidebar.md +++ b/docs/en/reference/default-theme-sidebar.md @@ -184,3 +184,63 @@ export default { } } ``` + +## Path Prefix + +When your documentation structure has deep directories or groups located under the same subdirectory, you can use the `base` option to automatically prepend a path prefix to all nested `items` inside that group. This avoids repeating the same path prefix for every `link`. + +The `base` option is supported in both multiple sidebar configurations and nested sidebar groups. + +### In Multiple Sidebars + +You can define `base` at the root of a sidebar section configuration: + +```js {5} +export default { + themeConfig: { + sidebar: { + '/guide/': { + base: '/guide/', + items: [ + // This link is resolved to `/guide/introduction` + { text: 'Introduction', link: 'introduction' }, + // This link is resolved to `/guide/getting-started` + { text: 'Getting Started', link: 'getting-started' } + ] + } + } + } +} +``` + +### In Nested Groups + +You can also use `base` inside nested sidebar groups. It will apply to the immediate children of that group: + +```js{6,13} +export default { + themeConfig: { + sidebar: [ + { + text: 'Reference', + base: '/reference/', + items: [ + // This link is resolved to `/reference/site-config` + { text: 'Site Config', link: 'site-config' }, + { + text: 'Default Theme', + // Nested base overrides the parent path prefix + base: '/reference/default-theme-', + items: [ + // This link is resolved to `/reference/default-theme-nav` + { text: 'Nav', link: 'nav' }, + // This link is resolved to `/reference/default-theme-sidebar` + { text: 'Sidebar', link: 'sidebar' } + ] + } + ] + } + ] + } +} +``` diff --git a/docs/zh/reference/default-theme-sidebar.md b/docs/zh/reference/default-theme-sidebar.md index d6cb585c..b98c46e4 100644 --- a/docs/zh/reference/default-theme-sidebar.md +++ b/docs/zh/reference/default-theme-sidebar.md @@ -182,3 +182,63 @@ export default { } } ``` + +## 路径前缀 {#path-prefix} + +当文档结构具有较深的目录,或者多个分组位于同一个子目录下时,可以使用 `base` 选项为该分组下的所有嵌套 `items` 拼接的一个路径前缀。 + +这样可以避免为每个 `link` 重复书写相同的路径。`base` 选项既支持在多侧边栏配置中使用,也支持在嵌套的侧边栏分组中使用。 + +### 在多侧边栏中使用 {#in-multiple-sidebars} + +可以在多侧边栏配置的根部定义 `base`: + +```js {5} +export default { + themeConfig: { + sidebar: { + '/guide/': { + base: '/guide/', + items: [ + // 实际解析为 `/guide/introduction` + { text: 'Introduction', link: 'introduction' }, + // 实际解析为 `/guide/getting-started` + { text: 'Getting Started', link: 'getting-started' } + ] + } + } + } +} +``` + +### 在嵌套分组中使用 {#in-nested-groups} + +也可以在嵌套的侧边栏分组内部使用 `base`,它将作用于该分组的直接子项: + +```js {6,13} +export default { + themeConfig: { + sidebar: [ + { + text: 'Reference', + base: '/reference/', + items: [ + // 实际解析为 `/reference/site-config` + { text: 'Site Config', link: 'site-config' }, + { + text: 'Default Theme', + // 嵌套的 base 会覆盖父级的路径前缀 + base: '/reference/default-theme-', + items: [ + // 实际解析为 `/reference/default-theme-nav` + { text: 'Nav', link: 'nav' }, + // 实际解析为 `/reference/default-theme-sidebar` + { text: 'Sidebar', link: 'sidebar' } + ] + } + ] + } + ] + } +} +``` From ef64198b4b87413d80a97a37b0a0f8ef3ce4cc9f Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Sun, 19 Jul 2026 14:44:32 +0530 Subject: [PATCH 018/136] docs: add example for nesting custom containers --- docs/en/guide/markdown.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/docs/en/guide/markdown.md b/docs/en/guide/markdown.md index 3246afff..5bdee9fa 100644 --- a/docs/en/guide/markdown.md +++ b/docs/en/guide/markdown.md @@ -229,6 +229,36 @@ export default defineConfig({ }) ``` +### Nesting + +The `:::` markers follow the same rules as fenced code blocks (` ``` `): a fence is only closed by a matching fence that is **at least as long** as the one that opened it. To nest containers (or to mix them with [code groups](#code-groups)) make the outer fence longer than the ones inside it. + +**Input** + +`````md +:::: info Outer container +This box contains another container. + +::: details Inner container +```js +console.log('Hello, VitePress!') +``` +::: +:::: +````` + +**Output** + +:::: info Outer container +This box contains another container. + +::: details Inner container +```js +console.log('Hello, VitePress!') +``` +::: +:::: + ### Additional Attributes You can add additional attributes to the custom containers. We use [markdown-it-attrs](https://github.com/arve0/markdown-it-attrs) for this feature, and it is supported on almost all markdown elements. For example, you can set the `open` attribute to make the details block open by default: From c39a85a2ac88dca978d6a7b07fac3353fe0ae7fe Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Mon, 20 Jul 2026 00:47:00 +0530 Subject: [PATCH 019/136] fix(build): compose markdown `preConfig` hook when extending configs x-ref: #5205 Co-authored-by: Jonathan Doughty --- __tests__/unit/node/config.test.ts | 42 +++++++++++++++++++++++++++--- src/node/config.ts | 23 ++++++++++------ 2 files changed, 53 insertions(+), 12 deletions(-) diff --git a/__tests__/unit/node/config.test.ts b/__tests__/unit/node/config.test.ts index 22f7d034..4abb8ed6 100644 --- a/__tests__/unit/node/config.test.ts +++ b/__tests__/unit/node/config.test.ts @@ -1,15 +1,18 @@ import type { MarkdownItAsync } from 'markdown-it-async' -import { mergeConfig } from 'node/config' +import { mergeConfig, type UserConfig } from 'node/config' describe('node/config', () => { - test('merges markdown config hooks from extended configs', async () => { + test('merges markdown hooks from extended configs', async () => { const calls: string[] = [] const md = {} as MarkdownItAsync - const merged = mergeConfig( + const merged = mergeConfig( { markdown: { lineNumbers: true, + preConfig() { + calls.push('base-pre') + }, config() { calls.push('base') } @@ -20,6 +23,9 @@ describe('node/config', () => { attrs: { allowedAttributes: ['id'] }, + async preConfig() { + calls.push('extended-pre') + }, async config() { calls.push('extended') } @@ -32,8 +38,36 @@ describe('node/config', () => { allowedAttributes: ['id'] }) + await merged.markdown?.preConfig?.(md) + await merged.markdown?.config?.(md) + + expect(calls).toEqual(['base-pre', 'extended-pre', 'base', 'extended']) + }) + + test('keeps one-sided markdown hooks when the other config omits them', async () => { + const calls: string[] = [] + const md = {} as MarkdownItAsync + + const merged = mergeConfig( + { + markdown: { + preConfig() { + calls.push('base-pre') + } + } + }, + { + markdown: { + config() { + calls.push('extended') + } + } + } + ) + + await merged.markdown?.preConfig?.(md) await merged.markdown?.config?.(md) - expect(calls).toEqual(['base', 'extended']) + expect(calls).toEqual(['base-pre', 'extended']) }) }) diff --git a/src/node/config.ts b/src/node/config.ts index 55d791e0..749e1f39 100644 --- a/src/node/config.ts +++ b/src/node/config.ts @@ -332,17 +332,24 @@ export function mergeConfig( function mergeMarkdownConfig(a: MarkdownOptions, b: MarkdownOptions) { const merged = mergeConfig(a, b, false) - const baseConfig = a.config - const extendedConfig = b.config - if (baseConfig && extendedConfig) { - merged.config = async (md) => { - await baseConfig(md) - await extendedConfig(md) - } - } + merged.preConfig = mergeMarkdownHooks(a.preConfig, b.preConfig) + merged.config = mergeMarkdownHooks(a.config, b.config) return merged } +function mergeMarkdownHooks( + base: MarkdownOptions['config'], + extended: MarkdownOptions['config'] +): MarkdownOptions['config'] { + if (!base || !extended) { + return base ?? extended + } + return async (md) => { + await base(md) + await extended(md) + } +} + export async function resolveSiteData( root: string, userConfig?: UserConfig, From 4666fc277609f8bb916e6a54eb0ac9327784d073 Mon Sep 17 00:00:00 2001 From: btea <2356281422@qq.com> Date: Tue, 21 Jul 2026 14:11:03 +0800 Subject: [PATCH 020/136] feat(cli): show vite version in startup log (#5328) Co-authored-by: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> --- src/node/cli.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/node/cli.ts b/src/node/cli.ts index 93b0f8c5..2e12748c 100644 --- a/src/node/cli.ts +++ b/src/node/cli.ts @@ -1,6 +1,6 @@ import minimist from 'minimist' import c from 'picocolors' -import { createLogger, type Logger } from 'vite' +import { createLogger, version as viteVersion, type Logger } from 'vite' import { build, createServer, @@ -24,9 +24,10 @@ Object.keys(argv).forEach((key) => { }) const logVersion = (logger: Logger) => { - logger.info(`\n ${c.green(`${c.bold('vitepress')} v${version}`)}\n`, { - clear: !logger.hasWarned - }) + logger.info( + `\n ${c.green(`${c.bold('vitepress')} ${version}`)} ${c.gray(`(using vite ${viteVersion})`)}\n`, + { clear: !logger.hasWarned } + ) } const command = argv._[0] From cf973b20ef53d2663ef50eaff29be038f61e9357 Mon Sep 17 00:00:00 2001 From: Bjorn Lu Date: Tue, 21 Jul 2026 16:00:36 +0800 Subject: [PATCH 021/136] docs: update vite logo (#5319) Co-authored-by: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> --- docs/.vitepress/theme/styles.css | 29 +++++++++++++++++++ docs/en/index.md | 8 ++--- docs/es/index.md | 8 ++--- docs/fa/index.md | 8 ++--- docs/ja/index.md | 8 ++--- docs/ko/index.md | 8 ++--- docs/pt/index.md | 8 ++--- docs/ru/index.md | 8 ++--- docs/zh/index.md | 8 ++--- .../theme-default/components/VPImage.vue | 2 +- 10 files changed, 62 insertions(+), 33 deletions(-) diff --git a/docs/.vitepress/theme/styles.css b/docs/.vitepress/theme/styles.css index fbc4f012..113a4ead 100644 --- a/docs/.vitepress/theme/styles.css +++ b/docs/.vitepress/theme/styles.css @@ -35,3 +35,32 @@ filter: drop-shadow(-2px 4px 6px rgba(0, 0, 0, 0.2)); padding: 18px; } + +.VPFeature .icon span { + display: inline-block; + width: 1em; + height: 1em; + background-position: center; + background-repeat: no-repeat; + background-size: contain; + + &.memo { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cpath fill='%23efd8b1' d='M0 20.3S28.2 50.2 31.2 64c0 0 8.1-17.9 32.8-25.4c0 0-8.8-20.6-32.2-37c0 0-23.9 7.2-31.8 18.7'/%3E%3Cpath fill='%23fff6d7' d='M3.2 7.9s22 38.2 22.4 52.5c0 0 11-14.8 36.4-14c0 0-4.8-22.9-24.6-46.3c0-.1-24.5-.9-34.2 7.8'/%3E%3Cg fill='%237d8b91'%3E%3Cpath d='M19.9 9.4c-.3.4.2-.4 0 0'/%3E%3Cpath d='M19.9 9.4c.2-.3.3-.8.6-1.1c.4-.3.8-.1 1.2-.4c.8-.6 1.2-1.6 1.9-2.3c.8-.8 1.8-1.3 2.9-1.6c1.1-.4 2.2-1.2 3.3-1.2c-.5 1.5-1.5 2.8-1.7 4.5c-.1.9 0 1.8.1 2.7c.2-.7.4-1.4.6-2c.4-.9 1.3-.8 2.1-1.1c.8-.4 1.5-1.1 2.2-1.7c.3.5 1.4-.3 1.6.4c.1.3 2.8-.1 3-.2c-.6 0-2.7.1-2.8-.4c-.3-.1-.9-.2-1.3-.2v-.7c-.6.4-1.2.9-1.8 1.4c-.9.7-2 .5-2.9 1.2c.3-1 .9-1.9 1.3-2.9c.2-.4.3-.9.4-1.3s0-.2-.3-.4c-1.4-.4-2.8.7-4 1.2c-1.1.5-2.1 1.1-2.9 1.9c-.5.5-1.3 2.3-2 2.5c-1.4 0-.9 1.3-1.8 1.7c-.5.2-.8.2-1.3.5c-.5.4-1.2 1.1-2 1c0-.6 0-1.2-.2-1.8c-.8.4-1.1 1.1-1.8 1.6c.2-1.6.9-2.9.9-4.6c-.9.6-1.4 1.3-1.9 2.2c-.6 1.1-1.1 2.9-2.3 3.5c0-1.5.7-3 .5-4.6c-.3.8-.3 1.8-.5 2.5c-.2.9-.4 1.8-.4 2.8c2.2-.3 2.6-3.5 3.9-4.9c-.3 1.4-.8 2.7-.7 4.2c.9-.5 1.3-1.5 2.1-2.1c.3.9-.4 2.1 1.1 1.4c.6-.3 1.1-.8 1.7-1.2c.3-.2.9 0 1.2-.5m21.5 4.4c-.4-.4-1.1-.5-1.6-.9c-.6-.5-1.6-.3-2.2-.1c-1.6.4-2.7.8-4.2 0c0 .5.1 2.5-.7 2.4c-.7 0-.5-2.1-.6-2.8c-.4.6-.7 1.1-.7 1.8c0 .5.2.8-.2 1.3c-.6.5-1.5.4-2.2.3c-.2-1.1.1-2.4.2-3.6c-.2 1-.5 2-.7 3.1c-.2.8-.9.9-1.5.7c-.1-.2.1-1 .1-1.2c-.6 1.1-1 2.5-1.8 3.5c-.4.5-1.3 1-1.7.2c-.3-.5-.1-1.2 0-1.8c-.5.6-1 2.3-1.8 2.3c.1-.4.4-.8-.1-1c-.2.4-.4.9-.7 1.4c.2-.6.4-1.3.5-2c-1.3.8-2.1 1.9-2.8 3.2c0-.2.1-.7.1-.9c-.1.4-.9 1.9-.4 2.2c.7-1.1 1.3-2.3 2.3-3.2c-.5 1.5-1.1 2.8-1.4 4.3c.6-.7 1.2-1.5 1.7-2.3c.1-.3.3-.6.4-.9c.3-.8.3-.2.9-.6c.5-.4.8-1.1 1.1-1.7c-.1 1.8 1.4 2.1 2.4.7c.4-.6.7-1.2 1-1.8l.8.2c.4 0 .7 0 1-.2c1.1.4 2.8.5 3.5-.8c1.2 1.3 2-.7 2.1-1.7c1.2.5 2.3-.1 3.5-.5c.7-.2 2-.8 2.5 0c.2.3.7.3 1.2.4M30.8 24.1s.1 0 0 0m0 0c0-.4-.3-.6-.7-.3c-.5.4-.2-.3-.2-.7c0-.5.1-.9.1-1.4c-.2.4-.5.8-.7 1.2c-.4.7-.3 2-1.3 2.1c.2-.5.3-1 .4-1.5c-.5.5-1.1.8-1.1 1.6c0 1-1 3.4-2.3 3.1c.1-2 1.2-3.8 1.7-5.7c-2 1.2-3.7 4.2-3.9 6.4c1-1.7 1.7-3.6 3.1-5c-.4 1.5-.9 2.9-1 4.4c0 .3.8.1.9.1c.7-.2 1.2-.9 1.5-1.5c.1-.2.3-.5.4-.7c.3-.6.4-.2.9-.5c.7-.3.7-1.2 1.4-1.1s2.2-.1 2.7-.4c-.6 0-1.2.1-1.9-.1m-.5-.4l.2.2c-.1 0-.2-.1-.2-.2m13.8 18.7c.5-.7-.2-.1 0 0'/%3E%3Cpath d='M58.4 39.7c-1.8-1.3-3.9-2.1-5.9-3.2c.4.6 1 1.3 1.3 2c-1 .1-.9 1.9-1 1.9c-.5-.3-1.9 0-2.5.1c0-.1 0-.2.1-.3c-1.8 1.2-3.3 3-5.7 2.5c1.1-1.7 2-3.6 1.9-5.7c-1.8.6-2.8 2.3-3.6 3.9c-.2-.6-1-1.1-1.5-.6c-.6.5-.9 1.5-1.1 2.2c-.3.9-.4 1.9-.5 2.8c0 .7-.1.8.6.8c1.7 0 3.2-2 4-3.2c2.2.6 3.5-.4 5.2-1.6c0 .8.6 1.3 1.4 1.1s1.2-1.2 1.8-1.2c.5 0 .8.2 1.3.2s1.1-.1 1.6-.2c-.6-.7-.8-1.2-1-2.1c1.2.3 2.3.6 3.6.6m-16.2 4.9c.2-.2.3-.3 0 0c-.3.2-.2.2-.1.1c-.5.4-1.1.9-1.8.9c0-1.5.2-3.3.9-4.6c.4-.6.9-.8 1.5-.3c.4.4-.1.8-.1 1.2c.1-.2.2-.4.3-.5c.1.6.4 1 1 1.3c-.5.6-1 1.3-1.7 1.9m1.9-2.2c-2.4-1 .7-4.1 2.1-4.7c-.2 1.7-1.1 3.3-2.1 4.7m6.9-.8c-.8.2-.8-.6-.7-1.1c.5.2 1 .4 1.6.5c-.2.3-.5.6-.9.6m2.7-.7v-.1zm.2-.6c.1-.1.1-.3.1-.4c-.3.1-.5.2-.8.3c0-.3-.1-1.1.3-1.2c.8-.4.8.9.9 1.4c-.2 0-.4 0-.5-.1m.9-1.8h-.2c-.1-.1 0-.1.2 0'/%3E%3C/g%3E%3Cpath fill='%23ffce31' d='m35.658 20.801l16.124-16.12l7.565 7.567l-16.124 16.12z'/%3E%3Cpath fill='%23ed4c5c' d='m62.6 2.3l-1-1c-1.8-1.8-4.8-1.8-6.6 0l-3.3 3.3l7.6 7.6l3.3-3.3c1.9-1.8 1.9-4.7 0-6.6'/%3E%3Cpath fill='%2393a2aa' d='m49.703 6.679l2.05-2.05l7.566 7.567l-2.051 2.05z'/%3E%3Cpath fill='%23c7d3d8' d='m50.552 7.527l2.05-2.05l5.94 5.939l-2.05 2.05z'/%3E%3Cpath fill='%23fed0ac' d='m35.6 20.8l-3.3 8.6l2.3 2.3l8.6-3.3z'/%3E%3Cpath fill='%23333' d='M31.8 30.9c-.5 1.2.2 1.8 1.3 1.3l4.2-1.6l-3.9-3.9z'/%3E%3Cpath fill='%23ffdf85' d='M35.672 20.82L49.744 6.75l2.545 2.545l-14.071 14.071z'/%3E%3Cpath fill='%23ff8736' d='m40.656 25.869l14.07-14.074l2.545 2.546l-14.07 14.073z'/%3E%3C/svg%3E"); + } + + &.rocket { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cg fill='%23ff9d27'%3E%3Cpath d='M10.9 48.7c4-4 4.4-5 6.9-2.5s1.5 2.8-2.5 6.9c-3 3-6.8 2.4-6.8 2.4s-.6-3.8 2.4-6.8'/%3E%3Cpath d='M18.5 52.8c1.6-4.2 2.1-4.7-.2-6s-2.3-.4-3.8 3.8c-1.2 3.1.2 5.9.2 5.9s2.7-.5 3.8-3.7'/%3E%3C/g%3E%3Cpath fill='%23fdf516' d='M16.2 48.9c.9-2.3.9-2.8 2.1-2.1c1.3.7 1 1 .1 3.3c-.6 1.7-2.1 2.1-2.1 2.1s-.7-1.5-.1-3.3'/%3E%3Cpath fill='%23ff9d27' d='M17.1 45.7c-1.3-2.3-1.8-1.8-6-.2c-3.1 1.2-3.7 3.8-3.7 3.8s2.8 1.4 5.9.2c4.2-1.6 5.1-1.6 3.8-3.8'/%3E%3Cg fill='%23fdf516'%3E%3Cpath d='M15 47.8c2.3-.9 2.8-.9 2.1-2.1c-.7-1.3-1-1-3.3-.1c-1.7.6-2.1 2.1-2.1 2.1s1.6.7 3.3.1'/%3E%3Cpath d='M13.9 47.6c2.2-2.2 2.4-2.8 3.8-1.4s.8 1.6-1.4 3.8c-1.7 1.7-3.8 1.3-3.8 1.3s-.2-2 1.4-3.7'/%3E%3C/g%3E%3Cpath fill='%233baacf' d='M18.5 38C12.3 27.6 2 31.9 2 31.9s14.7-14.7 24.6-4.8z'/%3E%3Cpath fill='%23428bc1' d='m23.3 30.3l3.2-3.2C16.7 17.2 2 31.9 2 31.9s12.9-9.2 21.3-1.6'/%3E%3Cpath fill='%233baacf' d='M26 45.5C36.4 51.7 32.1 62 32.1 62s14.7-14.7 4.8-24.6z'/%3E%3Cpath fill='%23428bc1' d='m33.7 40.7l3.2-3.2c9.9 9.9-4.8 24.6-4.8 24.6s9.2-13 1.6-21.4'/%3E%3Cpath fill='%23c5d0d8' d='M48.8 30.9C37.1 42.5 24.2 48.8 19.7 44.3s1.8-17.4 13.4-29.1c13.6-13.6 28.7-13 28.7-13s.5 15.1-13 28.7'/%3E%3Cpath fill='%23dae3ea' d='M45.8 27.6C34.2 39.2 22.6 46.8 19.9 44.1s4.9-14.3 16.5-25.9C50 4.6 62 2 62 2s-2.6 12-16.2 25.6'/%3E%3Cpath fill='%23c94747' d='M24.3 47.5c-.5.5-1.3.5-1.8 0l-6-6c-.5-.5-.5-1.4 0-1.9l1.8-1.8l7.8 7.8z'/%3E%3Cpath fill='%23f15744' d='M22.6 45.7c-.5.5-1.1.7-1.4.4l-3.4-3.4c-.3-.3-.1-.9.4-1.4l1.8-1.8l4.4 4.4z'/%3E%3Cpath fill='%233e4347' d='M20.9 48.2c-.3.3-1 .3-1.3 0l-3.9-3.9c-.3-.3-.2-.9.1-1.2l1.2-1.2l5.1 5.1z'/%3E%3Cpath fill='%2362727a' d='M20.1 47.4c-.3.3-.9.4-1.1.2l-2.7-2.7c-.2-.2-.1-.7.3-1l1.2-1.2l3.5 3.5z'/%3E%3Cpath fill='%23c94747' d='M61.8 2.2S56.4 2 49.1 4.8l10.1 10.1C62 7.6 61.8 2.2 61.8 2.2'/%3E%3Cpath fill='%23f15744' d='M61.8 2.2s-4.3.9-10.8 4.6l6.2 6.2c3.7-6.5 4.6-10.8 4.6-10.8'/%3E%3Ccircle cx='43.5' cy='20.5' r='5' fill='%23edf4f9'/%3E%3Ccircle cx='43.5' cy='20.5' r='3.3' fill='%233baacf'/%3E%3Ccircle cx='33.5' cy='30.5' r='5' fill='%23edf4f9'/%3E%3Ccircle cx='33.5' cy='30.5' r='3.3' fill='%233baacf'/%3E%3Cg fill='%23fff'%3E%3Cpath d='M48.9 6.9c-.3.3-.9.3-1.2 0s-.3-.9 0-1.2s.9-.3 1.2 0s.3.9 0 1.2'/%3E%3Ccircle cx='50.6' cy='8.6' r='.8'/%3E%3Ccircle cx='53' cy='11' r='.8'/%3E%3Ccircle cx='55.3' cy='13.4' r='.8'/%3E%3Ccircle cx='57.7' cy='15.7' r='.8'/%3E%3C/g%3E%3C/svg%3E"); + } + + &.vite { + background-image: url("data:image/svg+xml,%0A%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='1 6.8 30 18.4'%3E%3Cmask id='SVGgudELdDz'%3E%3Cpath fill='%23fff' d='M40.05 45.7c-.67.85-2.02.38-2.02-.69v-10.3a2.26 2.26 0 0 0-2.27-2.26H24.4a1.13 1.13 0 0 1-.92-1.8l7.48-10.46c1.07-1.5 0-3.58-1.84-3.58H15.34a1.13 1.13 0 0 1-.92-1.79l9.7-13.57c.2-.3.55-.48.92-.48h28.89c.92 0 1.46 1.04.92 1.79l-7.48 10.47a2.26 2.26 0 0 0 1.84 3.58H60.6c.94 0 1.47 1.09.89 1.83z'/%3E%3C/mask%3E%3Cg fill='none'%3E%3Cg mask='url(%23SVGgudELdDz)' transform='translate(1 6.8)scale(.393)'%3E%3Cpath fill='%239135ff' d='M0 0h62v47H0z'/%3E%3Cg filter='url(%23SVGNp06lekD)'%3E%3Cellipse cx='24.46' cy='37.75' fill='%23eee6ff' rx='5.51' ry='14.7' transform='rotate(89.8 24.46 37.75)'/%3E%3C/g%3E%3Cg filter='url(%23SVGNp06lekD)'%3E%3Cellipse cx='4.76' cy='18.96' fill='%23eee6ff' rx='10.4' ry='29.85' transform='rotate(89.8 4.76 18.96)'/%3E%3C/g%3E%3Cg filter='url(%23SVGQv8P6csY)'%3E%3Cellipse cx='4.24' cy='17.5' fill='%238900ff' rx='5.51' ry='30.49' transform='rotate(89.8 4.24 17.5)'/%3E%3C/g%3E%3Cg filter='url(%23SVGQv8P6csY)'%3E%3Cellipse cx='8.95' cy='35.5' fill='%238900ff' rx='5.51' ry='30.6' transform='rotate(89.8 8.95 35.5)'/%3E%3C/g%3E%3Cg filter='url(%23SVGQv8P6csY)'%3E%3Cellipse cx='10.48' cy='36.65' fill='%238900ff' rx='5.51' ry='30.6' transform='rotate(89.8 10.48 36.65)'/%3E%3C/g%3E%3Cg filter='url(%23SVGNp06lekD)'%3E%3Cellipse cx='67.34' cy='12.3' fill='%23eee6ff' rx='14.07' ry='22.08' transform='rotate(-86.7 67.34 12.3)'/%3E%3C/g%3E%3Cg filter='url(%23SVGQv8P6csY)'%3E%3Cellipse cx='68.44' cy='15.74' fill='%238900ff' rx='3.47' ry='21.5' transform='rotate(-91 68.44 15.74)'/%3E%3C/g%3E%3Cg filter='url(%23SVGQv8P6csY)'%3E%3Cellipse cx='68.44' cy='15.74' fill='%238900ff' rx='3.47' ry='21.5' transform='rotate(-91 68.44 15.74)'/%3E%3C/g%3E%3Cg filter='url(%23SVGQv8P6csY)'%3E%3Cellipse cx='14.59' cy='9.74' fill='%238900ff' rx='4.41' ry='29.11' transform='rotate(39.5 14.6 9.74)'/%3E%3C/g%3E%3Cg filter='url(%23SVGQv8P6csY)'%3E%3Cellipse cx='61.73' cy='-5.32' fill='%238900ff' rx='4.41' ry='29.11' transform='rotate(37.9 61.73 -5.32)'/%3E%3C/g%3E%3Cg filter='url(%23SVGQv8P6csY)'%3E%3Cellipse cx='55.62' cy='7.1' fill='%2300c2ff' rx='5.97' ry='9.67' transform='rotate(37.9 55.62 7.1)'/%3E%3C/g%3E%3Cg filter='url(%23SVGQv8P6csY)'%3E%3Cellipse cx='12.33' cy='39.1' fill='%238900ff' rx='4.41' ry='29.11' transform='rotate(37.9 12.33 39.1)'/%3E%3C/g%3E%3Cg filter='url(%23SVGQv8P6csY)'%3E%3Cellipse cx='12.33' cy='39.1' fill='%238900ff' rx='4.41' ry='29.11' transform='rotate(37.9 12.33 39.1)'/%3E%3C/g%3E%3Cg filter='url(%23SVGQv8P6csY)'%3E%3Cellipse cx='49.86' cy='30.68' fill='%238900ff' rx='4.41' ry='29.11' transform='rotate(37.9 49.86 30.68)'/%3E%3C/g%3E%3Cg filter='url(%23SVGQv8P6csY)'%3E%3Cellipse cx='52.62' cy='33.17' fill='%2300c2ff' rx='5.97' ry='15.3' transform='rotate(37.9 52.62 33.17)'/%3E%3C/g%3E%3C/g%3E%3Cpath fill='%2308060e' d='M3.72 6.8C.1 11.98.08 20 3.72 25.2h2.45c-3.64-5.2-3.62-13.22 0-18.4zm24.56 0h-2.45c3.62 5.18 3.64 13.2 0 18.4h2.45c3.64-5.2 3.62-13.22 0-18.4'/%3E%3Cdefs%3E%3Cfilter id='SVGNp06lekD' width='4' height='4' x='-2' y='-2' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='7.66'/%3E%3C/filter%3E%3Cfilter id='SVGQv8P6csY' width='4' height='4' x='-2' y='-2' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='4.6'/%3E%3C/filter%3E%3C/defs%3E%3C/g%3E%3C/svg%3E"); + .dark & { + background-image: url("data:image/svg+xml,%0A%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='1 6.8 30 18.4'%3E%3Cmask id='SVGgudELdDz'%3E%3Cpath fill='%23fff' d='M40.05 45.7c-.67.85-2.02.38-2.02-.69v-10.3a2.26 2.26 0 0 0-2.27-2.26H24.4a1.13 1.13 0 0 1-.92-1.8l7.48-10.46c1.07-1.5 0-3.58-1.84-3.58H15.34a1.13 1.13 0 0 1-.92-1.79l9.7-13.57c.2-.3.55-.48.92-.48h28.89c.92 0 1.46 1.04.92 1.79l-7.48 10.47a2.26 2.26 0 0 0 1.84 3.58H60.6c.94 0 1.47 1.09.89 1.83z'/%3E%3C/mask%3E%3Cg fill='none'%3E%3Cg mask='url(%23SVGgudELdDz)' transform='translate(1 6.8)scale(.393)'%3E%3Cpath fill='%239135ff' d='M0 0h62v47H0z'/%3E%3Cg filter='url(%23SVGNp06lekD)'%3E%3Cellipse cx='24.46' cy='37.75' fill='%23eee6ff' rx='5.51' ry='14.7' transform='rotate(89.8 24.46 37.75)'/%3E%3C/g%3E%3Cg filter='url(%23SVGNp06lekD)'%3E%3Cellipse cx='4.76' cy='18.96' fill='%23eee6ff' rx='10.4' ry='29.85' transform='rotate(89.8 4.76 18.96)'/%3E%3C/g%3E%3Cg filter='url(%23SVGQv8P6csY)'%3E%3Cellipse cx='4.24' cy='17.5' fill='%238900ff' rx='5.51' ry='30.49' transform='rotate(89.8 4.24 17.5)'/%3E%3C/g%3E%3Cg filter='url(%23SVGQv8P6csY)'%3E%3Cellipse cx='8.95' cy='35.5' fill='%238900ff' rx='5.51' ry='30.6' transform='rotate(89.8 8.95 35.5)'/%3E%3C/g%3E%3Cg filter='url(%23SVGQv8P6csY)'%3E%3Cellipse cx='10.48' cy='36.65' fill='%238900ff' rx='5.51' ry='30.6' transform='rotate(89.8 10.48 36.65)'/%3E%3C/g%3E%3Cg filter='url(%23SVGNp06lekD)'%3E%3Cellipse cx='67.34' cy='12.3' fill='%23eee6ff' rx='14.07' ry='22.08' transform='rotate(-86.7 67.34 12.3)'/%3E%3C/g%3E%3Cg filter='url(%23SVGQv8P6csY)'%3E%3Cellipse cx='68.44' cy='15.74' fill='%238900ff' rx='3.47' ry='21.5' transform='rotate(-91 68.44 15.74)'/%3E%3C/g%3E%3Cg filter='url(%23SVGQv8P6csY)'%3E%3Cellipse cx='68.44' cy='15.74' fill='%238900ff' rx='3.47' ry='21.5' transform='rotate(-91 68.44 15.74)'/%3E%3C/g%3E%3Cg filter='url(%23SVGQv8P6csY)'%3E%3Cellipse cx='14.59' cy='9.74' fill='%238900ff' rx='4.41' ry='29.11' transform='rotate(39.5 14.6 9.74)'/%3E%3C/g%3E%3Cg filter='url(%23SVGQv8P6csY)'%3E%3Cellipse cx='61.73' cy='-5.32' fill='%238900ff' rx='4.41' ry='29.11' transform='rotate(37.9 61.73 -5.32)'/%3E%3C/g%3E%3Cg filter='url(%23SVGQv8P6csY)'%3E%3Cellipse cx='55.62' cy='7.1' fill='%2300c2ff' rx='5.97' ry='9.67' transform='rotate(37.9 55.62 7.1)'/%3E%3C/g%3E%3Cg filter='url(%23SVGQv8P6csY)'%3E%3Cellipse cx='12.33' cy='39.1' fill='%238900ff' rx='4.41' ry='29.11' transform='rotate(37.9 12.33 39.1)'/%3E%3C/g%3E%3Cg filter='url(%23SVGQv8P6csY)'%3E%3Cellipse cx='12.33' cy='39.1' fill='%238900ff' rx='4.41' ry='29.11' transform='rotate(37.9 12.33 39.1)'/%3E%3C/g%3E%3Cg filter='url(%23SVGQv8P6csY)'%3E%3Cellipse cx='49.86' cy='30.68' fill='%238900ff' rx='4.41' ry='29.11' transform='rotate(37.9 49.86 30.68)'/%3E%3C/g%3E%3Cg filter='url(%23SVGQv8P6csY)'%3E%3Cellipse cx='52.62' cy='33.17' fill='%2300c2ff' rx='5.97' ry='15.3' transform='rotate(37.9 52.62 33.17)'/%3E%3C/g%3E%3C/g%3E%3Cpath fill='%23fff' d='M3.72 6.8C.1 11.98.08 20 3.72 25.2h2.45c-3.64-5.2-3.62-13.22 0-18.4zm24.56 0h-2.45c3.62 5.18 3.64 13.2 0 18.4h2.45c3.64-5.2 3.62-13.22 0-18.4'/%3E%3Cdefs%3E%3Cfilter id='SVGNp06lekD' width='4' height='4' x='-2' y='-2' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='7.66'/%3E%3C/filter%3E%3Cfilter id='SVGQv8P6csY' width='4' height='4' x='-2' y='-2' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='4.6'/%3E%3C/filter%3E%3C/defs%3E%3C/g%3E%3C/svg%3E"); + } + width: 1.3em; + } + + &.vue { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='2 3.92 28 24.15'%3E%3Cpath fill='%2341b883' d='M24.4 3.925H30l-14 24.15L2 3.925h10.71l3.29 5.6l3.22-5.6Z'%3E%3C/path%3E%3Cpath fill='%2341b883' d='m2 3.925l14 24.15l14-24.15h-5.6L16 18.415L7.53 3.925Z'%3E%3C/path%3E%3Cpath fill='%2335495e' d='M7.53 3.925L16 18.485l8.4-14.56h-5.18L16 9.525l-3.29-5.6Z'%3E%3C/path%3E%3C/svg%3E"); + } +} diff --git a/docs/en/index.md b/docs/en/index.md index ce9015b2..93f8f3f6 100644 --- a/docs/en/index.md +++ b/docs/en/index.md @@ -21,16 +21,16 @@ hero: alt: VitePress features: - - icon: 📝 + - icon: title: Focus on your content details: Effortlessly create beautiful documentation sites with just markdown. - - icon: + - icon: title: Enjoy the Vite DX details: Instant server start, lightning fast hot updates, and leverage Vite ecosystem plugins. - - icon: + - icon: title: Customize with Vue details: Use Vue syntax and components directly in markdown, or build custom themes with Vue. - - icon: 🚀 + - icon: title: Ship fast sites details: Fast initial load with static HTML, fast post-load navigation with client-side routing. --- diff --git a/docs/es/index.md b/docs/es/index.md index b4c8673f..1eb31f82 100644 --- a/docs/es/index.md +++ b/docs/es/index.md @@ -21,16 +21,16 @@ hero: alt: VitePress features: - - icon: 📝 + - icon: title: Concéntrese en su contenido details: Cree lindos sitios de documentación apenas con markdown. - - icon: + - icon: title: Disfruta de la experiencia Vite details: Inicio instantaneo de servidor, actualizaciones ultrarrápidas, y plugins del ecosistema Vite. - - icon: + - icon: title: Personaliza con Vue details: Usa la sintaxis y componentes Vue directamente en markdown, o construye temas personalizados con Vue. - - icon: 🚀 + - icon: title: Entrega rápida de sitios details: Carga inicial rápida con HTML estático, navegación rápida con enrutamiento del lado del cliente. --- diff --git a/docs/fa/index.md b/docs/fa/index.md index d36e6a2c..c8f263fd 100644 --- a/docs/fa/index.md +++ b/docs/fa/index.md @@ -21,16 +21,16 @@ hero: alt: ویت‌پرس features: - - icon: 📝 + - icon: title: تمرکز روی محتوا details: ایجاد سایت‌های مستند‌سازی زیبا بدون زحمت و فقط با Markdown - - icon: + - icon: title: لذت از تجربه توسعه با Vite details: شروع فوری سرور، به‌روزرسانی‌های سریع و استفاده از افزونه‌های اکوسیستم Vite - - icon: + - icon: title: شخصی‌سازی با Vue details: استفاده مستقیم از syntax و کامپوننت‌های Vue در Markdown، یا ایجاد تم‌های شخصی به کمک Vue - - icon: 🚀 + - icon: title: ارسال سایت های سریع details: بارگذاری اولیه سریع با HTML ایستا، ناوبری سریع پس از بارگیری با مسیریابی سمت کلاینت --- diff --git a/docs/ja/index.md b/docs/ja/index.md index b5be770b..665ad78e 100644 --- a/docs/ja/index.md +++ b/docs/ja/index.md @@ -21,16 +21,16 @@ hero: alt: VitePress features: - - icon: 📝 + - icon: title: コンテンツに集中 details: Markdown だけで、美しいドキュメントサイトを簡単に作成できます。 - - icon: + - icon: title: Vite の開発体験を享受 details: 即時サーバー起動、超高速ホットリロード、そして Vite エコシステムのプラグイン活用。 - - icon: + - icon: title: Vue でカスタマイズ details: Markdown 内で直接 Vue 構文やコンポーネントを利用したり、Vue で独自テーマを構築できます。 - - icon: 🚀 + - icon: title: 高速サイトを公開 details: 静的 HTML による高速初期ロードと、クライアントサイドルーティングによる快適なページ遷移。 --- diff --git a/docs/ko/index.md b/docs/ko/index.md index d5a6c1a2..fa302470 100644 --- a/docs/ko/index.md +++ b/docs/ko/index.md @@ -21,16 +21,16 @@ hero: alt: VitePress features: - - icon: 📝 + - icon: title: 콘텐츠에 집중 details: 마크다운으로만 아름다운 문서 사이트를 쉽게 만들기. - - icon: + - icon: title: Vite DX(개발자 경험) 즐겨보기 details: 즉각적인 서버 시작, 매우 빠른 업데이트, Vite 생태계 플러그인을 활용. - - icon: + - icon: title: Vue로 커스터마이징 details: Vue 문법과 컴포넌트를 마크다운에서 직접 사용하거나 Vue로 커스텀 테마를 구축. - - icon: 🚀 + - icon: title: 웹사이트를 빠르게 제공 details: 정적 HTML로 빠른 초기 로딩, 클라이언트 측 라우팅을 통한 빠른 탐색. --- diff --git a/docs/pt/index.md b/docs/pt/index.md index ca621454..6143921b 100644 --- a/docs/pt/index.md +++ b/docs/pt/index.md @@ -21,16 +21,16 @@ hero: alt: VitePress features: - - icon: 📝 + - icon: title: Foco no seu conteúdo details: Cria sites de documentação belos e sem esforço apenas com markdown. - - icon: + - icon: title: Aproveite a experiência Vite details: Início de servidor instantâneo, atualizações ultrarrápidas, e plugins do ecossistema Vite. - - icon: + - icon: title: Personalize com Vue details: Use sintaxe e componentes Vue diretamente em markdown, ou construa temas personalizados com Vue. - - icon: 🚀 + - icon: title: Entregue Sites Rápidos details: Carregamento inicial rápido com HTML estático, navegação rápida com roteamento no lado do cliente. --- diff --git a/docs/ru/index.md b/docs/ru/index.md index 2fb82def..5d151a85 100644 --- a/docs/ru/index.md +++ b/docs/ru/index.md @@ -21,16 +21,16 @@ hero: alt: VitePress features: - - icon: 📝 + - icon: title: Сосредоточьтесь на своем контенте details: Легко создавайте красивые сайты с документацией, используя только Markdown. - - icon: + - icon: title: Наслаждайтесь опытом разработчиков Vite details: Мгновенный запуск сервера, молниеносные горячие обновления и использование плагинов экосистемы Vite. - - icon: + - icon: title: Настройка с помощью Vue details: Используйте синтаксис Vue и компоненты прямо в Markdown или создавайте собственные темы с помощью Vue. - - icon: 🚀 + - icon: title: Быстрый запуск веб-сайтов details: Быстрая начальная загрузка с помощью статического HTML, быстрая навигация после загрузки с помощью маршрутизации на стороне клиента. --- diff --git a/docs/zh/index.md b/docs/zh/index.md index 6be83546..55275f6a 100644 --- a/docs/zh/index.md +++ b/docs/zh/index.md @@ -21,16 +21,16 @@ hero: alt: VitePress features: - - icon: 📝 + - icon: title: 专注内容 details: 只需 Markdown 即可轻松创建美观的文档站点。 - - icon: + - icon: title: 享受 Vite 无可比拟的体验 details: 服务器即时启动,闪电般的热更新,还可以使用基于 Vite 生态的插件。 - - icon: + - icon: title: 使用 Vue 自定义 details: 直接在 Markdown 中使用 Vue 语法和组件,或者使用 Vue 组件构建自定义主题。 - - icon: 🚀 + - icon: title: 速度真的很快! details: 采用静态 HTML 实现快速的页面初次加载,使用客户端路由实现快速的页面切换导航。 --- diff --git a/src/client/theme-default/components/VPImage.vue b/src/client/theme-default/components/VPImage.vue index 8a2f5131..0a014d3c 100644 --- a/src/client/theme-default/components/VPImage.vue +++ b/src/client/theme-default/components/VPImage.vue @@ -40,7 +40,7 @@ defineOptions({ inheritAttrs: false }) html:not(.dark) .VPImage.dark { display: none; } -.dark .VPImage.light { +html.dark .VPImage.light { display: none; } From 9376c58abec557dd8c5b63f991a1d1068586f175 Mon Sep 17 00:00:00 2001 From: Henrikh Kantuni Date: Wed, 22 Jul 2026 16:17:25 -0400 Subject: [PATCH 022/136] fix(theme): prevent TypeError when navigating to page without outline (#5329) Co-authored-by: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> --- src/client/theme-default/composables/outline.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/client/theme-default/composables/outline.ts b/src/client/theme-default/composables/outline.ts index bc03203f..e17a005c 100644 --- a/src/client/theme-default/composables/outline.ts +++ b/src/client/theme-default/composables/outline.ts @@ -100,7 +100,6 @@ export function useActiveAnchor( onUnmounted(() => { window.removeEventListener('scroll', onScroll) - container.value.removeEventListener('click', onClick) }) function onClick(e: MouseEvent) { From 078786a1b3e0793f55cb14d819df93900041ccb0 Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Thu, 23 Jul 2026 23:05:18 +0530 Subject: [PATCH 023/136] refactor(markdown)!: rename image option `lazyLoading` to `lazyLoad` BREAKING CHANGE: The `markdown.image.lazyLoading` option has been renamed to `markdown.image.lazyLoad`. Co-Authored-By: Claude Fable 5 --- __tests__/e2e/.vitepress/config.ts | 4 +--- __tests__/unit/node/markdown/plugins/image.test.ts | 4 ++-- docs/en/guide/markdown.md | 4 ++-- docs/es/guide/markdown.md | 4 ++-- docs/fa/guide/markdown.md | 4 ++-- docs/ja/guide/markdown.md | 4 ++-- docs/ko/guide/markdown.md | 4 ++-- docs/pt/guide/markdown.md | 4 ++-- docs/ru/guide/markdown.md | 4 ++-- docs/zh/guide/markdown.md | 4 ++-- src/node/markdown/plugins/image.ts | 6 +++--- 11 files changed, 22 insertions(+), 24 deletions(-) diff --git a/__tests__/e2e/.vitepress/config.ts b/__tests__/e2e/.vitepress/config.ts index 441eda1c..7ec72c30 100644 --- a/__tests__/e2e/.vitepress/config.ts +++ b/__tests__/e2e/.vitepress/config.ts @@ -155,9 +155,7 @@ export default defineConfig({ title: 'Example', description: 'An example app using VitePress.', markdown: { - image: { - lazyLoading: true - } + image: { lazyLoad: true } }, themeConfig: { nav, diff --git a/__tests__/unit/node/markdown/plugins/image.test.ts b/__tests__/unit/node/markdown/plugins/image.test.ts index c2b56059..1745819d 100644 --- a/__tests__/unit/node/markdown/plugins/image.test.ts +++ b/__tests__/unit/node/markdown/plugins/image.test.ts @@ -123,9 +123,9 @@ describe('node/markdown/plugins/image', () => { }) describe('lazy loading', () => { - const mdLazy = createRenderer({ lazyLoading: true }) + const mdLazy = createRenderer({ lazyLoad: true }) - test('adds loading="lazy" when lazyLoading is enabled', async () => { + test('adds loading="lazy" when lazy loading is enabled', async () => { const html = await mdLazy.renderAsync('![logo](foo.png)') expect(html).toContain('loading="lazy"') diff --git a/docs/en/guide/markdown.md b/docs/en/guide/markdown.md index 5bdee9fa..5202c7cb 100644 --- a/docs/en/guide/markdown.md +++ b/docs/en/guide/markdown.md @@ -1024,14 +1024,14 @@ $$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$ ## Image Lazy Loading -You can enable lazy loading for each image added via markdown by setting `lazyLoading` to `true` in your config file: +You can enable lazy loading for each image added via markdown by setting `lazyLoad` to `true` in your config file: ```js export default { markdown: { image: { // image lazy loading is disabled by default - lazyLoading: true + lazyLoad: true } } } diff --git a/docs/es/guide/markdown.md b/docs/es/guide/markdown.md index 3bb1131d..7e1fc0aa 100644 --- a/docs/es/guide/markdown.md +++ b/docs/es/guide/markdown.md @@ -888,14 +888,14 @@ $$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$ ## _Lazy Loading_ de Imagenes {#image-lazy-loading} -Puede activar la "carga perezosa" para cada imagen adicionada via markdown definiendo `lazyLoading` como `true` en su archivo de configuración: +Puede activar la "carga perezosa" para cada imagen adicionada via markdown definiendo `lazyLoad` como `true` en su archivo de configuración: ```js export default { markdown: { image: { // la carga perezosa de imagenes está desactivada por defecto - lazyLoading: true + lazyLoad: true } } } diff --git a/docs/fa/guide/markdown.md b/docs/fa/guide/markdown.md index 05072193..ecce9f2e 100644 --- a/docs/fa/guide/markdown.md +++ b/docs/fa/guide/markdown.md @@ -880,14 +880,14 @@ $$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$ ## بارگذاری lazy تصویر {#image-lazy-loading} -می‌توانید بارگذاری تنبلی را برای هر تصویر اضافه شده از طریق Markdown با تنظیم `lazyLoading` به `true` در فایل پیکربندی فعال کنید: +می‌توانید بارگذاری تنبلی را برای هر تصویر اضافه شده از طریق Markdown با تنظیم `lazyLoad` به `true` در فایل پیکربندی فعال کنید: ```js export default { markdown: { image: { // بارگذاری تنبلی تصویر به طور پیش‌فرض غیرفعال است - lazyLoading: true + lazyLoad: true } } } diff --git a/docs/ja/guide/markdown.md b/docs/ja/guide/markdown.md index e2a7e91d..13dae321 100644 --- a/docs/ja/guide/markdown.md +++ b/docs/ja/guide/markdown.md @@ -996,14 +996,14 @@ $$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$ ## 画像の遅延読み込み {#image-lazy-loading} -Markdown で追加した各画像に対して遅延読み込みを有効化するには、設定ファイルで `lazyLoading` を `true` にします: +Markdown で追加した各画像に対して遅延読み込みを有効化するには、設定ファイルで `lazyLoad` を `true` にします: ```js export default { markdown: { image: { // 既定では画像の遅延読み込みは無効 - lazyLoading: true + lazyLoad: true } } } diff --git a/docs/ko/guide/markdown.md b/docs/ko/guide/markdown.md index 504ec6b1..c756d05e 100644 --- a/docs/ko/guide/markdown.md +++ b/docs/ko/guide/markdown.md @@ -925,14 +925,14 @@ $$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$ ## 이미지 지연 로딩 {#image-lazy-loading} -마크다운을 통해 추가된 각 이미지에 대해 지연 로딩을 활성화하려면 구성 파일에서 `lazyLoading`을 `true`로 설정하세요: +마크다운을 통해 추가된 각 이미지에 대해 지연 로딩을 활성화하려면 구성 파일에서 `lazyLoad`을 `true`로 설정하세요: ```js export default { markdown: { image: { // 이미지 지연 로딩은 기본적으로 비활성화 되어 있습니다 - lazyLoading: true + lazyLoad: true } } } diff --git a/docs/pt/guide/markdown.md b/docs/pt/guide/markdown.md index f8b410ec..1eef2c72 100644 --- a/docs/pt/guide/markdown.md +++ b/docs/pt/guide/markdown.md @@ -887,14 +887,14 @@ $$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$ ## _Lazy Loading_ de Imagens {#image-lazy-loading} -Você pode ativar o "carregamento folgado" para cada imagem adicionada via markdown definindo `lazyLoading` como `true` no seu arquivo de configuração: +Você pode ativar o "carregamento folgado" para cada imagem adicionada via markdown definindo `lazyLoad` como `true` no seu arquivo de configuração: ```js export default { markdown: { image: { // o carregamento folgado de imagens está desativado por padrão - lazyLoading: true + lazyLoad: true } } } diff --git a/docs/ru/guide/markdown.md b/docs/ru/guide/markdown.md index ea26b486..104f8790 100644 --- a/docs/ru/guide/markdown.md +++ b/docs/ru/guide/markdown.md @@ -996,14 +996,14 @@ $$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$ ## Ленивая загрузка изображений {#image-lazy-loading} -Вы можете включить ленивую загрузку для каждого изображения, добавленного через markdown, установив значение `true` для опции `lazyLoading` в вашем файле конфигурации: +Вы можете включить ленивую загрузку для каждого изображения, добавленного через markdown, установив значение `true` для опции `lazyLoad` в вашем файле конфигурации: ```js export default { markdown: { image: { // ленивая загрузка изображений отключена по умолчанию - lazyLoading: true + lazyLoad: true } } } diff --git a/docs/zh/guide/markdown.md b/docs/zh/guide/markdown.md index 6abc4d43..ba920391 100644 --- a/docs/zh/guide/markdown.md +++ b/docs/zh/guide/markdown.md @@ -888,14 +888,14 @@ $$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$ ## 图片懒加载 {#image-lazy-loading} -通过在配置文件中将 `lazyLoading` 设置为 `true`,可以为通过 markdown 添加的每张图片启用懒加载。 +通过在配置文件中将 `lazyLoad` 设置为 `true`,可以为通过 markdown 添加的每张图片启用懒加载。 ```js export default { markdown: { image: { // 默认禁用;设置为 true 可为所有图片启用懒加载。 - lazyLoading: true + lazyLoad: true } } } diff --git a/src/node/markdown/plugins/image.ts b/src/node/markdown/plugins/image.ts index 7d5f437b..13929275 100644 --- a/src/node/markdown/plugins/image.ts +++ b/src/node/markdown/plugins/image.ts @@ -13,13 +13,13 @@ export interface Options { * Support native lazy loading for the `` tag. * @default false */ - lazyLoading?: boolean + lazyLoad?: boolean } export const imagePlugin = ( md: MarkdownItAsync, publicDir: string, - { lazyLoading }: Options = {} + { lazyLoad }: Options = {} ) => { const imageRule = md.renderer.rules.image! md.renderer.rules.image = (tokens, idx, options, env: MarkdownEnv, self) => { @@ -40,7 +40,7 @@ export const imagePlugin = ( addImageDimensions(token, url, publicDir, env) } - if (lazyLoading && !token.attrGet('loading')) { + if (lazyLoad && !token.attrGet('loading')) { token.attrSet('loading', 'lazy') } From 27762eac86aa5c5d998de128734c2a8c10f78e23 Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Thu, 23 Jul 2026 23:05:26 +0530 Subject: [PATCH 024/136] refactor(markdown)!: remove deprecated `cjkFriendly` option BREAKING CHANGE: The deprecated `markdown.cjkFriendly` option has been removed. Use `markdown.cjkFriendlyEmphasis` instead. Co-Authored-By: Claude Fable 5 --- src/node/markdown/markdown.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/node/markdown/markdown.ts b/src/node/markdown/markdown.ts index 356acbbc..189fe424 100644 --- a/src/node/markdown/markdown.ts +++ b/src/node/markdown/markdown.ts @@ -223,11 +223,6 @@ export interface MarkdownOptions extends MarkdownItAsyncOptions { * @see https://github.com/tats-u/markdown-cjk-friendly */ cjkFriendlyEmphasis?: boolean - /** - * @see cjkFriendlyEmphasis - * @deprecated use `cjkFriendly` instead - */ - cjkFriendly?: boolean } export type MarkdownRenderer = MarkdownItAsync @@ -398,7 +393,7 @@ export async function createMarkdownRenderer( } } - if (options.cjkFriendlyEmphasis !== false && options.cjkFriendly !== false) { + if (options.cjkFriendlyEmphasis !== false) { mditCjkFriendly(md) } From 95c042039c62a9235e223f8da05a2075aa2234d7 Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Thu, 23 Jul 2026 23:07:38 +0530 Subject: [PATCH 025/136] refactor(theme)!: remove deprecated `outlineTitle` option BREAKING CHANGE: The deprecated `themeConfig.outlineTitle` option has been removed. Use `themeConfig.outline.label` instead. Co-Authored-By: Claude Fable 5 --- src/client/theme-default/composables/outline.ts | 1 - types/default-theme.d.ts | 7 ------- 2 files changed, 8 deletions(-) diff --git a/src/client/theme-default/composables/outline.ts b/src/client/theme-default/composables/outline.ts index e17a005c..067b2b1a 100644 --- a/src/client/theme-default/composables/outline.ts +++ b/src/client/theme-default/composables/outline.ts @@ -13,7 +13,6 @@ export function resolveTitle(theme: DefaultTheme.Config): string { (typeof theme.outline === 'object' && !Array.isArray(theme.outline) && theme.outline.label) || - theme.outlineTitle || 'On this page' ) } diff --git a/types/default-theme.d.ts b/types/default-theme.d.ts index 0b87539b..fa6985ac 100644 --- a/types/default-theme.d.ts +++ b/types/default-theme.d.ts @@ -30,13 +30,6 @@ export namespace DefaultTheme { */ outline?: Outline | Outline['level'] | false - /** - * @deprecated Use `outline.label` instead. - * - * @default 'On this page' - */ - outlineTitle?: string - /** * The nav items. */ From 18d1b4713c6634cc60e6b4a95430e05d51ec4812 Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Thu, 23 Jul 2026 23:08:05 +0530 Subject: [PATCH 026/136] refactor(theme)!: remove deprecated `lastUpdatedText` option Also point docs at `themeConfig.lastUpdated.text` instead of the removed option. BREAKING CHANGE: The deprecated `themeConfig.lastUpdatedText` option has been removed. Use `themeConfig.lastUpdated.text` instead. Co-Authored-By: Claude Fable 5 --- docs/en/guide/migration-from-vitepress-0.md | 2 +- docs/en/reference/site-config.md | 2 +- docs/es/reference/site-config.md | 2 +- docs/fa/guide/migration-from-vitepress-0.md | 2 +- docs/fa/reference/site-config.md | 2 +- docs/ja/reference/site-config.md | 2 +- docs/ko/guide/migration-from-vitepress-0.md | 2 +- docs/ko/reference/site-config.md | 2 +- docs/pt/reference/site-config.md | 2 +- docs/ru/guide/migration-from-vitepress-0.md | 2 +- docs/ru/reference/site-config.md | 2 +- docs/zh/guide/migration-from-vitepress-0.md | 2 +- docs/zh/reference/site-config.md | 2 +- .../theme-default/components/VPDocFooterLastUpdated.vue | 2 +- types/default-theme.d.ts | 9 --------- 15 files changed, 14 insertions(+), 23 deletions(-) diff --git a/docs/en/guide/migration-from-vitepress-0.md b/docs/en/guide/migration-from-vitepress-0.md index 29ab9a2a..342ab1ea 100644 --- a/docs/en/guide/migration-from-vitepress-0.md +++ b/docs/en/guide/migration-from-vitepress-0.md @@ -14,7 +14,7 @@ If you're coming from VitePress 0.x version, there're several breaking changes d - `repo`, `repoLabel`, `docsDir`, `docsBranch`, `editLinks`, `editLinkText` are removed in favor of more flexible api. - For adding GitHub link with icon to the nav, use [Social Links](../reference/default-theme-nav#navigation-links) feature. - For adding "Edit this page" feature, use [Edit Link](../reference/default-theme-edit-link) feature. -- `lastUpdated` option is now split into `config.lastUpdated` and `themeConfig.lastUpdatedText`. +- `lastUpdated` option is now split into `config.lastUpdated` and `themeConfig.lastUpdated.text`. - `carbonAds.carbon` is changed to `carbonAds.code`. ## Frontmatter Config diff --git a/docs/en/reference/site-config.md b/docs/en/reference/site-config.md index 8ddae74a..a9d9c4f1 100644 --- a/docs/en/reference/site-config.md +++ b/docs/en/reference/site-config.md @@ -536,7 +536,7 @@ This option injects an inline script that restores users settings from local sto Whether to get the last updated timestamp for each page using Git. The timestamp will be included in each page's page data, accessible via [`useData`](./runtime-api#usedata). -When using the default theme, enabling this option will display each page's last updated time. You can customize the text via [`themeConfig.lastUpdatedText`](./default-theme-config#lastupdatedtext) option. +When using the default theme, enabling this option will display each page's last updated time. You can customize the text via [`themeConfig.lastUpdated.text`](./default-theme-config#lastupdated) option. ## Customization diff --git a/docs/es/reference/site-config.md b/docs/es/reference/site-config.md index 3884b45d..7bc0c751 100644 --- a/docs/es/reference/site-config.md +++ b/docs/es/reference/site-config.md @@ -503,7 +503,7 @@ Esta opción inyecta un script en línea que restaura la configuración de los u Para obtener la marca de tiempo de la última actualización para cada página usando Git. El sello de fecha se incluirá en los datos de cada página, accesible a través de [`useData`](./runtime-api#usedata). -Cuando se utiliza el tema predeterminado, al habilitar esta opción se mostrará la última hora de actualización de cada página. Puedes personalizar el texto mediante la opción [`themeConfig.lastUpdatedText`](./default-theme-config#lastupdatedtext). +Cuando se utiliza el tema predeterminado, al habilitar esta opción se mostrará la última hora de actualización de cada página. Puedes personalizar el texto mediante la opción [`themeConfig.lastUpdated.text`](./default-theme-config#lastupdated). ## Personalización {#customization} diff --git a/docs/fa/guide/migration-from-vitepress-0.md b/docs/fa/guide/migration-from-vitepress-0.md index 211bb0f9..131e0d2b 100644 --- a/docs/fa/guide/migration-from-vitepress-0.md +++ b/docs/fa/guide/migration-from-vitepress-0.md @@ -14,7 +14,7 @@ - `repo`، `repoLabel`، `docsDir`، `docsBranch`، `editLinks`، `editLinkText` به منظور API انعطاف‌پذیرتر حذف شده‌اند. - برای اضافه کردن لینک GitHub با آیکون به نوار ناوبری، از ویژگی [پیوندهای اجتماعی](../reference/default-theme-nav#navigation-links) استفاده کنید. - برای اضافه کردن ویژگی "ویرایش این صفحه"، از ویژگی [پیوند ویرایش](../reference/default-theme-edit-link) استفاده کنید. -- گزینه `lastUpdated` حالا به `config.lastUpdated` و `themeConfig.lastUpdatedText` تقسیم شده است. +- گزینه `lastUpdated` حالا به `config.lastUpdated` و `themeConfig.lastUpdated.text` تقسیم شده است. - `carbonAds.carbon` به `carbonAds.code` تغییر کرده است. ## پیکربندی Frontmatter diff --git a/docs/fa/reference/site-config.md b/docs/fa/reference/site-config.md index 82a3c55b..072cfa08 100644 --- a/docs/fa/reference/site-config.md +++ b/docs/fa/reference/site-config.md @@ -507,7 +507,7 @@ export default { آیا زمان آخرین به‌روزرسانی برای هر صفحه با استفاده از Git دریافت شود. این زمان در داده‌های هر صفحه گنجانده خواهد شد و از طریق [`useData`](./runtime-api#usedata) قابل دسترسی خواهد بود. -وقتی از تم پیش‌فرض استفاده می‌کنید، فعال کردن این گزینه زمان آخرین به‌روزرسانی هر صفحه را نمایش می‌دهد. می‌توانید متن را از طریق گزینه [`themeConfig.lastUpdatedText`](./default-theme-config#lastupdatedtext) سفارشی کنید. +وقتی از تم پیش‌فرض استفاده می‌کنید، فعال کردن این گزینه زمان آخرین به‌روزرسانی هر صفحه را نمایش می‌دهد. می‌توانید متن را از طریق گزینه [`themeConfig.lastUpdated.text`](./default-theme-config#lastupdated) سفارشی کنید. ## سفارشی‌سازی {#customization} diff --git a/docs/ja/reference/site-config.md b/docs/ja/reference/site-config.md index a8e7f04b..6d7c3130 100644 --- a/docs/ja/reference/site-config.md +++ b/docs/ja/reference/site-config.md @@ -505,7 +505,7 @@ export default { Git を使って各ページの最終更新時刻を取得します。タイムスタンプは各ページのデータに含まれ、[`useData`](./runtime-api#usedata) から参照できます。 -デフォルトテーマ使用時にこのオプションを有効にすると、各ページの最終更新時刻が表示されます。テキストは [`themeConfig.lastUpdatedText`](./default-theme-config#lastupdatedtext) でカスタマイズ可能です。 +デフォルトテーマ使用時にこのオプションを有効にすると、各ページの最終更新時刻が表示されます。テキストは [`themeConfig.lastUpdated.text`](./default-theme-config#lastupdated) でカスタマイズ可能です。 ## カスタマイズ {#customization} diff --git a/docs/ko/guide/migration-from-vitepress-0.md b/docs/ko/guide/migration-from-vitepress-0.md index f3ba5293..d1dad78c 100644 --- a/docs/ko/guide/migration-from-vitepress-0.md +++ b/docs/ko/guide/migration-from-vitepress-0.md @@ -14,7 +14,7 @@ If you're coming from VitePress 0.x version, there're several breaking changes d - `repo`, `repoLabel`, `docsDir`, `docsBranch`, `editLinks`, `editLinkText` are removed in favor of more flexible api. - For adding GitHub link with icon to the nav, use [Social Links](../reference/default-theme-nav#navigation-links) feature. - For adding "Edit this page" feature, use [Edit Link](../reference/default-theme-edit-link) feature. -- `lastUpdated` option is now split into `config.lastUpdated` and `themeConfig.lastUpdatedText`. +- `lastUpdated` option is now split into `config.lastUpdated` and `themeConfig.lastUpdated.text`. - `carbonAds.carbon` is changed to `carbonAds.code`. ## Frontmatter Config {#frontmatter-config} diff --git a/docs/ko/reference/site-config.md b/docs/ko/reference/site-config.md index 53e94d52..074cf43f 100644 --- a/docs/ko/reference/site-config.md +++ b/docs/ko/reference/site-config.md @@ -505,7 +505,7 @@ export default { 각 페이지의 마지막 업데이트 타임스탬프를 Git을 사용하여 가져올지 여부를 설정합니다. 타임스탬프는 각 페이지의 페이지 데이터에 포함되며, [`useData`](./runtime-api#usedata)를 통해 접근할 수 있습니다. -기본 테마를 사용할 때, 이 옵션을 활성화하면 각 페이지의 마지막 업데이트 시간이 표시됩니다. [`themeConfig.lastUpdatedText`](./default-theme-config#lastupdatedtext) 옵션을 통해 텍스트를 커스터마이징할 수 있습니다. +기본 테마를 사용할 때, 이 옵션을 활성화하면 각 페이지의 마지막 업데이트 시간이 표시됩니다. [`themeConfig.lastUpdated.text`](./default-theme-config#lastupdated) 옵션을 통해 텍스트를 커스터마이징할 수 있습니다. ## 커스터마이징 {#customization} diff --git a/docs/pt/reference/site-config.md b/docs/pt/reference/site-config.md index d1125d1d..068fb43f 100644 --- a/docs/pt/reference/site-config.md +++ b/docs/pt/reference/site-config.md @@ -503,7 +503,7 @@ Esta opção injeta um script em linha que restaura as configurações dos usuá Para obter o selo de tempo da última atualização para cada página usando o Git. O selo de data será incluído nos dados de cada página, acessíveis via [`useData`](./runtime-api#usedata). -Ao usar o tema padrão, habilitar esta opção exibirá o horário da última atualização de cada página. Você pode personalizar o texto via opção [`themeConfig.lastUpdatedText`](./default-theme-config#lastupdatedtext). +Ao usar o tema padrão, habilitar esta opção exibirá o horário da última atualização de cada página. Você pode personalizar o texto via opção [`themeConfig.lastUpdated.text`](./default-theme-config#lastupdated). ## Personalização {#customization} diff --git a/docs/ru/guide/migration-from-vitepress-0.md b/docs/ru/guide/migration-from-vitepress-0.md index 4d5c7426..5c339a57 100644 --- a/docs/ru/guide/migration-from-vitepress-0.md +++ b/docs/ru/guide/migration-from-vitepress-0.md @@ -14,7 +14,7 @@ - `repo`, `repoLabel`, `docsDir`, `docsBranch`, `editLinks`, `editLinkText` удалены в пользу более гибкого api. - Для добавления ссылки GitHub с иконкой в навигацию используйте функцию [Социальные ссылки](../reference/default-theme-nav#navigation-links). - Для добавления ссылки «Редактировать эту страницу» используйте функцию [Ссылка для редактирования](../reference/default-theme-edit-link). -- Опция `lastUpdated` теперь разделена на `config.lastUpdated` и `themeConfig.lastUpdatedText`. +- Опция `lastUpdated` теперь разделена на `config.lastUpdated` и `themeConfig.lastUpdated.text`. - Опция `carbonAds.carbon` заменена на `carbonAds.code`. ## Конфигурация метаданных diff --git a/docs/ru/reference/site-config.md b/docs/ru/reference/site-config.md index bc54a368..a82e907f 100644 --- a/docs/ru/reference/site-config.md +++ b/docs/ru/reference/site-config.md @@ -536,7 +536,7 @@ export default { Получать ли временную метку последнего обновления для каждой страницы с помощью Git. Временная метка будет включена в данные каждой страницы, доступные через [`useData`](./runtime-api#usedata). -При использовании темы по умолчанию включение этой опции приведёт к отображению времени последнего обновления каждой страницы. Вы можете настроить текст с помощью опции [`themeConfig.lastUpdatedText`](./default-theme-config#lastupdatedtext). +При использовании темы по умолчанию включение этой опции приведёт к отображению времени последнего обновления каждой страницы. Вы можете настроить текст с помощью опции [`themeConfig.lastUpdated.text`](./default-theme-config#lastupdated). ## Кастомизация {#customization} diff --git a/docs/zh/guide/migration-from-vitepress-0.md b/docs/zh/guide/migration-from-vitepress-0.md index 64f9460e..34656f00 100644 --- a/docs/zh/guide/migration-from-vitepress-0.md +++ b/docs/zh/guide/migration-from-vitepress-0.md @@ -14,7 +14,7 @@ - 删除了 `repo`、`repoLabel`、`docsDir`、`docsBranch`、`editLinks`、`editLinkText`,以支持更灵活的 API。 - 要将带有图标的 GitHub 链接添加到导航,请使用 [社交链接](../reference/default-theme-config#nav) 功能。 - 要添加“编辑此页面”功能,请使用 [编辑链接](../reference/default-theme-edit-link) 功能。 -- `lastUpdated` 选项现在分为 `config.lastUpdated` 和 `themeConfig.lastUpdatedText`。 +- `lastUpdated` 选项现在分为 `config.lastUpdated` 和 `themeConfig.lastUpdated.text`。 - `carbonAds.carbon` 更改为 `carbonAds.code`。 ## frontmatter 配置 {#frontmatter-config} diff --git a/docs/zh/reference/site-config.md b/docs/zh/reference/site-config.md index e47cb364..2f3571a2 100644 --- a/docs/zh/reference/site-config.md +++ b/docs/zh/reference/site-config.md @@ -503,7 +503,7 @@ export default { 是否使用 Git 获取每个页面的最后更新时间戳。时间戳将包含在每个页面的页面数据中,可通过 [`useData`](./runtime-api#usedata) 访问。 -使用默认主题时,启用此选项将显示每个页面的最后更新时间。可以通过 [`themeConfig.lastUpdatedText`](./default-theme-config#lastupdatedtext) 选项自定义文本。 +使用默认主题时,启用此选项将显示每个页面的最后更新时间。可以通过 [`themeConfig.lastUpdated.text`](./default-theme-config#lastupdated) 选项自定义文本。 ## 自定义 {#customization} diff --git a/src/client/theme-default/components/VPDocFooterLastUpdated.vue b/src/client/theme-default/components/VPDocFooterLastUpdated.vue index 576a87d4..6f15479e 100644 --- a/src/client/theme-default/components/VPDocFooterLastUpdated.vue +++ b/src/client/theme-default/components/VPDocFooterLastUpdated.vue @@ -39,7 +39,7 @@ onMounted(() => { diff --git a/types/default-theme.d.ts b/types/default-theme.d.ts index fa6985ac..52c79de6 100644 --- a/types/default-theme.d.ts +++ b/types/default-theme.d.ts @@ -55,15 +55,6 @@ export namespace DefaultTheme { */ editLink?: EditLink - /** - * @deprecated Use `lastUpdated.text` instead. - * - * Set custom last updated text. - * - * @default 'Last updated' - */ - lastUpdatedText?: string - lastUpdated?: LastUpdatedOptions /** From cec499869f02313337993a7f2ad381f0f9d9dafd Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Thu, 23 Jul 2026 23:08:22 +0530 Subject: [PATCH 027/136] refactor(theme)!: remove deprecated `disableDetailedView` local search option BREAKING CHANGE: The deprecated `disableDetailedView` option of local search has been removed. Use `detailedView: false` instead. Co-Authored-By: Claude Fable 5 --- src/client/theme-default/components/VPLocalSearchBox.vue | 3 +-- types/default-theme.d.ts | 6 ------ 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/client/theme-default/components/VPLocalSearchBox.vue b/src/client/theme-default/components/VPLocalSearchBox.vue index 28a46a2f..fa6af65e 100644 --- a/src/client/theme-default/components/VPLocalSearchBox.vue +++ b/src/client/theme-default/components/VPLocalSearchBox.vue @@ -117,8 +117,7 @@ const showDetailedList = useLocalStorage( const disableDetailedView = computed(() => { return ( theme.value.search?.provider === 'local' && - (theme.value.search.options?.disableDetailedView === true || - theme.value.search.options?.detailedView === false) + theme.value.search.options?.detailedView === false ) }) diff --git a/types/default-theme.d.ts b/types/default-theme.d.ts index 52c79de6..a8266bd3 100644 --- a/types/default-theme.d.ts +++ b/types/default-theme.d.ts @@ -343,12 +343,6 @@ export namespace DefaultTheme { // local search -------------------------------------------------------------- export interface LocalSearchOptions { - /** - * @default false - * @deprecated Use `detailedView: false` instead. - */ - disableDetailedView?: boolean - /** * If `true`, the detailed view will be enabled by default. * If `false`, the detailed view will be disabled. From e6ba9d8caa3866215095f63b62290f3110e523fd Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Thu, 23 Jul 2026 23:43:31 +0530 Subject: [PATCH 028/136] fix(build): don't rely on checkout directory name when externalizing types The `typesExternal` regex matched the absolute build path against `/vitepress/`, so repo-root `.d.ts` files (types/*) were only kept external when the repo was checked out in a directory named "vitepress". When built elsewhere, `DefaultTheme` got inlined into `dist/node/index.d.ts`, orphaning the `declare module` augmentations from `defaultTheme.ts` and breaking node-only options like `search.options._render` (regressed in v2.0.0-alpha.18). Compare paths resolved against this config's directory instead, normalized for separators and drive-letter casing so it also works on windows. Co-Authored-By: Claude Fable 5 --- rollup.config.ts | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/rollup.config.ts b/rollup.config.ts index 23c9d41f..7f040f6f 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -5,6 +5,7 @@ import { nodeResolve } from '@rollup/plugin-node-resolve' import replace from '@rollup/plugin-replace' import { rm } from 'node:fs/promises' import { builtinModules, createRequire } from 'node:module' +import { fileURLToPath } from 'node:url' import { type RollupOptions, defineConfig } from 'rollup' import dts from 'rollup-plugin-dts' import esbuild from 'rollup-plugin-esbuild' @@ -53,11 +54,27 @@ const esmBuild: RollupOptions = { } } -const typesExternal = [ - ...external, - /\/vitepress\/(?!(dist|node_modules|vitepress)\/).*\.d\.ts$/, - /^markdown-it(?:\/|$)/ -] +// keep .d.ts files under the repo root (e.g. types/*) external so module +// augmentations in the bundle still target the same files users reference. +// compared on normalized resolved paths so this works regardless of the +// checkout location, path separators, or drive-letter casing. +const normalizePath = (id: string): string => { + const normalized = id.replaceAll('\\', '/') + return process.platform === 'win32' ? normalized.toLowerCase() : normalized +} + +const root = normalizePath(fileURLToPath(new URL('.', import.meta.url))) + +const typesExternal = (id: string): boolean => { + if (external.includes(id) || /^markdown-it(?:\/|$)/.test(id)) return true + const normalized = normalizePath(id) + return ( + normalized.endsWith('.d.ts') && + normalized.startsWith(root) && + !normalized.startsWith(`${root}dist/`) && + !normalized.startsWith(`${root}node_modules/`) + ) +} const dtsNode = dts({ respectExternal: true, From 572bc63bd8f2a89318b7ce64eb344114d1235891 Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Thu, 23 Jul 2026 23:43:38 +0530 Subject: [PATCH 029/136] docs: remove unsupported `threadDepthExceededMessage` translation The key only exists in DocSearch v5 - @docsearch/js 4.6.3 ignores it. Co-Authored-By: Claude Fable 5 --- docs/es/config.ts | 2 -- docs/fa/config.ts | 2 -- docs/ja/config.ts | 2 -- docs/ko/config.ts | 2 -- docs/pt/config.ts | 2 -- docs/ru/config.ts | 2 -- docs/snippets/algolia-i18n.ts | 1 - docs/zh/config.ts | 1 - 8 files changed, 14 deletions(-) diff --git a/docs/es/config.ts b/docs/es/config.ts index 382ad71b..bb31ca42 100644 --- a/docs/es/config.ts +++ b/docs/es/config.ts @@ -267,8 +267,6 @@ function searchOptions(): Partial { afterToolCallText: 'Buscado', stoppedStreamingText: 'Has detenido esta respuesta', errorTitleText: 'Error de chat', - threadDepthExceededMessage: - 'Esta conversación se ha cerrado para mantener respuestas precisas.', startNewConversationButtonText: 'Iniciar una nueva conversación' } } diff --git a/docs/fa/config.ts b/docs/fa/config.ts index c3b34727..c8deee05 100644 --- a/docs/fa/config.ts +++ b/docs/fa/config.ts @@ -264,8 +264,6 @@ function searchOptions(): Partial { afterToolCallText: 'جستجو برای', stoppedStreamingText: 'شما این پاسخ را متوقف کردید', errorTitleText: 'خطای گفتگو', - threadDepthExceededMessage: - 'برای حفظ دقت پاسخ ها، این گفت وگو بسته شد.', startNewConversationButtonText: 'شروع گفت وگوی جدید' } } diff --git a/docs/ja/config.ts b/docs/ja/config.ts index bc92b006..c2119b10 100644 --- a/docs/ja/config.ts +++ b/docs/ja/config.ts @@ -231,8 +231,6 @@ function searchOptions(): Partial { afterToolCallText: '検索しました', stoppedStreamingText: 'この応答を停止しました', errorTitleText: 'チャットエラー', - threadDepthExceededMessage: - '回答の正確性を保つため、この会話は終了しました。', startNewConversationButtonText: '新しい会話を開始' } } diff --git a/docs/ko/config.ts b/docs/ko/config.ts index 7a275cd3..22a96ed8 100644 --- a/docs/ko/config.ts +++ b/docs/ko/config.ts @@ -303,8 +303,6 @@ function searchOptions(): Partial { afterToolCallText: '검색함', stoppedStreamingText: '이 응답을 중지했습니다', errorTitleText: '채팅 오류', - threadDepthExceededMessage: - '정확성을 유지하기 위해 이 대화는 종료되었습니다.', startNewConversationButtonText: '새 대화 시작' } } diff --git a/docs/pt/config.ts b/docs/pt/config.ts index 193eb2f4..5431fc36 100644 --- a/docs/pt/config.ts +++ b/docs/pt/config.ts @@ -264,8 +264,6 @@ function searchOptions(): Partial { afterToolCallText: 'Pesquisado', stoppedStreamingText: 'Você interrompeu esta resposta', errorTitleText: 'Erro no chat', - threadDepthExceededMessage: - 'Esta conversa foi encerrada para manter respostas precisas.', startNewConversationButtonText: 'Iniciar uma nova conversa' } } diff --git a/docs/ru/config.ts b/docs/ru/config.ts index 86f8452a..129a5db3 100644 --- a/docs/ru/config.ts +++ b/docs/ru/config.ts @@ -262,8 +262,6 @@ function searchOptions(): Partial { afterToolCallText: 'Искал', stoppedStreamingText: 'Вы остановили этот ответ', errorTitleText: 'Ошибка чата', - threadDepthExceededMessage: - 'Этот разговор закрыт, чтобы сохранить точность ответов.', startNewConversationButtonText: 'Начать новый разговор' } } diff --git a/docs/snippets/algolia-i18n.ts b/docs/snippets/algolia-i18n.ts index c57816c3..0dfa5107 100644 --- a/docs/snippets/algolia-i18n.ts +++ b/docs/snippets/algolia-i18n.ts @@ -89,7 +89,6 @@ export default defineConfig({ afterToolCallText: '已搜索', stoppedStreamingText: '你已停止此回复', errorTitleText: '聊天错误', - threadDepthExceededMessage: '为保持回答准确,此对话已关闭。', startNewConversationButtonText: '开始新的对话' } } diff --git a/docs/zh/config.ts b/docs/zh/config.ts index 9769c1a9..99fbdf86 100644 --- a/docs/zh/config.ts +++ b/docs/zh/config.ts @@ -250,7 +250,6 @@ function searchOptions(): Partial { afterToolCallText: '已搜索', stoppedStreamingText: '你已停止此回复', errorTitleText: '聊天错误', - threadDepthExceededMessage: '为保持回答准确,此对话已关闭。', startNewConversationButtonText: '开始新的对话' } } From 6bbd04e0bfa6576f8e433efeca2ba32222f635f4 Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Thu, 23 Jul 2026 23:43:46 +0530 Subject: [PATCH 030/136] test: type-check tests and docs - split __tests__/tsconfig.json into per-suite projects so unit tests check against src (via path aliases) while e2e/init check against the built package, avoiding mixing both type universes in one program - explicitly include the .vitepress dir in the e2e project - dotted directories are skipped by default, so it was never type-checked - add a `*.vue` shim for the e2e custom theme (named env.d.ts because a shims.d.ts would be dropped in favor of the adjacent shims.ts) - add a tsconfig for docs, checked with vue-tsc - wire everything into `pnpm test` as `test:types` Co-Authored-By: Claude Fable 5 --- __tests__/e2e/env.d.ts | 5 +++++ __tests__/e2e/tsconfig.json | 4 ++++ __tests__/init/tsconfig.json | 3 +++ __tests__/tsconfig.json | 8 ++------ __tests__/unit/tsconfig.json | 18 ++++++++++++++++++ docs/tsconfig.json | 8 ++++++++ package.json | 3 ++- 7 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 __tests__/e2e/env.d.ts create mode 100644 __tests__/e2e/tsconfig.json create mode 100644 __tests__/init/tsconfig.json create mode 100644 __tests__/unit/tsconfig.json create mode 100644 docs/tsconfig.json diff --git a/__tests__/e2e/env.d.ts b/__tests__/e2e/env.d.ts new file mode 100644 index 00000000..a99cf76c --- /dev/null +++ b/__tests__/e2e/env.d.ts @@ -0,0 +1,5 @@ +declare module '*.vue' { + import type { DefineComponent } from 'vue' + const component: DefineComponent + export default component +} diff --git a/__tests__/e2e/tsconfig.json b/__tests__/e2e/tsconfig.json new file mode 100644 index 00000000..44878152 --- /dev/null +++ b/__tests__/e2e/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../tsconfig.json", + "include": ["**/*", ".vitepress/**/*"] +} diff --git a/__tests__/init/tsconfig.json b/__tests__/init/tsconfig.json new file mode 100644 index 00000000..3c43903c --- /dev/null +++ b/__tests__/init/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json" +} diff --git a/__tests__/tsconfig.json b/__tests__/tsconfig.json index 9cce3a1e..366c4ab8 100644 --- a/__tests__/tsconfig.json +++ b/__tests__/tsconfig.json @@ -1,12 +1,8 @@ { "extends": "../tsconfig.json", "compilerOptions": { + "noEmit": true, "isolatedModules": false, - "types": ["node", "vitest/globals"], - "paths": { - "client/*": ["../src/client/*"], - "node/*": ["../src/node/*"], - "shared/*": ["../src/shared/*"] - } + "types": ["node", "vitest/globals"] } } diff --git a/__tests__/unit/tsconfig.json b/__tests__/unit/tsconfig.json new file mode 100644 index 00000000..f7ff2329 --- /dev/null +++ b/__tests__/unit/tsconfig.json @@ -0,0 +1,18 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "types": [ + "node", + "vitest/globals", + "vite/client", + "../../src/client/shims.d.ts" + ], + "paths": { + "client/*": ["../../src/client/*"], + "node/*": ["../../src/node/*"], + "shared/*": ["../../src/shared/*"], + "vitepress": ["../../src/client/index.ts"], + "vitepress/theme": ["../../theme.d.ts"] + } + } +} diff --git a/docs/tsconfig.json b/docs/tsconfig.json new file mode 100644 index 00000000..c3617830 --- /dev/null +++ b/docs/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "noEmit": true, + "types": ["node"] + }, + "include": ["**/*", ".vitepress/**/*"] +} diff --git a/package.json b/package.json index 53245c46..44fd3a7f 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,8 @@ "build:prepare": "pnpm clean && node scripts/copyShared.ts", "build:client": "vue-tsc --noEmit -p src/client && tsc -p src/client && node scripts/copyClient.ts", "build:node": "tsc -p src/node --noEmit && rollup --config rollup.config.ts --configPlugin esbuild", - "test": "pnpm --aggregate-output --reporter=append-only '/^test:(unit|e2e|init)$/'", + "test": "pnpm --aggregate-output --reporter=append-only '/^test:(types|unit|e2e|init)$/'", + "test:types": "tsc -p __tests__/unit && tsc -p __tests__/e2e && tsc -p __tests__/init && vue-tsc -p docs", "test:unit": "vitest run -r __tests__/unit", "test:unit:watch": "vitest -r __tests__/unit", "test:e2e": "pnpm test:e2e-dev && pnpm test:e2e-build", From bffe1e14125220d465a94cc629260e19bff48e0c Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Fri, 24 Jul 2026 00:16:44 +0530 Subject: [PATCH 031/136] feat(markdown): allow disabling table `tabindex` attribute Moves the inline table_open rule into its own plugin file and adds a `markdown.tableTabIndex` option (default true) to disable it. Co-Authored-By: Claude Fable 5 --- src/node/markdown/markdown.ts | 15 ++++++++------- src/node/markdown/plugins/table.ts | 14 ++++++++++++++ 2 files changed, 22 insertions(+), 7 deletions(-) create mode 100644 src/node/markdown/plugins/table.ts diff --git a/src/node/markdown/markdown.ts b/src/node/markdown/markdown.ts index 189fe424..fb6638dc 100644 --- a/src/node/markdown/markdown.ts +++ b/src/node/markdown/markdown.ts @@ -38,6 +38,7 @@ import { linkPlugin } from './plugins/link' import { preWrapperPlugin } from './plugins/preWrapper' import { restoreEntities } from './plugins/restoreEntities' import { snippetPlugin } from './plugins/snippet' +import { tablePlugin } from './plugins/table' export type { Header } from '../shared' @@ -216,6 +217,11 @@ export interface MarkdownOptions extends MarkdownItAsyncOptions { * @see https://vitepress.dev/guide/markdown#github-flavored-alerts */ gfmAlerts?: boolean + /** + * Add `tabindex="0"` to tables so keyboard users can focus and scroll them. + * @default true + */ + tableTabIndex?: boolean /** * Allows disabling the CJK-friendly plugin. * This plugin adds support for emphasis marks (**bold**) in Japanese, Chinese, and Korean text. @@ -291,13 +297,8 @@ export async function createMarkdownRenderer( ) lineNumberPlugin(md, options.lineNumbers) - const tableOpen = md.renderer.rules.table_open - md.renderer.rules.table_open = function (tokens, idx, options, env, self) { - const token = tokens[idx] - if (token.attrIndex('tabindex') < 0) token.attrPush(['tabindex', '0']) - return tableOpen - ? tableOpen(tokens, idx, options, env, self) - : self.renderToken(tokens, idx, options) + if (options.tableTabIndex !== false) { + tablePlugin(md) } if (options.gfmAlerts !== false) { diff --git a/src/node/markdown/plugins/table.ts b/src/node/markdown/plugins/table.ts new file mode 100644 index 00000000..edc06339 --- /dev/null +++ b/src/node/markdown/plugins/table.ts @@ -0,0 +1,14 @@ +import type { MarkdownItAsync } from 'markdown-it-async' + +// adds tabindex="0" to tables so they are focusable and can be +// scrolled with the keyboard when they overflow horizontally +export const tablePlugin = (md: MarkdownItAsync) => { + const tableOpen = md.renderer.rules.table_open + md.renderer.rules.table_open = function (tokens, idx, options, env, self) { + const token = tokens[idx] + if (token.attrIndex('tabindex') < 0) token.attrPush(['tabindex', '0']) + return tableOpen + ? tableOpen(tokens, idx, options, env, self) + : self.renderToken(tokens, idx, options) + } +} From e235dbeb8aef1213d0de9efafe0ccb758acd267a Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Fri, 24 Jul 2026 00:17:03 +0530 Subject: [PATCH 032/136] feat(markdown)!: support `attrs: false` for disabling attrs plugin BREAKING CHANGE: The `markdown.attrs.disable` option has been removed. Set `markdown.attrs` to `false` instead. Co-Authored-By: Claude Fable 5 --- src/node/markdown/markdown.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/node/markdown/markdown.ts b/src/node/markdown/markdown.ts index fb6638dc..299350c6 100644 --- a/src/node/markdown/markdown.ts +++ b/src/node/markdown/markdown.ts @@ -158,10 +158,10 @@ export interface MarkdownOptions extends MarkdownItAsyncOptions { */ anchor?: anchorPlugin.AnchorOptions /** - * Options for `markdown-it-attrs` + * Options for `markdown-it-attrs`. Set to `false` to disable. * @see https://github.com/arve0/markdown-it-attrs */ - attrs?: MarkdownItAttrsOptions & { disable?: boolean } + attrs?: MarkdownItAttrsOptions | false /** * Options for `markdown-it-emoji` * @see https://github.com/markdown-it/markdown-it-emoji @@ -306,7 +306,7 @@ export async function createMarkdownRenderer( } // third party plugins - if (!options.attrs?.disable) { + if (options.attrs !== false) { attrsPlugin(md, options.attrs) } emojiPlugin(md, options.emoji) From b8d9c8f9a92ec4e8c877d6c28fee26b3c379876c Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Fri, 24 Jul 2026 00:20:18 +0530 Subject: [PATCH 033/136] feat(markdown): support disabling built-in markdown plugins Allows custom themes to opt out of markup and behavior added on top of vanilla markdown rendering: - `anchor`, `emoji`, `toc`, `component`, `image` now also accept `false` - new `preWrapper` and `snippet` boolean options (default true) - `lineNumbers` is a no-op when `preWrapper` is disabled, as its markup depends on the wrapper close #4484 close #4556 Co-Authored-By: Claude Fable 5 --- __tests__/unit/node/markdown/markdown.test.ts | 105 +++++++++++ src/node/markdown/markdown.ts | 175 +++++++++++------- 2 files changed, 213 insertions(+), 67 deletions(-) create mode 100644 __tests__/unit/node/markdown/markdown.test.ts diff --git a/__tests__/unit/node/markdown/markdown.test.ts b/__tests__/unit/node/markdown/markdown.test.ts new file mode 100644 index 00000000..e8219a54 --- /dev/null +++ b/__tests__/unit/node/markdown/markdown.test.ts @@ -0,0 +1,105 @@ +import { + createMarkdownRenderer, + disposeMdItInstance, + type MarkdownOptions +} from 'node/markdown/markdown' + +async function render(src: string, options: MarkdownOptions = {}) { + disposeMdItInstance() + const md = await createMarkdownRenderer('.', { + highlight: (code) => code, + ...options + }) + return md.renderAsync(src) +} + +describe('node/markdown/markdown', () => { + describe('disabling built-in plugins', () => { + test('anchor', async () => { + const enabled = await render('# Hello World') + expect(enabled).toContain('id="hello-world"') + expect(enabled).toContain('header-anchor') + + const disabled = await render('# Hello World', { anchor: false }) + expect(disabled).not.toContain('id=') + expect(disabled).not.toContain('header-anchor') + }) + + test('attrs', async () => { + const enabled = await render('## Title {#custom-id}') + expect(enabled).toContain('id="custom-id"') + + const disabled = await render('## Title {#custom-id}', { attrs: false }) + expect(disabled).not.toContain('id="custom-id"') + expect(disabled).toContain('{#custom-id}') + }) + + test('emoji', async () => { + expect(await render(':tada:')).toContain('🎉') + expect(await render(':tada:', { emoji: false })).toContain(':tada:') + }) + + test('toc', async () => { + const src = '# Title\n\n[[toc]]' + expect(await render(src)).toContain('table-of-contents') + + const disabled = await render(src, { toc: false }) + expect(disabled).not.toContain('table-of-contents') + expect(disabled).toContain('[[toc]]') + }) + + test('preWrapper', async () => { + const src = '```js\nconst a = 1\n```' + const enabled = await render(src) + expect(enabled).toContain('
') + expect(enabled).toContain('class="copy"') + + const disabled = await render(src, { preWrapper: false }) + expect(disabled).not.toContain('
') + expect(disabled).not.toContain('class="copy"') + }) + + test('preWrapper disables line numbers with it', async () => { + const src = '```js\nconst a = 1\n```' + const enabled = await render(src, { lineNumbers: true }) + expect(enabled).toContain('line-numbers-wrapper') + + const disabled = await render(src, { + preWrapper: false, + lineNumbers: true + }) + expect(disabled).not.toContain('line-numbers-wrapper') + }) + + test('snippet', async () => { + const disabled = await render('<<< ./foo.js', { snippet: false }) + expect(disabled).toContain('<<< ./foo.js') + }) + + test('image', async () => { + const src = '![img](/foo.png)' + const enabled = await render(src, { image: { lazyLoad: true } }) + expect(enabled).toContain('loading="lazy"') + + const disabled = await render(src, { image: false }) + expect(disabled).not.toContain('loading="lazy"') + }) + + test('component', async () => { + const src = 'text\n\nmore' + const enabled = await render(src) + expect(enabled).toContain('

\n

') + + const disabled = await render(src, { component: false }) + expect(disabled).toContain('

text\n\nmore

') + }) + + test('tableTabIndex', async () => { + const src = '| a |\n| --- |\n| b |' + expect(await render(src)).toContain('tabindex="0"') + expect(await render(src, { tableTabIndex: false })).not.toContain( + 'tabindex' + ) + }) + }) +}) diff --git a/src/node/markdown/markdown.ts b/src/node/markdown/markdown.ts index 299350c6..6293b7bc 100644 --- a/src/node/markdown/markdown.ts +++ b/src/node/markdown/markdown.ts @@ -121,10 +121,17 @@ export interface MarkdownOptions extends MarkdownItAsyncOptions { */ languageLabel?: Record /** - * Show line numbers in code blocks + * Show line numbers in code blocks. Requires the `preWrapper` plugin. * @default false */ lineNumbers?: boolean + /** + * Wrap code blocks in a container carrying the language label and the + * copy button. The default theme's code block styling relies on this + * markup. Disabling it also disables `lineNumbers`. + * @default true + */ + preWrapper?: boolean /** * Fallback language when the specified language is not available. */ @@ -153,24 +160,28 @@ export interface MarkdownOptions extends MarkdownItAsyncOptions { /* ==================== Markdown It Plugins ==================== */ /** - * Options for `markdown-it-anchor` + * Options for `markdown-it-anchor`. Set to `false` to disable adding ids + * and anchor links to headings. Note that the default theme's outline and + * heading hash links rely on these ids. * @see https://github.com/valeriangalliat/markdown-it-anchor */ - anchor?: anchorPlugin.AnchorOptions + anchor?: anchorPlugin.AnchorOptions | false /** * Options for `markdown-it-attrs`. Set to `false` to disable. * @see https://github.com/arve0/markdown-it-attrs */ attrs?: MarkdownItAttrsOptions | false /** - * Options for `markdown-it-emoji` + * Options for `markdown-it-emoji`. Set to `false` to disable. * @see https://github.com/markdown-it/markdown-it-emoji */ - emoji?: { - defs?: Record - enabled?: string[] - shortcuts?: Record - } + emoji?: + | { + defs?: Record + enabled?: string[] + shortcuts?: Record + } + | false /** * Options for `@mdit-vue/plugin-frontmatter` * @see https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-frontmatter @@ -187,15 +198,22 @@ export interface MarkdownOptions extends MarkdownItAsyncOptions { */ sfc?: SfcPluginOptions /** - * Options for `@mdit-vue/plugin-toc` + * Options for `@mdit-vue/plugin-toc`. Set to `false` to disable the + * `[[toc]]` syntax. * @see https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-toc */ - toc?: TocPluginOptions + toc?: TocPluginOptions | false /** - * Options for `@mdit-vue/plugin-component` + * Options for `@mdit-vue/plugin-component`. Set to `false` to disable. * @see https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-component */ - component?: ComponentPluginOptions + component?: ComponentPluginOptions | false + /** + * Enables importing code snippets from files with `<<<`. + * @default true + * @see https://vitepress.dev/guide/markdown#import-code-snippets + */ + snippet?: boolean /** * Options for `markdown-it-container` * @see https://github.com/markdown-it/markdown-it-container @@ -210,7 +228,13 @@ export interface MarkdownOptions extends MarkdownItAsyncOptions { * @see https://vitepress.dev/guide/markdown#math-equations */ math?: boolean | any - image?: ImageOptions + /** + * Options for the image plugin (resolves image sources against the public + * directory, adds dimensions, and supports lazy loading). Set to `false` + * to disable. + * @see https://vitepress.dev/guide/markdown#image-lazy-loading + */ + image?: ImageOptions | false /** * Allows disabling the github alerts plugin * @default true @@ -278,24 +302,33 @@ export async function createMarkdownRenderer( await options.preConfig(md) } - const slugify = options.anchor?.slugify ?? defaultSlugify + const slugify = + (options.anchor ? options.anchor.slugify : undefined) ?? defaultSlugify // custom plugins - componentPlugin(md, options.component) - preWrapperPlugin(md, { - codeCopyButtonTitle, - languageLabel: options.languageLabel - }) - snippetPlugin(md, srcDir) + if (options.component !== false) { + componentPlugin(md, options.component) + } + if (options.preWrapper !== false) { + preWrapperPlugin(md, { + codeCopyButtonTitle, + languageLabel: options.languageLabel + }) + lineNumberPlugin(md, options.lineNumbers) + } + if (options.snippet !== false) { + snippetPlugin(md, srcDir) + } containerPlugin(md, options.container) - imagePlugin(md, publicDir, options.image) + if (options.image !== false) { + imagePlugin(md, publicDir, options.image) + } linkPlugin( md, { target: '_blank', rel: 'noreferrer', ...options.externalLinks }, base, slugify ) - lineNumberPlugin(md, options.lineNumbers) if (options.tableTabIndex !== false) { tablePlugin(md) @@ -309,44 +342,48 @@ export async function createMarkdownRenderer( if (options.attrs !== false) { attrsPlugin(md, options.attrs) } - emojiPlugin(md, options.emoji) + if (options.emoji !== false) { + emojiPlugin(md, options.emoji) + } // mdit-vue plugins - anchorPlugin(md, { - slugify, - getTokensText: (tokens) => { - return tokens - .filter((t) => !['html_inline', 'emoji'].includes(t.type)) - .map((t) => t.content) - .join('') - }, - permalink: (slug, _, state, idx) => { - const title = - state.tokens[idx + 1]?.children - ?.filter((token) => ['text', 'code_inline'].includes(token.type)) - .reduce((acc, t) => acc + t.content, '') - .trim() || '' - - const linkTokens = [ - Object.assign(new state.Token('text', '', 0), { content: ' ' }), - Object.assign(new state.Token('link_open', 'a', 1), { - attrs: [ - ['class', 'header-anchor'], - ['href', `#${slug}`], - ['aria-label', `Permalink to “${title}”`] - ] - }), - Object.assign(new state.Token('html_inline', '', 0), { - content: '​', - meta: { isPermalinkSymbol: true } - }), - new state.Token('link_close', 'a', -1) - ] - - state.tokens[idx + 1].children?.push(...linkTokens) - }, - ...options.anchor - }) + if (options.anchor !== false) { + anchorPlugin(md, { + slugify, + getTokensText: (tokens) => { + return tokens + .filter((t) => !['html_inline', 'emoji'].includes(t.type)) + .map((t) => t.content) + .join('') + }, + permalink: (slug, _, state, idx) => { + const title = + state.tokens[idx + 1]?.children + ?.filter((token) => ['text', 'code_inline'].includes(token.type)) + .reduce((acc, t) => acc + t.content, '') + .trim() || '' + + const linkTokens = [ + Object.assign(new state.Token('text', '', 0), { content: ' ' }), + Object.assign(new state.Token('link_open', 'a', 1), { + attrs: [ + ['class', 'header-anchor'], + ['href', `#${slug}`], + ['aria-label', `Permalink to “${title}”`] + ] + }), + Object.assign(new state.Token('html_inline', '', 0), { + content: '​', + meta: { isPermalinkSymbol: true } + }), + new state.Token('link_close', 'a', -1) + ] + + state.tokens[idx + 1].children?.push(...linkTokens) + }, + ...options.anchor + }) + } frontmatterPlugin(md, options.frontmatter) @@ -360,14 +397,18 @@ export async function createMarkdownRenderer( sfcPlugin(md, options.sfc) titlePlugin(md) - tocPlugin(md, { - slugify, - ...options.toc, - format: (s) => { - const title = s.replaceAll('&', '&') // encoded twice because of restoreEntities - return options.toc?.format?.(title) ?? title - } - }) + + const tocOptions = options.toc + if (tocOptions !== false) { + tocPlugin(md, { + slugify, + ...tocOptions, + format: (s) => { + const title = s.replaceAll('&', '&') // encoded twice because of restoreEntities + return tocOptions?.format?.(title) ?? title + } + }) + } if (options.math) { try { From 3514d82617817941358bf946ab7c87a3e4209d8a Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Fri, 24 Jul 2026 00:47:47 +0530 Subject: [PATCH 034/136] refactor(markdown): restructure options and plugin registration - group `MarkdownOptions` into sections by concern (general, syntax highlighting, code blocks, markdown extensions, vue integration) and rewrite the jsdocs with a consistent voice, documenting the previously undocumented `externalLinks` default and correcting the `container` description (label customization, not plugin pass-through) - register plugins in accurately-labeled groups (vitepress customizations, community plugins, mdit-vue plugins) and note the order-sensitive couplings inline (lineNumbers after preWrapper, anchor after attrs) - add a test for the `cjkFriendlyEmphasis` toggle Co-Authored-By: Claude Fable 5 --- __tests__/unit/node/markdown/markdown.test.ts | 8 + src/node/markdown/markdown.ts | 241 +++++++++--------- 2 files changed, 134 insertions(+), 115 deletions(-) diff --git a/__tests__/unit/node/markdown/markdown.test.ts b/__tests__/unit/node/markdown/markdown.test.ts index e8219a54..c042d6ba 100644 --- a/__tests__/unit/node/markdown/markdown.test.ts +++ b/__tests__/unit/node/markdown/markdown.test.ts @@ -101,5 +101,13 @@ describe('node/markdown/markdown', () => { 'tabindex' ) }) + + test('cjkFriendlyEmphasis', async () => { + const src = 'これは**「テスト」**です' + expect(await render(src)).toContain('「テスト」') + expect(await render(src, { cjkFriendlyEmphasis: false })).not.toContain( + '' + ) + }) }) }) diff --git a/src/node/markdown/markdown.ts b/src/node/markdown/markdown.ts index 6293b7bc..ee5c3954 100644 --- a/src/node/markdown/markdown.ts +++ b/src/node/markdown/markdown.ts @@ -54,17 +54,21 @@ export interface MarkdownOptions extends MarkdownItAsyncOptions { /* ==================== General Options ==================== */ /** - * Setup markdown-it instance before applying plugins + * Configure the markdown-it instance before any plugins are applied. */ preConfig?: (md: MarkdownItAsync) => Awaitable /** - * Setup markdown-it instance + * Configure the markdown-it instance after all built-in plugins are applied. */ config?: (md: MarkdownItAsync) => Awaitable /** * Disable cache (experimental) */ cache?: boolean + /** + * HTML attributes applied to external links. + * @default { target: '_blank', rel: 'noreferrer' } + */ externalLinks?: Record /* ==================== Syntax Highlighting ==================== */ @@ -72,7 +76,8 @@ export interface MarkdownOptions extends MarkdownItAsyncOptions { /** * Custom theme for syntax highlighting. * - * You can also pass an object with `light` and `dark` themes to support dual themes. + * You can also pass an object with `light` and `dark` themes to support + * dual themes. * * @example { theme: 'github-dark' } * @example { theme: { light: 'github-light', dark: 'github-dark' } } @@ -91,7 +96,8 @@ export interface MarkdownOptions extends MarkdownItAsyncOptions { /** * Custom language aliases for syntax highlighting. * Maps custom language names to existing languages. - * Alias lookup is case-insensitive and underscores in language names are displayed as spaces. + * Alias lookup is case-insensitive and underscores in language names are + * displayed as spaces. * * @example * @@ -113,31 +119,11 @@ export interface MarkdownOptions extends MarkdownItAsyncOptions { */ languageAlias?: Record /** - * Custom language labels for display. - * Overrides the default language label shown in code blocks. - * Keys are case-insensitive. - * - * @example { 'vue': 'Vue SFC' } - */ - languageLabel?: Record - /** - * Show line numbers in code blocks. Requires the `preWrapper` plugin. - * @default false - */ - lineNumbers?: boolean - /** - * Wrap code blocks in a container carrying the language label and the - * copy button. The default theme's code block styling relies on this - * markup. Disabling it also disables `lineNumbers`. - * @default true - */ - preWrapper?: boolean - /** - * Fallback language when the specified language is not available. + * Fallback language used when the specified language is not available. */ defaultHighlightLang?: string /** - * Transformers applied to code blocks + * Transformers applied to code blocks. * @see https://shiki.style/guide/transformers */ codeTransformers?: ShikiTransformer[] @@ -148,24 +134,46 @@ export interface MarkdownOptions extends MarkdownItAsyncOptions { */ colorReplacements?: CodeToHastOptions['colorReplacements'] /** - * Setup Shiki instance + * Configure the Shiki instance. */ shikiSetup?: (shiki: Highlighter) => void | Promise + + /* ==================== Code Blocks ==================== */ + + /** + * Wrap code blocks in a container carrying the language label and the + * copy button. The default theme's code block styling relies on this + * markup. Disabling it also disables `lineNumbers`. + * @default true + */ + preWrapper?: boolean /** - * The tooltip text for the copy button in code blocks + * The tooltip text for the copy button in code blocks. * @default 'Copy Code' */ codeCopyButtonTitle?: string - - /* ==================== Markdown It Plugins ==================== */ - /** - * Options for `markdown-it-anchor`. Set to `false` to disable adding ids - * and anchor links to headings. Note that the default theme's outline and - * heading hash links rely on these ids. - * @see https://github.com/valeriangalliat/markdown-it-anchor + * Custom language labels for display. + * Overrides the default language label shown in code blocks. + * Keys are case-insensitive. + * + * @example { 'vue': 'Vue SFC' } */ - anchor?: anchorPlugin.AnchorOptions | false + languageLabel?: Record + /** + * Show line numbers in code blocks. Requires the `preWrapper` plugin. + * @default false + */ + lineNumbers?: boolean + /** + * Enables importing code snippets from files with `<<<`. + * @default true + * @see https://vitepress.dev/guide/markdown#import-code-snippets + */ + snippet?: boolean + + /* ==================== Markdown Extensions ==================== */ + /** * Options for `markdown-it-attrs`. Set to `false` to disable. * @see https://github.com/arve0/markdown-it-attrs @@ -183,20 +191,26 @@ export interface MarkdownOptions extends MarkdownItAsyncOptions { } | false /** - * Options for `@mdit-vue/plugin-frontmatter` - * @see https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-frontmatter + * Improves emphasis (`**bold**`) handling in Japanese, Chinese, and + * Korean text. + * @default true + * @see https://github.com/tats-u/markdown-cjk-friendly */ - frontmatter?: FrontmatterPluginOptions + cjkFriendlyEmphasis?: boolean /** - * Options for `@mdit-vue/plugin-headers` - * @see https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-headers + * Options for `markdown-it-anchor`. Set to `false` to disable adding ids + * and anchor links to headings. Note that the default theme's outline and + * heading hash links rely on these ids. + * @see https://github.com/valeriangalliat/markdown-it-anchor */ - headers?: HeadersPluginOptions | boolean + anchor?: anchorPlugin.AnchorOptions | false /** - * Options for `@mdit-vue/plugin-sfc` - * @see https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-sfc + * Options for `@mdit-vue/plugin-headers`. Set to `true` or pass options + * to collect page headers into page data. + * @default false + * @see https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-headers */ - sfc?: SfcPluginOptions + headers?: HeadersPluginOptions | boolean /** * Options for `@mdit-vue/plugin-toc`. Set to `false` to disable the * `[[toc]]` syntax. @@ -204,30 +218,32 @@ export interface MarkdownOptions extends MarkdownItAsyncOptions { */ toc?: TocPluginOptions | false /** - * Options for `@mdit-vue/plugin-component`. Set to `false` to disable. - * @see https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-component + * Math support. + * + * You need to install `markdown-it-mathjax3` and set `math` to `true` to + * enable it. You can also pass options to `markdown-it-mathjax3` here. + * @default false + * @see https://vitepress.dev/guide/markdown#math-equations */ - component?: ComponentPluginOptions | false + math?: boolean | any /** - * Enables importing code snippets from files with `<<<`. - * @default true - * @see https://vitepress.dev/guide/markdown#import-code-snippets + * Custom labels for the built-in containers (`::: tip` etc.). Also used + * as the default titles of GitHub-flavored alerts. + * @see https://vitepress.dev/guide/markdown#custom-containers */ - snippet?: boolean + container?: ContainerOptions /** - * Options for `markdown-it-container` - * @see https://github.com/markdown-it/markdown-it-container + * Whether to enable GitHub-flavored alerts (`> [!NOTE]`). + * @default true + * @see https://vitepress.dev/guide/markdown#github-flavored-alerts */ - container?: ContainerOptions + gfmAlerts?: boolean /** - * Math support - * - * You need to install `markdown-it-mathjax3` and set `math` to `true` to enable it. - * You can also pass options to `markdown-it-mathjax3` here. - * @default false - * @see https://vitepress.dev/guide/markdown#math-equations + * Add `tabindex="0"` to tables so keyboard users can focus and scroll + * them. + * @default true */ - math?: boolean | any + tableTabIndex?: boolean /** * Options for the image plugin (resolves image sources against the public * directory, adds dimensions, and supports lazy loading). Set to `false` @@ -235,24 +251,24 @@ export interface MarkdownOptions extends MarkdownItAsyncOptions { * @see https://vitepress.dev/guide/markdown#image-lazy-loading */ image?: ImageOptions | false + + /* ==================== Vue Integration ==================== */ + /** - * Allows disabling the github alerts plugin - * @default true - * @see https://vitepress.dev/guide/markdown#github-flavored-alerts + * Options for `@mdit-vue/plugin-component`. Set to `false` to disable. + * @see https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-component */ - gfmAlerts?: boolean + component?: ComponentPluginOptions | false /** - * Add `tabindex="0"` to tables so keyboard users can focus and scroll them. - * @default true + * Options for `@mdit-vue/plugin-frontmatter`. + * @see https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-frontmatter */ - tableTabIndex?: boolean + frontmatter?: FrontmatterPluginOptions /** - * Allows disabling the CJK-friendly plugin. - * This plugin adds support for emphasis marks (**bold**) in Japanese, Chinese, and Korean text. - * @default true - * @see https://github.com/tats-u/markdown-cjk-friendly + * Options for `@mdit-vue/plugin-sfc`. + * @see https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-sfc */ - cjkFriendlyEmphasis?: boolean + sfc?: SfcPluginOptions } export type MarkdownRenderer = MarkdownItAsync @@ -287,7 +303,7 @@ export async function createMarkdownRenderer( const theme = options.theme ?? { light: 'github-light', dark: 'github-dark' } const codeCopyButtonTitle = options.codeCopyButtonTitle || 'Copy Code' - let [highlight, dispose] = options.highlight + const [highlight, dispose] = options.highlight ? [options.highlight, () => {}] : await createHighlighter(theme, options, logger) @@ -305,21 +321,22 @@ export async function createMarkdownRenderer( const slugify = (options.anchor ? options.anchor.slugify : undefined) ?? defaultSlugify - // custom plugins - if (options.component !== false) { - componentPlugin(md, options.component) - } + // VitePress customizations if (options.preWrapper !== false) { preWrapperPlugin(md, { codeCopyButtonTitle, languageLabel: options.languageLabel }) + // must be applied after preWrapper as it augments its output lineNumberPlugin(md, options.lineNumbers) } if (options.snippet !== false) { snippetPlugin(md, srcDir) } containerPlugin(md, options.container) + if (options.gfmAlerts !== false) { + gitHubAlertsPlugin(md, options.container) + } if (options.image !== false) { imagePlugin(md, publicDir, options.image) } @@ -329,25 +346,23 @@ export async function createMarkdownRenderer( base, slugify ) - if (options.tableTabIndex !== false) { tablePlugin(md) } - if (options.gfmAlerts !== false) { - gitHubAlertsPlugin(md, options.container) - } - - // third party plugins + // community plugins if (options.attrs !== false) { attrsPlugin(md, options.attrs) } if (options.emoji !== false) { emojiPlugin(md, options.emoji) } - - // mdit-vue plugins + if (options.cjkFriendlyEmphasis !== false) { + mditCjkFriendly(md) + } if (options.anchor !== false) { + // must be applied after attrs so that user-defined ids from curly + // attributes take precedence over slugified ones anchorPlugin(md, { slugify, getTokensText: (tokens) => { @@ -384,32 +399,6 @@ export async function createMarkdownRenderer( ...options.anchor }) } - - frontmatterPlugin(md, options.frontmatter) - - if (options.headers) { - headersPlugin(md, { - level: [2, 3, 4, 5, 6], - slugify, - ...(typeof options.headers === 'boolean' ? undefined : options.headers) - }) - } - - sfcPlugin(md, options.sfc) - titlePlugin(md) - - const tocOptions = options.toc - if (tocOptions !== false) { - tocPlugin(md, { - slugify, - ...tocOptions, - format: (s) => { - const title = s.replaceAll('&', '&') // encoded twice because of restoreEntities - return tocOptions?.format?.(title) ?? title - } - }) - } - if (options.math) { try { const mathPlugin = await import('markdown-it-mathjax3') @@ -435,8 +424,30 @@ export async function createMarkdownRenderer( } } - if (options.cjkFriendlyEmphasis !== false) { - mditCjkFriendly(md) + // mdit-vue plugins + if (options.component !== false) { + componentPlugin(md, options.component) + } + frontmatterPlugin(md, options.frontmatter) + if (options.headers) { + headersPlugin(md, { + level: [2, 3, 4, 5, 6], + slugify, + ...(typeof options.headers === 'boolean' ? undefined : options.headers) + }) + } + sfcPlugin(md, options.sfc) + titlePlugin(md) + const tocOptions = options.toc + if (tocOptions !== false) { + tocPlugin(md, { + slugify, + ...tocOptions, + format: (s) => { + const title = s.replaceAll('&', '&') // encoded twice because of restoreEntities + return tocOptions?.format?.(title) ?? title + } + }) } // apply user config From 75505179160bf16a88cd5648719615e982c08e41 Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Fri, 24 Jul 2026 00:57:40 +0530 Subject: [PATCH 035/136] feat(markdown)!: replace markdown-it-anchor with @mdit/plugin-anchor Drop-in for our usage: identical defaults (min-level semantics, tabindex, unique slug handling) and the same permalink/getTokensText signatures, with proper ESM types - removing the type patch we carried for markdown-it-anchor. BREAKING CHANGE: `markdown.anchor` options are now typed by `@mdit/plugin-anchor`. Common options (`level`, `slugify`, `permalink`, `getTokensText`, `tabIndex`, etc.) are unchanged, but the deprecated markdown-it-anchor permalink options (`permalinkSymbol`, `renderPermalink`, ...) are no longer accepted. Permalink builders like `headerLink` are named exports of `@mdit/plugin-anchor` instead of properties of the plugin. Co-Authored-By: Claude Fable 5 --- docs/en/guide/markdown.md | 8 +++---- docs/es/guide/markdown.md | 8 +++---- docs/fa/guide/markdown.md | 8 +++---- docs/ja/guide/markdown.md | 8 +++---- docs/ko/guide/markdown.md | 8 +++---- docs/pt/guide/markdown.md | 8 +++---- docs/ru/guide/markdown.md | 8 +++---- docs/zh/guide/markdown.md | 8 +++---- package.json | 2 +- patches/markdown-it-anchor@9.2.0.patch | 17 --------------- pnpm-lock.yaml | 30 +++++++++++--------------- pnpm-workspace.yaml | 1 - src/node/markdown/markdown.ts | 8 +++---- 13 files changed, 50 insertions(+), 72 deletions(-) delete mode 100644 patches/markdown-it-anchor@9.2.0.patch diff --git a/docs/en/guide/markdown.md b/docs/en/guide/markdown.md index 5202c7cb..54baf549 100644 --- a/docs/en/guide/markdown.md +++ b/docs/en/guide/markdown.md @@ -1043,15 +1043,15 @@ VitePress uses [markdown-it](https://github.com/markdown-it/markdown-it) as the ```js import { defineConfig } from 'vitepress' -import markdownItAnchor from 'markdown-it-anchor' +import { headerLink } from '@mdit/plugin-anchor' import markdownItFoo from 'markdown-it-foo' export default defineConfig({ markdown: { - // options for markdown-it-anchor - // https://github.com/valeriangalliat/markdown-it-anchor#usage + // options for @mdit/plugin-anchor + // https://mdit-plugins.github.io/anchor.html anchor: { - permalink: markdownItAnchor.permalink.headerLink() + permalink: headerLink() }, // options for @mdit-vue/plugin-toc diff --git a/docs/es/guide/markdown.md b/docs/es/guide/markdown.md index 7e1fc0aa..bd9e5e58 100644 --- a/docs/es/guide/markdown.md +++ b/docs/es/guide/markdown.md @@ -907,15 +907,15 @@ VitePress usa [markdown-it](https://github.com/markdown-it/markdown-it) como int ```js import { defineConfig } from 'vitepress' -import markdownItAnchor from 'markdown-it-anchor' +import { headerLink } from '@mdit/plugin-anchor' import markdownItFoo from 'markdown-it-foo' export default defineConfig({ markdown: { - // opciones para markdown-it-anchor - // https://github.com/valeriangalliat/markdown-it-anchor#usage + // opciones para @mdit/plugin-anchor + // https://mdit-plugins.github.io/anchor.html anchor: { - permalink: markdownItAnchor.permalink.headerLink() + permalink: headerLink() }, // opciones para @mdit-vue/plugin-toc diff --git a/docs/fa/guide/markdown.md b/docs/fa/guide/markdown.md index ecce9f2e..dc1aacfa 100644 --- a/docs/fa/guide/markdown.md +++ b/docs/fa/guide/markdown.md @@ -899,15 +899,15 @@ export default { ```js import { defineConfig } from 'vitepress' -import markdownItAnchor from 'markdown-it-anchor' +import { headerLink } from '@mdit/plugin-anchor' import markdownItFoo from 'markdown-it-foo' export default defineConfig({ markdown: { - // گزینه‌های markdown-it-anchor - // https://github.com/valeriangalliat/markdown-it-anchor#usage + // گزینه‌های @mdit/plugin-anchor + // https://mdit-plugins.github.io/anchor.html anchor: { - permalink: markdownItAnchor.permalink.headerLink() + permalink: headerLink() }, // گزینه‌های @mdit-vue/plugin-toc diff --git a/docs/ja/guide/markdown.md b/docs/ja/guide/markdown.md index 13dae321..9f530692 100644 --- a/docs/ja/guide/markdown.md +++ b/docs/ja/guide/markdown.md @@ -1015,15 +1015,15 @@ VitePress は Markdown レンダラーとして [markdown-it](https://github.com ```js import { defineConfig } from 'vitepress' -import markdownItAnchor from 'markdown-it-anchor' +import { headerLink } from '@mdit/plugin-anchor' import markdownItFoo from 'markdown-it-foo' export default defineConfig({ markdown: { - // markdown-it-anchor のオプション - // https://github.com/valeriangalliat/markdown-it-anchor#usage + // @mdit/plugin-anchor のオプション + // https://mdit-plugins.github.io/anchor.html anchor: { - permalink: markdownItAnchor.permalink.headerLink() + permalink: headerLink() }, // @mdit-vue/plugin-toc のオプション diff --git a/docs/ko/guide/markdown.md b/docs/ko/guide/markdown.md index c756d05e..157f9a9d 100644 --- a/docs/ko/guide/markdown.md +++ b/docs/ko/guide/markdown.md @@ -944,15 +944,15 @@ VitePress는 마크다운 렌더러로 [markdown-it](https://github.com/markdown ```js import { defineConfig } from 'vitepress' -import markdownItAnchor from 'markdown-it-anchor' +import { headerLink } from '@mdit/plugin-anchor' import markdownItFoo from 'markdown-it-foo' export default defineConfig({ markdown: { - // markdown-it-anchor의 옵션 - // https://github.com/valeriangalliat/markdown-it-anchor#usage + // @mdit/plugin-anchor의 옵션 + // https://mdit-plugins.github.io/anchor.html anchor: { - permalink: markdownItAnchor.permalink.headerLink() + permalink: headerLink() }, // @mdit-vue/plugin-toc의 옵션 diff --git a/docs/pt/guide/markdown.md b/docs/pt/guide/markdown.md index 1eef2c72..1ad50dff 100644 --- a/docs/pt/guide/markdown.md +++ b/docs/pt/guide/markdown.md @@ -906,15 +906,15 @@ VitePress usa [markdown-it](https://github.com/markdown-it/markdown-it) como int ```js import { defineConfig } from 'vitepress' -import markdownItAnchor from 'markdown-it-anchor' +import { headerLink } from '@mdit/plugin-anchor' import markdownItFoo from 'markdown-it-foo' export default defineConfig({ markdown: { - // opções para markdown-it-anchor - // https://github.com/valeriangalliat/markdown-it-anchor#usage + // opções para @mdit/plugin-anchor + // https://mdit-plugins.github.io/anchor.html anchor: { - permalink: markdownItAnchor.permalink.headerLink() + permalink: headerLink() }, // opções para @mdit-vue/plugin-toc diff --git a/docs/ru/guide/markdown.md b/docs/ru/guide/markdown.md index 104f8790..f33dfb51 100644 --- a/docs/ru/guide/markdown.md +++ b/docs/ru/guide/markdown.md @@ -1015,15 +1015,15 @@ VitePress использует [markdown-it](https://github.com/markdown-it/mark ```js import { defineConfig } from 'vitepress' -import markdownItAnchor from 'markdown-it-anchor' +import { headerLink } from '@mdit/plugin-anchor' import markdownItFoo from 'markdown-it-foo' export default defineConfig({ markdown: { - // опции для markdown-it-anchor - // https://github.com/valeriangalliat/markdown-it-anchor#usage + // опции для @mdit/plugin-anchor + // https://mdit-plugins.github.io/anchor.html anchor: { - permalink: markdownItAnchor.permalink.headerLink() + permalink: headerLink() }, // опции для @mdit-vue/plugin-toc diff --git a/docs/zh/guide/markdown.md b/docs/zh/guide/markdown.md index ba920391..59faec33 100644 --- a/docs/zh/guide/markdown.md +++ b/docs/zh/guide/markdown.md @@ -907,15 +907,15 @@ VitePress 使用 [markdown-it](https://github.com/markdown-it/markdown-it) 作 ```js import { defineConfig } from 'vitepress' -import markdownItAnchor from 'markdown-it-anchor' +import { headerLink } from '@mdit/plugin-anchor' import markdownItFoo from 'markdown-it-foo' export default defineConfig({ markdown: { - // markdown-it-anchor 的选项 - // https://github.com/valeriangalliat/markdown-it-anchor#usage + // @mdit/plugin-anchor 的选项 + // https://mdit-plugins.github.io/anchor.html anchor: { - permalink: markdownItAnchor.permalink.headerLink() + permalink: headerLink() }, // @mdit-vue/plugin-toc 的选项 // https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-toc#options diff --git a/package.json b/package.json index 44fd3a7f..fe552acd 100644 --- a/package.json +++ b/package.json @@ -129,6 +129,7 @@ "@mdit-vue/plugin-title": "^3.0.2", "@mdit-vue/plugin-toc": "^3.0.2", "@mdit-vue/shared": "^3.0.2", + "@mdit/plugin-anchor": "^1.1.1", "@polka/compression": "^1.0.0-next.28", "@rollup/plugin-alias": "^6.0.0", "@rollup/plugin-commonjs": "^29.0.3", @@ -157,7 +158,6 @@ "lodash.template": "^4.18.1", "lru-cache": "^11.5.1", "markdown-it": "^14.2.0", - "markdown-it-anchor": "^9.2.0", "markdown-it-async": "^2.2.0", "markdown-it-attrs": "4.3.1", "markdown-it-cjk-friendly": "^2.0.2", diff --git a/patches/markdown-it-anchor@9.2.0.patch b/patches/markdown-it-anchor@9.2.0.patch deleted file mode 100644 index ac4498e4..00000000 --- a/patches/markdown-it-anchor@9.2.0.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/types/index.d.ts b/types/index.d.ts -index 40c25c0be1add8b0fc2c51489c25a423dbc49d2c..807bc1b0e434d660c6a298b1dee1c87935bfac86 100644 ---- a/types/index.d.ts -+++ b/types/index.d.ts -@@ -1,10 +1,8 @@ - import MarkdownIt from 'markdown-it'; --import { default as MarkdownItToken } from 'markdown-it/lib/token.mjs'; --import { default as MarkdownItState} from 'markdown-it/lib/rules_core/state_core.mjs'; -+import { default as Token } from 'markdown-it/lib/token.mjs'; -+import { default as State } from 'markdown-it/lib/rules_core/state_core.mjs'; - - declare namespace anchor { -- export type Token = MarkdownItToken -- export type State = MarkdownItState - export type RenderHref = (slug: string, state: State) => string; - export type RenderAttrs = (slug: string, state: State) => Record; - diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1cb266da..4af48f06 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,9 +14,6 @@ patchedDependencies: '@types/mdurl@2.0.0': hash: 3460e7d18ce390685cf4b8d8237fb20df9ad952c1336f479995a508a6395bfa4 path: patches/@types__mdurl@2.0.0.patch - markdown-it-anchor@9.2.0: - hash: cdc28e7c329be30688ad192126ba505446611fbe526ad51483e4b1287aa35cf9 - path: patches/markdown-it-anchor@9.2.0.patch markdown-it-attrs@4.3.1: hash: 12883b753541724964b5246a739df34c4b76db10415bbb63c35dce408cfe977e path: patches/markdown-it-attrs@4.3.1.patch @@ -116,6 +113,9 @@ importers: '@mdit-vue/shared': specifier: ^3.0.2 version: 3.0.2 + '@mdit/plugin-anchor': + specifier: ^1.1.1 + version: 1.1.1(markdown-it@14.2.0) '@polka/compression': specifier: ^1.0.0-next.28 version: 1.0.0-next.28 @@ -200,9 +200,6 @@ importers: markdown-it: specifier: ^14.2.0 version: 14.2.0 - markdown-it-anchor: - specifier: ^9.2.0 - version: 9.2.0(patch_hash=cdc28e7c329be30688ad192126ba505446611fbe526ad51483e4b1287aa35cf9)(@types/markdown-it@14.1.2)(markdown-it@14.2.0) markdown-it-async: specifier: ^2.2.0 version: 2.2.0 @@ -643,6 +640,11 @@ packages: resolution: {integrity: sha512-00aAZ0F0NLik6I6Yba2emGbHLxv+QYrPH00qQ5dFKXlAo1Ll2RHDXwY7nN2WAfrx2pP+WrvSRFTGFCNGdzBDHw==} engines: {node: '>=20.0.0'} + '@mdit/plugin-anchor@1.1.1': + resolution: {integrity: sha512-42m7dxzvfLbo3YnteMB70aXFQ1TtnalyNLyPUDj5rr1FqTNf8pnHjQbgmf6FCjshg6BrfLVx7zpHJ7UUehQ/fA==} + peerDependencies: + markdown-it: ^14.2.0 + '@napi-rs/wasm-runtime@1.1.6': resolution: {integrity: sha512-ZLv/JdUfkvOy9eCnnBaGfiO+XimbjebAeO+MRQqD/B+FR1tnRN0tpKSJHRbE8sFfS6aqsXZ67TQjfwfsxULVbg==} peerDependencies: @@ -2035,12 +2037,6 @@ packages: mark.js@8.11.1: resolution: {integrity: sha512-1I+1qpDt4idfgLQG+BNWmrqku+7/2bi5nLf4YwF8y8zXvmfiTBY3PV3ZibfrjBueCByROpuBjLLFCajqkgYoLQ==} - markdown-it-anchor@9.2.0: - resolution: {integrity: sha512-sa2ErMQ6kKOA4l31gLGYliFQrMKkqSO0ZJgGhDHKijPf0pNFM9vghjAh3gn26pS4JDRs7Iwa9S36gxm3vgZTzg==} - peerDependencies: - '@types/markdown-it': '*' - markdown-it: '*' - markdown-it-async@2.2.0: resolution: {integrity: sha512-sITME+kf799vMeO/ww/CjH6q+c05f6TLpn6VOmmWCGNqPJzSh+uFgZoMB9s0plNtW6afy63qglNAC3MhrhP/gg==} @@ -3239,6 +3235,11 @@ snapshots: '@mdit-vue/types@3.0.2': {} + '@mdit/plugin-anchor@1.1.1(markdown-it@14.2.0)': + dependencies: + '@types/markdown-it': 14.1.2 + markdown-it: 14.2.0 + '@napi-rs/wasm-runtime@1.1.6(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1)': dependencies: '@emnapi/core': 1.11.1 @@ -4502,11 +4503,6 @@ snapshots: mark.js@8.11.1: {} - markdown-it-anchor@9.2.0(patch_hash=cdc28e7c329be30688ad192126ba505446611fbe526ad51483e4b1287aa35cf9)(@types/markdown-it@14.1.2)(markdown-it@14.2.0): - dependencies: - '@types/markdown-it': 14.1.2 - markdown-it: 14.2.0 - markdown-it-async@2.2.0: dependencies: '@types/markdown-it': 14.1.2 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index aefb59fe..4a7f5533 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -17,7 +17,6 @@ overrides: patchedDependencies: '@types/markdown-it-attrs': patches/@types__markdown-it-attrs@4.1.3.patch '@types/mdurl@2.0.0': patches/@types__mdurl@2.0.0.patch - markdown-it-anchor@9.2.0: patches/markdown-it-anchor@9.2.0.patch markdown-it-attrs@4.3.1: patches/markdown-it-attrs@4.3.1.patch shellEmulator: true diff --git a/src/node/markdown/markdown.ts b/src/node/markdown/markdown.ts index ee5c3954..ecab0bc9 100644 --- a/src/node/markdown/markdown.ts +++ b/src/node/markdown/markdown.ts @@ -14,13 +14,13 @@ import { sfcPlugin, type SfcPluginOptions } from '@mdit-vue/plugin-sfc' import { titlePlugin } from '@mdit-vue/plugin-title' import { tocPlugin, type TocPluginOptions } from '@mdit-vue/plugin-toc' import { slugify as defaultSlugify } from '@mdit-vue/shared' +import { anchor as anchorPlugin, type AnchorOptions } from '@mdit/plugin-anchor' import type { CodeToHastOptions, LanguageInput, ShikiTransformer, ThemeRegistrationAny } from '@shikijs/types' -import anchorPlugin from 'markdown-it-anchor' import { MarkdownItAsync, type MarkdownItAsyncOptions } from 'markdown-it-async' import attrsPlugin, { type MarkdownItAttrsOptions } from 'markdown-it-attrs' import mditCjkFriendly from 'markdown-it-cjk-friendly' @@ -198,12 +198,12 @@ export interface MarkdownOptions extends MarkdownItAsyncOptions { */ cjkFriendlyEmphasis?: boolean /** - * Options for `markdown-it-anchor`. Set to `false` to disable adding ids + * Options for `@mdit/plugin-anchor`. Set to `false` to disable adding ids * and anchor links to headings. Note that the default theme's outline and * heading hash links rely on these ids. - * @see https://github.com/valeriangalliat/markdown-it-anchor + * @see https://mdit-plugins.github.io/anchor.html */ - anchor?: anchorPlugin.AnchorOptions | false + anchor?: AnchorOptions | false /** * Options for `@mdit-vue/plugin-headers`. Set to `true` or pass options * to collect page headers into page data. From 85ede55fdb0623cf2b8003165602d81ead38b860 Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Fri, 24 Jul 2026 01:01:12 +0530 Subject: [PATCH 036/136] test(markdown): cover attrs/anchor plugin order independence attrs registers its core rule at a fixed position (before linkify) while anchor pushes to the end of the chain, so user-defined ids from curly attributes win regardless of registration order. Remove the comment that claimed the order matters. Co-Authored-By: Claude Fable 5 --- __tests__/unit/node/markdown/markdown.test.ts | 19 +++++++++++++++++++ src/node/markdown/markdown.ts | 2 -- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/__tests__/unit/node/markdown/markdown.test.ts b/__tests__/unit/node/markdown/markdown.test.ts index c042d6ba..0c8e554d 100644 --- a/__tests__/unit/node/markdown/markdown.test.ts +++ b/__tests__/unit/node/markdown/markdown.test.ts @@ -1,3 +1,6 @@ +import { anchor as anchorPlugin } from '@mdit/plugin-anchor' +import attrsPlugin from 'markdown-it-attrs' +import { MarkdownItAsync } from 'markdown-it-async' import { createMarkdownRenderer, disposeMdItInstance, @@ -110,4 +113,20 @@ describe('node/markdown/markdown', () => { ) }) }) + + // attrs applies at a fixed position in the core chain (before linkify), + // while anchor pushes to its end, so anchor always sees user-defined ids + // no matter which plugin is registered first + test('anchor respects ids from attrs regardless of plugin order', async () => { + for (const plugins of [ + [attrsPlugin, anchorPlugin], + [anchorPlugin, attrsPlugin] + ] as const) { + const md = new MarkdownItAsync() + for (const plugin of plugins) md.use(plugin) + expect(await md.renderAsync('## Title {#custom-id}')).toContain( + 'id="custom-id"' + ) + } + }) }) diff --git a/src/node/markdown/markdown.ts b/src/node/markdown/markdown.ts index ecab0bc9..8cb826d1 100644 --- a/src/node/markdown/markdown.ts +++ b/src/node/markdown/markdown.ts @@ -361,8 +361,6 @@ export async function createMarkdownRenderer( mditCjkFriendly(md) } if (options.anchor !== false) { - // must be applied after attrs so that user-defined ids from curly - // attributes take precedence over slugified ones anchorPlugin(md, { slugify, getTokensText: (tokens) => { From 018887fa1d03031e9c6cc96606be22df51581e35 Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Fri, 24 Jul 2026 01:09:51 +0530 Subject: [PATCH 037/136] feat(markdown)!: replace markdown-it-emoji with @mdit/plugin-emoji Same emoji token type, shortcuts, and set-replacement semantics, with fresher emoji data and native types (drops `@types/markdown-it-emoji`). BREAKING CHANGE: The `defs` property of `markdown.emoji` has been renamed to `definitions`. Co-Authored-By: Claude Fable 5 --- docs/en/guide/markdown.md | 2 +- docs/es/guide/markdown.md | 2 +- docs/fa/guide/markdown.md | 2 +- docs/ja/guide/markdown.md | 2 +- docs/ko/guide/markdown.md | 2 +- docs/pt/guide/markdown.md | 2 +- docs/ru/guide/markdown.md | 2 +- docs/zh/guide/markdown.md | 2 +- package.json | 3 +-- pnpm-lock.yaml | 36 +++++++++++++++++------------------ src/node/markdown/markdown.ts | 17 +++++++---------- 11 files changed, 34 insertions(+), 38 deletions(-) diff --git a/docs/en/guide/markdown.md b/docs/en/guide/markdown.md index 54baf549..38966226 100644 --- a/docs/en/guide/markdown.md +++ b/docs/en/guide/markdown.md @@ -112,7 +112,7 @@ For more details, see [Frontmatter](../reference/frontmatter-config). :tada: :100: -A [list of all emojis](https://github.com/markdown-it/markdown-it-emoji/blob/master/lib/data/full.mjs) is available. +A [list of all emojis](https://github.com/mdit-plugins/mdit-plugins/blob/main/packages/emoji/src/data/full.ts) is available. ## Table of Contents diff --git a/docs/es/guide/markdown.md b/docs/es/guide/markdown.md index bd9e5e58..f1f3ce72 100644 --- a/docs/es/guide/markdown.md +++ b/docs/es/guide/markdown.md @@ -112,7 +112,7 @@ Para más detalles, vea [Frontmatter](../reference/frontmatter-config). :tada: :100: -Una [lista de todos los emojis](https://github.com/markdown-it/markdown-it-emoji/blob/master/lib/data/full.mjs) está disponible. +Una [lista de todos los emojis](https://github.com/mdit-plugins/mdit-plugins/blob/main/packages/emoji/src/data/full.ts) está disponible. ## Tabla de Contenido (TOC) diff --git a/docs/fa/guide/markdown.md b/docs/fa/guide/markdown.md index dc1aacfa..1c10e7ab 100644 --- a/docs/fa/guide/markdown.md +++ b/docs/fa/guide/markdown.md @@ -112,7 +112,7 @@ lang: fa-IR :tada: :100: -یک [لیست از همه اموجی ها](https://github.com/markdown-it/markdown-it-emoji/blob/master/lib/data/full.mjs) در دسترس است. +یک [لیست از همه اموجی ها](https://github.com/mdit-plugins/mdit-plugins/blob/main/packages/emoji/src/data/full.ts) در دسترس است. ## فهرست مطالب {#table-of-contents} diff --git a/docs/ja/guide/markdown.md b/docs/ja/guide/markdown.md index 9f530692..7feb36b2 100644 --- a/docs/ja/guide/markdown.md +++ b/docs/ja/guide/markdown.md @@ -110,7 +110,7 @@ lang: ja-JP :tada: :100: -すべての絵文字の [一覧はこちら](https://github.com/markdown-it/markdown-it-emoji/blob/master/lib/data/full.mjs)。 +すべての絵文字の [一覧はこちら](https://github.com/mdit-plugins/mdit-plugins/blob/main/packages/emoji/src/data/full.ts)。 ## 目次 {#table-of-contents} diff --git a/docs/ko/guide/markdown.md b/docs/ko/guide/markdown.md index 157f9a9d..4baccb2e 100644 --- a/docs/ko/guide/markdown.md +++ b/docs/ko/guide/markdown.md @@ -112,7 +112,7 @@ lang: en-US :tada: :100: -[모든 이모지의 목록](https://github.com/markdown-it/markdown-it-emoji/blob/master/lib/data/full.mjs)이 제공됩니다. +[모든 이모지의 목록](https://github.com/mdit-plugins/mdit-plugins/blob/main/packages/emoji/src/data/full.ts)이 제공됩니다. ## 목차 {#table-of-contents} diff --git a/docs/pt/guide/markdown.md b/docs/pt/guide/markdown.md index 1ad50dff..03402ff4 100644 --- a/docs/pt/guide/markdown.md +++ b/docs/pt/guide/markdown.md @@ -112,7 +112,7 @@ Para mais detalhes, veja [Frontmatter](../reference/frontmatter-config). :tada: :100: -Uma [lista de todos os emojis](https://github.com/markdown-it/markdown-it-emoji/blob/master/lib/data/full.mjs) está disponível. +Uma [lista de todos os emojis](https://github.com/mdit-plugins/mdit-plugins/blob/main/packages/emoji/src/data/full.ts) está disponível. ## Tabela de Conteúdo (TOC) diff --git a/docs/ru/guide/markdown.md b/docs/ru/guide/markdown.md index f33dfb51..9ad328d3 100644 --- a/docs/ru/guide/markdown.md +++ b/docs/ru/guide/markdown.md @@ -112,7 +112,7 @@ lang: ru-RU :tada: :100: -[Список всех эмодзи](https://github.com/markdown-it/markdown-it-emoji/blob/master/lib/data/full.mjs). +[Список всех эмодзи](https://github.com/mdit-plugins/mdit-plugins/blob/main/packages/emoji/src/data/full.ts). ## Оглавление {#table-of-contents} diff --git a/docs/zh/guide/markdown.md b/docs/zh/guide/markdown.md index 59faec33..25b9b542 100644 --- a/docs/zh/guide/markdown.md +++ b/docs/zh/guide/markdown.md @@ -112,7 +112,7 @@ lang: en-US :tada: :100: -这里可以找到[所有支持的 emoji 列表](https://github.com/markdown-it/markdown-it-emoji/blob/master/lib/data/full.mjs)。 +这里可以找到[所有支持的 emoji 列表](https://github.com/mdit-plugins/mdit-plugins/blob/main/packages/emoji/src/data/full.ts)。 ## 目录表 (TOC) {#table-of-contents} diff --git a/package.json b/package.json index fe552acd..8f8839af 100644 --- a/package.json +++ b/package.json @@ -130,6 +130,7 @@ "@mdit-vue/plugin-toc": "^3.0.2", "@mdit-vue/shared": "^3.0.2", "@mdit/plugin-anchor": "^1.1.1", + "@mdit/plugin-emoji": "^1.1.0", "@polka/compression": "^1.0.0-next.28", "@rollup/plugin-alias": "^6.0.0", "@rollup/plugin-commonjs": "^29.0.3", @@ -141,7 +142,6 @@ "@types/mark.js": "^8.11.12", "@types/markdown-it-attrs": "^4.1.3", "@types/markdown-it-container": "^4.0.0", - "@types/markdown-it-emoji": "^3.0.1", "@types/minimist": "^1.2.5", "@types/node": "^25.9.4", "@types/picomatch": "^4.0.3", @@ -162,7 +162,6 @@ "markdown-it-attrs": "4.3.1", "markdown-it-cjk-friendly": "^2.0.2", "markdown-it-container": "^4.0.0", - "markdown-it-emoji": "^3.0.0", "markdown-it-mathjax3": "^4.3.2", "minimist": "^1.2.8", "nanoid": "^5.1.16", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4af48f06..6bd80091 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -116,6 +116,9 @@ importers: '@mdit/plugin-anchor': specifier: ^1.1.1 version: 1.1.1(markdown-it@14.2.0) + '@mdit/plugin-emoji': + specifier: ^1.1.0 + version: 1.1.0(markdown-it@14.2.0) '@polka/compression': specifier: ^1.0.0-next.28 version: 1.0.0-next.28 @@ -149,9 +152,6 @@ importers: '@types/markdown-it-container': specifier: ^4.0.0 version: 4.0.0 - '@types/markdown-it-emoji': - specifier: ^3.0.1 - version: 3.0.1 '@types/minimist': specifier: ^1.2.5 version: 1.2.5 @@ -212,9 +212,6 @@ importers: markdown-it-container: specifier: ^4.0.0 version: 4.0.0 - markdown-it-emoji: - specifier: ^3.0.0 - version: 3.0.0 markdown-it-mathjax3: specifier: ^4.3.2 version: 4.3.2 @@ -645,6 +642,15 @@ packages: peerDependencies: markdown-it: ^14.2.0 + '@mdit/plugin-emoji@1.1.0': + resolution: {integrity: sha512-rdGhZ0OVhK0EhiVpw8v22BdTq7XZ6Adrcbq3hR2Cx/YwGnL+kSXFtcGOeJXphiSics7oNgpIKdNyl974z7Cj1A==} + engines: {node: '>=22'} + peerDependencies: + markdown-it: ^14.2.0 + peerDependenciesMeta: + markdown-it: + optional: true + '@napi-rs/wasm-runtime@1.1.6': resolution: {integrity: sha512-ZLv/JdUfkvOy9eCnnBaGfiO+XimbjebAeO+MRQqD/B+FR1tnRN0tpKSJHRbE8sFfS6aqsXZ67TQjfwfsxULVbg==} peerDependencies: @@ -1064,9 +1070,6 @@ packages: '@types/markdown-it-container@4.0.0': resolution: {integrity: sha512-GmD8OECLfzPHv8VyvFRzslqdwXoDBJ2H40fxXFjrarbqvJZSB/BJKZXN5e3k7Mx7GQanSNzTYhzeS3H9o0gAOw==} - '@types/markdown-it-emoji@3.0.1': - resolution: {integrity: sha512-cz1j8R35XivBqq9mwnsrP2fsz2yicLhB8+PDtuVkKOExwEdsVBNI+ROL3sbhtR5occRZ66vT0QnwFZCqdjf3pA==} - '@types/markdown-it@14.1.2': resolution: {integrity: sha512-promo4eFwuiW+TfGxhi+0x3czqTYJkG8qB17ZUJiVF10Xm7NLVRSLUsfRTU/6h1e24VvRnXCx+hG7li58lkzog==} @@ -2059,9 +2062,6 @@ packages: markdown-it-container@4.0.0: resolution: {integrity: sha512-HaNccxUH0l7BNGYbFbjmGpf5aLHAMTinqRZQAEQbMr2cdD3z91Q6kIo1oUn1CQndkT03jat6ckrdRYuwwqLlQw==} - markdown-it-emoji@3.0.0: - resolution: {integrity: sha512-+rUD93bXHubA4arpEZO3q80so0qgoFJEKRkRbjKX8RTdca89v2kfyF+xR3i2sQTwql9tpPZPOQN5B+PunspXRg==} - markdown-it-mathjax3@4.3.2: resolution: {integrity: sha512-TX3GW5NjmupgFtMJGRauioMbbkGsOXAAt1DZ/rzzYmTHqzkO1rNAdiMD4NiruurToPApn2kYy76x02QN26qr2w==} @@ -3240,6 +3240,12 @@ snapshots: '@types/markdown-it': 14.1.2 markdown-it: 14.2.0 + '@mdit/plugin-emoji@1.1.0(markdown-it@14.2.0)': + dependencies: + '@types/markdown-it': 14.1.2 + optionalDependencies: + markdown-it: 14.2.0 + '@napi-rs/wasm-runtime@1.1.6(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1)': dependencies: '@emnapi/core': 1.11.1 @@ -3549,10 +3555,6 @@ snapshots: dependencies: '@types/markdown-it': 14.1.2 - '@types/markdown-it-emoji@3.0.1': - dependencies: - '@types/markdown-it': 14.1.2 - '@types/markdown-it@14.1.2': dependencies: '@types/linkify-it': 5.0.0 @@ -4521,8 +4523,6 @@ snapshots: markdown-it-container@4.0.0: {} - markdown-it-emoji@3.0.0: {} - markdown-it-mathjax3@4.3.2: dependencies: juice: 8.1.0 diff --git a/src/node/markdown/markdown.ts b/src/node/markdown/markdown.ts index 8cb826d1..0dc61d98 100644 --- a/src/node/markdown/markdown.ts +++ b/src/node/markdown/markdown.ts @@ -15,6 +15,7 @@ import { titlePlugin } from '@mdit-vue/plugin-title' import { tocPlugin, type TocPluginOptions } from '@mdit-vue/plugin-toc' import { slugify as defaultSlugify } from '@mdit-vue/shared' import { anchor as anchorPlugin, type AnchorOptions } from '@mdit/plugin-anchor' +import { fullEmoji as emojiPlugin } from '@mdit/plugin-emoji' import type { CodeToHastOptions, LanguageInput, @@ -24,7 +25,6 @@ import type { import { MarkdownItAsync, type MarkdownItAsyncOptions } from 'markdown-it-async' import attrsPlugin, { type MarkdownItAttrsOptions } from 'markdown-it-attrs' import mditCjkFriendly from 'markdown-it-cjk-friendly' -import { full as emojiPlugin } from 'markdown-it-emoji' import path from 'node:path' import type { BuiltinLanguage, BuiltinTheme, Highlighter } from 'shiki' import type { Logger } from 'vite' @@ -42,6 +42,9 @@ import { tablePlugin } from './plugins/table' export type { Header } from '../shared' +// not exported from @mdit/plugin-emoji, so derive it from the plugin signature +type EmojiPluginOptions = NonNullable[1]> + export type ThemeOptions = | ThemeRegistrationAny | BuiltinTheme @@ -180,16 +183,10 @@ export interface MarkdownOptions extends MarkdownItAsyncOptions { */ attrs?: MarkdownItAttrsOptions | false /** - * Options for `markdown-it-emoji`. Set to `false` to disable. - * @see https://github.com/markdown-it/markdown-it-emoji + * Options for `@mdit/plugin-emoji`. Set to `false` to disable. + * @see https://mdit-plugins.github.io/emoji.html */ - emoji?: - | { - defs?: Record - enabled?: string[] - shortcuts?: Record - } - | false + emoji?: EmojiPluginOptions | false /** * Improves emphasis (`**bold**`) handling in Japanese, Chinese, and * Korean text. From 7c09583eaa5ebdc87787c3f1cbbdaa3f44e9d47b Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Fri, 24 Jul 2026 01:28:24 +0530 Subject: [PATCH 038/136] test(markdown): cover attrs behavior before plugin migration Captures what the markdown-it-attrs patch enforces (curly attributes never consume fence info, preserving line-highlight syntax) plus the supported attribute placements, as a regression baseline. Co-Authored-By: Claude Fable 5 --- __tests__/unit/node/markdown/markdown.test.ts | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/__tests__/unit/node/markdown/markdown.test.ts b/__tests__/unit/node/markdown/markdown.test.ts index 0c8e554d..d46c5aad 100644 --- a/__tests__/unit/node/markdown/markdown.test.ts +++ b/__tests__/unit/node/markdown/markdown.test.ts @@ -114,6 +114,31 @@ describe('node/markdown/markdown', () => { }) }) + describe('attrs', () => { + test('does not consume fence info', async () => { + // line-highlight / meta syntax must reach the highlighter untouched + const meta = await render('```js{4}\nconst a = 1\n```') + expect(meta).toContain('language-js') + expect(meta).not.toContain('4=""') + + // curly attributes have no effect on fenced code blocks + const backtick = await render('```js {.foo}\nconst a = 1\n```') + expect(backtick).not.toContain('class="foo"') + const tilde = await render('~~~js {.foo}\nconst a = 1\n~~~') + expect(tilde).not.toContain('class="foo"') + }) + + test('applies to inline elements and blocks', async () => { + expect(await render('*hi*{.cls}')).toContain('') + expect(await render('`code`{.cls}')).toContain('class="cls"') + expect(await render('text {.cls}')).toContain('

') + expect(await render('- item\n{.cls}')).toContain('