diff --git a/CHANGELOG.md b/CHANGELOG.md index a7f513dd..0c6960c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,20 @@ +# [1.0.0-rc.25](https://github.com/vuejs/vitepress/compare/v1.0.0-rc.24...v1.0.0-rc.25) (2023-11-05) + +### Bug Fixes + +- double-slash format url should be external link ([#3165](https://github.com/vuejs/vitepress/issues/3165)) ([7dbeac6](https://github.com/vuejs/vitepress/commit/7dbeac6df0dfc0da74dffc79998a85a3afa86874)) +- missing export types in localSearch ([#3157](https://github.com/vuejs/vitepress/issues/3157)) ([0761062](https://github.com/vuejs/vitepress/commit/0761062790b441eccd0d57d51903271f30e713af)) +- **theme:** table row background-color in custom containers ([#3179](https://github.com/vuejs/vitepress/issues/3179)) ([beecec1](https://github.com/vuejs/vitepress/commit/beecec16a8d62c18f46522d461db353c97199415)) +- **theme:** theme switch is not hidden on force-dark ([#3155](https://github.com/vuejs/vitepress/issues/3155)) ([2276c1d](https://github.com/vuejs/vitepress/commit/2276c1d4dac547bb09015fcd0df73825b32c5fad)) + +### Features + +- export `mergeConfig()` ([#3143](https://github.com/vuejs/vitepress/issues/3143)) ([a850786](https://github.com/vuejs/vitepress/commit/a850786a566606fda20cc4ed71b79e975307b52a)) + +### Performance Improvements + +- reduce duplicate rendering in localSearch ([#3170](https://github.com/vuejs/vitepress/issues/3170)) ([878f437](https://github.com/vuejs/vitepress/commit/878f4378cdee3c41f7643d9c7693bb607344d0c2)) + # [1.0.0-rc.24](https://github.com/vuejs/vitepress/compare/v1.0.0-rc.23...v1.0.0-rc.24) (2023-10-24) ### Bug Fixes diff --git a/__tests__/e2e/markdown-extensions/markdown-extensions.test.ts b/__tests__/e2e/markdown-extensions/markdown-extensions.test.ts index b7ba5c19..aa1f6ff2 100644 --- a/__tests__/e2e/markdown-extensions/markdown-extensions.test.ts +++ b/__tests__/e2e/markdown-extensions/markdown-extensions.test.ts @@ -274,4 +274,9 @@ describe('Markdown File Inclusion', () => { expect(trim(await p.nth(0).textContent())).toBe('This is a region') expect(trim(await p.nth(1).textContent())).toBe('This is after region') }) + + test('ignore frontmatter if range is not specified', async () => { + const p = page.locator('.vp-doc') + expect(await p.textContent()).not.toContain('title') + }) }) diff --git a/__tests__/e2e/markdown-extensions/nested-include.md b/__tests__/e2e/markdown-extensions/nested-include.md index eb7eb718..8b876c78 100644 --- a/__tests__/e2e/markdown-extensions/nested-include.md +++ b/__tests__/e2e/markdown-extensions/nested-include.md @@ -1,3 +1,7 @@ +--- +title: Nested Include +--- + ### After Foo diff --git a/docs/guide/deploy.md b/docs/guide/deploy.md index baf52b35..f7c60322 100644 --- a/docs/guide/deploy.md +++ b/docs/guide/deploy.md @@ -285,3 +285,7 @@ Don't enable options like _Auto Minify_ for HTML code. It will remove comments f ### Edgio Refer [Creating and Deploying a VitePress App To Edgio](https://docs.edg.io/guides/vitepress). + +### Kinsta Static Site Hosting + +You can deploy your Vitepress website on [Kinsta](https://kinsta.com/static-site-hosting/) by following these [instructions](https://kinsta.com/docs/vitepress-static-site-example/). diff --git a/docs/guide/extending-default-theme.md b/docs/guide/extending-default-theme.md index e58981bf..dcbe66ad 100644 --- a/docs/guide/extending-default-theme.md +++ b/docs/guide/extending-default-theme.md @@ -101,9 +101,9 @@ import DefaultTheme from 'vitepress/theme' /** @type {import('vitepress').Theme} */ export default { extends: DefaultTheme, - enhanceApp(ctx) { + enhanceApp({ app }) { // register your custom global components - ctx.app.component('MyGlobalComponent' /* ... */) + app.component('MyGlobalComponent' /* ... */) } } ``` @@ -118,7 +118,7 @@ export default { extends: DefaultTheme, async enhanceApp({ app }) { // register your custom global components - ctx.app.component('MyGlobalComponent' /* ... */) + app.component('MyGlobalComponent' /* ... */) } } satisfies Theme ``` @@ -135,7 +135,7 @@ import DefaultTheme from 'vitepress/theme' import MyLayout from './MyLayout.vue' export default { - ...DefaultTheme, + extends: DefaultTheme, // override the Layout with a wrapper component that // injects the slots Layout: MyLayout @@ -168,7 +168,7 @@ import DefaultTheme from 'vitepress/theme' import MyComponent from './MyComponent.vue' export default { - ...DefaultTheme, + extends: DefaultTheme, Layout() { return h(DefaultTheme.Layout, null, { 'aside-outline-before': () => h(MyComponent) diff --git a/docs/guide/i18n.md b/docs/guide/i18n.md index afdd435d..0d256c73 100644 --- a/docs/guide/i18n.md +++ b/docs/guide/i18n.md @@ -82,7 +82,7 @@ However, VitePress won't redirect `/` to `/en/` by default. You'll need to confi import DefaultTheme from 'vitepress/theme' export default { - ...DefaultTheme, + extends: DefaultTheme, setup() { const { lang } = useData() watchEffect(() => { diff --git a/docs/guide/markdown.md b/docs/guide/markdown.md index 1541f11d..3756235d 100644 --- a/docs/guide/markdown.md +++ b/docs/guide/markdown.md @@ -18,7 +18,7 @@ This allows you to link to the heading as `#my-anchor` instead of the default `# ## Links -Both internal and external links gets special treatments. +Both internal and external links get special treatment. ### Internal Links diff --git a/docs/guide/ssr-compat.md b/docs/guide/ssr-compat.md index dfb0d7c7..aa8a5478 100644 --- a/docs/guide/ssr-compat.md +++ b/docs/guide/ssr-compat.md @@ -6,7 +6,7 @@ outline: deep VitePress pre-renders the app in Node.js during the production build, using Vue's Server-Side Rendering (SSR) capabilities. This means all custom code in theme components are subject to SSR Compatibility. -The [SSR section in official Vue docs](https://vuejs.org/guide/scaling-up/ssr.html) provides more context on what is SSR, the relationship between SSR / SSG, and common notes on writing SSR-friendly code. The rule of thumb is to only access browser / DOM APIs in `beforeMount` or `mounted` hooks of Vue components. +The [SSR section in official Vue docs](https://vuejs.org/guide/scaling-up/ssr.html) provides more context on what SSR is, the relationship between SSR / SSG, and common notes on writing SSR-friendly code. The rule of thumb is to only access browser / DOM APIs in `beforeMount` or `mounted` hooks of Vue components. ## `` diff --git a/docs/reference/default-theme-search.md b/docs/reference/default-theme-search.md index fc516d1d..e42f3c2f 100644 --- a/docs/reference/default-theme-search.md +++ b/docs/reference/default-theme-search.md @@ -96,7 +96,7 @@ export default defineConfig({ }) ``` -Learn more in [MiniSearch docs](https://lucaong.github.io/minisearch/classes/_minisearch_.minisearch.html). +Learn more in [MiniSearch docs](https://lucaong.github.io/minisearch/classes/MiniSearch.MiniSearch.html). ### Custom content renderer diff --git a/docs/reference/site-config.md b/docs/reference/site-config.md index 18814dd0..57920952 100644 --- a/docs/reference/site-config.md +++ b/docs/reference/site-config.md @@ -480,7 +480,7 @@ interface MarkdownOptions extends MarkdownIt.Options { // Add support for your own languages. // https://github.com/shikijs/shiki/blob/main/docs/languages.md#supporting-your-own-languages-with-shiki - languages?: Shiki.ILanguageRegistration + languages?: Shiki.ILanguageRegistration[] // markdown-it-anchor plugin options. // See: https://github.com/valeriangalliat/markdown-it-anchor#usage @@ -491,7 +491,7 @@ interface MarkdownOptions extends MarkdownIt.Options { attrs?: { leftDelimiter?: string rightDelimiter?: string - allowedAttributes?: string[] + allowedAttributes?: Array disable?: boolean } @@ -504,7 +504,7 @@ interface MarkdownOptions extends MarkdownIt.Options { // @mdit-vue/plugin-headers plugin options. // See: https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-headers#options - headers?: HeadersPluginOptions + headers?: HeadersPluginOptions | boolean // @mdit-vue/plugin-sfc plugin options. // See: https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-sfc#options @@ -531,7 +531,7 @@ interface MarkdownOptions extends MarkdownIt.Options { // 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. // See: https://github.com/tani/markdown-it-mathjax3#customization - math?: any + math?: boolean | any // Global custom container titles container?: { diff --git a/package.json b/package.json index 2bda2e8a..d08591b1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vitepress", - "version": "1.0.0-rc.24", + "version": "1.0.0-rc.25", "description": "Vite & Vue powered static site generator", "type": "module", "packageManager": "pnpm@8.9.2", diff --git a/src/client/theme-default/components/VPFooter.vue b/src/client/theme-default/components/VPFooter.vue index d1dd939c..3a21ff2b 100644 --- a/src/client/theme-default/components/VPFooter.vue +++ b/src/client/theme-default/components/VPFooter.vue @@ -28,6 +28,16 @@ const { hasSidebar } = useSidebar() display: none; } +.VPFooter :deep(a) { + text-decoration-line: underline; + text-underline-offset: 2px; + transition: color 0.25s; +} + +.VPFooter :deep(a:hover) { + color: var(--vp-c-text-1); +} + @media (min-width: 768px) { .VPFooter { padding: 32px; diff --git a/src/client/theme-default/components/VPLocalSearchBox.vue b/src/client/theme-default/components/VPLocalSearchBox.vue index d9df6a0a..24dac640 100644 --- a/src/client/theme-default/components/VPLocalSearchBox.vue +++ b/src/client/theme-default/components/VPLocalSearchBox.vue @@ -31,6 +31,7 @@ import { import type { ModalTranslations } from '../../../../types/local-search' import { pathToFile } from '../../app/utils' import { useData } from '../composables/data' +import { LRUCache } from '../support/lru' import { createTranslate } from '../support/translation' const emit = defineEmits<{ @@ -142,9 +143,16 @@ const mark = computedAsync(async () => { return markRaw(new Mark(resultsEl.value)) }, null) +const cache = new LRUCache>(16) // 16 files + debouncedWatch( () => [searchIndex.value, filterText.value, showDetailedList.value] as const, async ([index, filterTextValue, showDetailedListValue], old, onCleanup) => { + + if (old?.[0] !== index) { // in case of hmr + cache.clear() + } + let canceled = false onCleanup(() => { canceled = true @@ -163,13 +171,12 @@ debouncedWatch( ? await Promise.all(results.value.map((r) => fetchExcerpt(r.id))) : [] if (canceled) return - const c = new Map>() for (const { id, mod } of mods) { const mapId = id.slice(0, id.indexOf('#')) - let map = c.get(mapId) + let map = cache.get(mapId) if (map) continue map = new Map() - c.set(mapId, map) + cache.set(mapId, map) const comp = mod.default ?? mod if (comp?.render || comp?.setup) { const app = createApp(comp) @@ -209,7 +216,7 @@ debouncedWatch( results.value = results.value.map((r) => { const [id, anchor] = r.id.split('#') - const map = c.get(id) + const map = cache.get(id) const text = map?.get(anchor) ?? '' for (const term in r.match) { terms.add(term) diff --git a/src/client/theme-default/components/VPNavBarExtra.vue b/src/client/theme-default/components/VPNavBarExtra.vue index 36f12a55..0513d62b 100644 --- a/src/client/theme-default/components/VPNavBarExtra.vue +++ b/src/client/theme-default/components/VPNavBarExtra.vue @@ -28,7 +28,7 @@ const hasExtraContent = computed( -
+

{{ theme.darkModeSwitchLabel || 'Appearance' }} diff --git a/src/client/theme-default/components/VPNavScreenAppearance.vue b/src/client/theme-default/components/VPNavScreenAppearance.vue index a4f5675c..c68a07ba 100644 --- a/src/client/theme-default/components/VPNavScreenAppearance.vue +++ b/src/client/theme-default/components/VPNavScreenAppearance.vue @@ -6,7 +6,7 @@ const { site, theme } = useData()