Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: vuejs/vitepress
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.1.3
Choose a base ref
...
head repository: vuejs/vitepress
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.1.4
Choose a head ref
  • 11 commits
  • 14 files changed
  • 4 contributors

Commits on Apr 19, 2024

  1. fix(theme): disable keypress effect on search button

    brc-dd committed Apr 19, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    ccc37bb View commit details

Commits on Apr 22, 2024

  1. docs: update ZH translation (#3817)

    hank619 authored Apr 22, 2024
    Copy the full SHA
    0048787 View commit details

Commits on Apr 26, 2024

  1. fix(theme/i18n): 404 page not showing localized text (#3833)

    brc-dd authored Apr 26, 2024
    Copy the full SHA
    cc11b8e View commit details
  2. fix(theme/a11y): remove duplicate assistive text from outline nav [#3800

    ] (#3803)
    olets authored Apr 26, 2024
    Copy the full SHA
    733d986 View commit details
  3. fix(theme/a11y): add unique name to footer prev / next navigation lan…

    …dmark
    
    Co-authored-by: Divyansh Singh <40380293+brc-dd@users.noreply.github.com>
    olets and brc-dd authored Apr 26, 2024
    Copy the full SHA
    e60c101 View commit details
  4. fix(theme): leaking event listener when going back/forward on Safari …

    …on iOS (#3658) (#3671)
    
    Co-authored-by: Divyansh Singh <40380293+brc-dd@users.noreply.github.com>
    0xlau and brc-dd authored Apr 26, 2024
    Copy the full SHA
    1a72181 View commit details
  5. chore: remove duplicate font-family entries

    brc-dd committed Apr 26, 2024
    Copy the full SHA
    1174060 View commit details

Commits on Apr 27, 2024

  1. fix(theme): don't use Chinese quotes on non-Chinese documents (#3834)

    brc-dd authored Apr 27, 2024
    Copy the full SHA
    75115f4 View commit details
  2. fix(dev): multiple server instances being created when editing config…

    … too quickly (#3835)
    brc-dd authored Apr 27, 2024
    1
    Copy the full SHA
    729a890 View commit details
  3. chore: bump deps

    brc-dd committed Apr 27, 2024
    1
    Copy the full SHA
    efa4abf View commit details
  4. release: v1.1.4

    brc-dd committed Apr 27, 2024
    1
    Copy the full SHA
    a0f7b94 View commit details
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ jobs:

strategy:
matrix:
node_version: [18, 20, 21]
node_version: [18, 20, 22]

steps:
- name: Checkout
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## [1.1.4](https://github.com/vuejs/vitepress/compare/v1.1.3...v1.1.4) (2024-04-27)

### Bug Fixes

- **dev:** multiple server instances being created when editing config too quickly ([#3835](https://github.com/vuejs/vitepress/issues/3835)) ([729a890](https://github.com/vuejs/vitepress/commit/729a890669c363895cfac39ece046926cad36d01))
- **theme/a11y:** add unique name to footer prev / next navigation landmark ([e60c101](https://github.com/vuejs/vitepress/commit/e60c101e50fa56d4cd54d434c5628cc7e2231318))
- **theme/a11y:** remove duplicate assistive text from outline nav ([#3803](https://github.com/vuejs/vitepress/issues/3803)) ([733d986](https://github.com/vuejs/vitepress/commit/733d986a84f614484b04235546dc4cda0769e833))
- **theme/i18n:** 404 page not showing localized text ([#3833](https://github.com/vuejs/vitepress/issues/3833)) ([cc11b8e](https://github.com/vuejs/vitepress/commit/cc11b8e41ec481320b03902bdc307d479a8ba838))
- **theme:** disable keypress effect on search button ([ccc37bb](https://github.com/vuejs/vitepress/commit/ccc37bb80e4147b9ab91b0f5d7dfae9d51533460))
- **theme:** don't use Chinese quotes on non-Chinese documents ([#3834](https://github.com/vuejs/vitepress/issues/3834)) ([75115f4](https://github.com/vuejs/vitepress/commit/75115f4f8223d67dab2dc82fadaf2941aabf6330))
- **theme:** leaking event listener when going back/forward on Safari on iOS ([#3658](https://github.com/vuejs/vitepress/issues/3658)) ([#3671](https://github.com/vuejs/vitepress/issues/3671)) ([1a72181](https://github.com/vuejs/vitepress/commit/1a72181c06d78e5e6f293e3f6abdb15caa4d2f53))

## [1.1.3](https://github.com/vuejs/vitepress/compare/v1.1.1...v1.1.3) (2024-04-18)

### Bug Fixes
2 changes: 1 addition & 1 deletion docs/zh/guide/markdown.md
Original file line number Diff line number Diff line change
@@ -44,7 +44,7 @@ VitePress 带有内置的 Markdown 扩展。
```md
[Home](/) <!-- 将用户导航至根目录下的 index.html -->
[foo](/foo/) <!-- 将用户导航至目录 foo 下的 index.html -->
[foo heading](./#heading) <!-- 将用户锚定到 foo 索引文件中的一个标题上 -->
[foo heading](./#heading) <!-- 将用户锚定到目录 foo 下的index文件中的一个标题上 -->
[bar - three](../bar/three) <!-- 可以省略扩展名 -->
[bar - three](../bar/three.md) <!-- 可以添加 .md -->
[bar - four](../bar/four.html) <!-- 或者可以添加 .html -->
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vitepress",
"version": "1.1.3",
"version": "1.1.4",
"description": "Vite & Vue powered static site generator",
"keywords": [
"vite",
@@ -115,8 +115,8 @@
"mark.js": "8.11.1",
"minisearch": "^6.3.0",
"shiki": "^1.3.0",
"vite": "^5.2.9",
"vue": "^3.4.23"
"vite": "^5.2.10",
"vue": "^3.4.25"
},
"devDependencies": {
"@clack/prompts": "^0.7.0",
@@ -147,7 +147,7 @@
"@types/node": "^20.12.7",
"@types/postcss-prefix-selector": "^1.16.3",
"@types/prompts": "^2.4.9",
"@vue/shared": "^3.4.23",
"@vue/shared": "^3.4.25",
"chokidar": "^3.6.0",
"conventional-changelog-cli": "^4.1.0",
"cross-spawn": "^7.0.3",
@@ -161,7 +161,7 @@
"gray-matter": "^4.0.3",
"lint-staged": "^15.2.2",
"lodash.template": "^4.5.0",
"lru-cache": "^10.2.0",
"lru-cache": "^10.2.1",
"markdown-it": "^14.1.0",
"markdown-it-anchor": "^8.6.7",
"markdown-it-attrs": "^4.1.6",
@@ -179,12 +179,12 @@
"pkg-dir": "^8.0.0",
"playwright-chromium": "^1.43.1",
"polka": "1.0.0-next.25",
"postcss-prefix-selector": "^1.16.0",
"postcss-prefix-selector": "^1.16.1",
"prettier": "^3.2.5",
"prompts": "^2.4.2",
"punycode": "^2.3.1",
"rimraf": "^5.0.5",
"rollup": "^4.14.3",
"rollup": "^4.17.0",
"rollup-plugin-dts": "^6.1.0",
"rollup-plugin-esbuild": "^6.1.1",
"semver": "^7.6.0",
@@ -194,8 +194,8 @@
"sort-package-json": "^2.10.0",
"supports-color": "^9.4.0",
"typescript": "^5.4.5",
"vitest": "^1.5.0",
"vue-tsc": "^2.0.13",
"vitest": "^1.5.2",
"vue-tsc": "^2.0.14",
"wait-on": "^7.2.0"
},
"peerDependencies": {
@@ -210,7 +210,7 @@
"optional": true
}
},
"packageManager": "pnpm@9.0.2",
"packageManager": "pnpm@9.0.6",
"pnpm": {
"peerDependencyRules": {
"ignoreMissing": [
588 changes: 294 additions & 294 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

45 changes: 28 additions & 17 deletions src/client/theme-default/NotFound.vue
Original file line number Diff line number Diff line change
@@ -1,44 +1,55 @@
<script setup lang="ts">
import { onMounted, ref } from 'vue'
import { computed, onMounted, ref } from 'vue'
import { withBase } from 'vitepress'
import { useData } from './composables/data'
import { useLangs } from './composables/langs'
const { site, theme } = useData()
const { site } = useData()
const { localeLinks } = useLangs({ removeCurrent: false })
const root = ref('/')
const locale = ref({
link: '/',
index: 'root'
})
onMounted(() => {
const path = window.location.pathname
.replace(site.value.base, '')
.replace(/(^.*?\/).*$/, '/$1')
if (localeLinks.value.length) {
root.value =
localeLinks.value.find(({ link }) => link.startsWith(path))?.link ||
localeLinks.value[0].link
locale.value =
localeLinks.value.find(({ link }) => link.startsWith(path)) ||
localeLinks.value[0]
}
})
const notFound = computed(() => ({
code: 404,
title: 'PAGE NOT FOUND',
quote:
"But if you don't change your direction, and if you keep looking, you may end up where you are heading.",
linkLabel: 'go to home',
linkText: 'Take me home',
...(locale.value.index === 'root'
? site.value.themeConfig?.notFound
: site.value.locales?.[locale.value.index]?.themeConfig?.notFound)
}))
</script>

<template>
<div class="NotFound">
<p class="code">{{ theme.notFound?.code ?? '404' }}</p>
<h1 class="title">{{ theme.notFound?.title ?? 'PAGE NOT FOUND' }}</h1>
<p class="code">{{ notFound.code }}</p>
<h1 class="title">{{ notFound.title }}</h1>
<div class="divider" />
<blockquote class="quote">
{{
theme.notFound?.quote ??
"But if you don't change your direction, and if you keep looking, you may end up where you are heading."
}}
</blockquote>
<blockquote class="quote">{{ notFound.quote }}</blockquote>

<div class="action">
<a
class="link"
:href="withBase(root)"
:aria-label="theme.notFound?.linkLabel ?? 'go to home'"
:href="withBase(locale.link)"
:aria-label="notFound.linkLabel"
>
{{ theme.notFound?.linkText ?? 'Take me home' }}
{{ notFound.linkText }}
</a>
</div>
</div>
21 changes: 12 additions & 9 deletions src/client/theme-default/components/VPDocAsideOutline.vue
Original file line number Diff line number Diff line change
@@ -25,7 +25,8 @@ useActiveAnchor(container, marker)
</script>

<template>
<div
<nav
aria-labelledby="doc-outline-aria-label"
class="VPDocAsideOutline"
:class="{ 'has-outline': headers.length > 0 }"
ref="container"
@@ -34,16 +35,18 @@ useActiveAnchor(container, marker)
<div class="content">
<div class="outline-marker" ref="marker" />

<div class="outline-title" role="heading" aria-level="2">{{ resolveTitle(theme) }}</div>
<div
aria-level="2"
class="outline-title"
id="doc-outline-aria-label"
role="heading"
>
{{ resolveTitle(theme) }}
</div>

<nav aria-labelledby="doc-outline-aria-label">
<span class="visually-hidden" id="doc-outline-aria-label">
Table of Contents for current page
</span>
<VPDocOutlineItem :headers="headers" :root="true" />
</nav>
<VPDocOutlineItem :headers="headers" :root="true" />
</div>
</div>
</nav>
</template>

<style scoped>
8 changes: 7 additions & 1 deletion src/client/theme-default/components/VPDocFooter.vue
Original file line number Diff line number Diff line change
@@ -39,7 +39,13 @@ const showFooter = computed(() => {
</div>
</div>

<nav v-if="control.prev?.link || control.next?.link" class="prev-next">
<nav
v-if="control.prev?.link || control.next?.link"
class="prev-next"
aria-labelledby="doc-footer-aria-label"
>
<span class="visually-hidden" id="doc-footer-aria-label">Pager</span>

<div class="pager">
<VPLink v-if="control.prev?.link" class="pager-link prev" :href="control.prev.link">
<span class="desc" v-html="theme.docFooter?.prev || 'Previous page'"></span>
18 changes: 14 additions & 4 deletions src/client/theme-default/components/VPLocalNavOutlineDropdown.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { onClickOutside, onKeyStroke } from '@vueuse/core'
import { onKeyStroke } from '@vueuse/core'
import { onContentUpdated } from 'vitepress'
import { nextTick, ref } from 'vue'
import { nextTick, ref, watch } from 'vue'
import { useData } from '../composables/data'
import { resolveTitle, type MenuItem } from '../composables/outline'
import VPDocOutlineItem from './VPDocOutlineItem.vue'
@@ -17,8 +17,18 @@ const vh = ref(0)
const main = ref<HTMLDivElement>()
const items = ref<HTMLDivElement>()
onClickOutside(main, () => {
open.value = false
function closeOnClickOutside(e: Event) {
if (!main.value?.contains(e.target as Node)) {
open.value = false
}
}
watch(open, (value) => {
if (value) {
document.addEventListener('click', closeOnClickOutside)
return
}
document.removeEventListener('click', closeOnClickOutside)
})
onKeyStroke('Escape', () => {
5 changes: 5 additions & 0 deletions src/client/theme-default/components/VPNavBarSearchButton.vue
Original file line number Diff line number Diff line change
@@ -71,6 +71,11 @@ const translate = createSearchTranslate(defaultTranslations)
outline: 5px auto -webkit-focus-ring-color;
}
.DocSearch-Button-Key--pressed {
transform: none;
box-shadow: none;
}
.DocSearch-Button:focus:not(:focus-visible) {
outline: none !important;
}
2 changes: 2 additions & 0 deletions src/client/theme-default/composables/langs.ts
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ export function useLangs({
} = {}) {
const { site, localeIndex, page, theme, hash } = useData()
const currentLang = computed(() => ({
index: localeIndex.value,
label: site.value.locales[localeIndex.value]?.label,
link:
site.value.locales[localeIndex.value]?.link ||
@@ -19,6 +20,7 @@ export function useLangs({
removeCurrent && currentLang.value.label === value.label
? []
: {
index: key,
text: value.label,
link:
normalizeLink(
38 changes: 33 additions & 5 deletions src/client/theme-default/styles/fonts.css
Original file line number Diff line number Diff line change
@@ -146,12 +146,40 @@ html body {
U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Chinese quotes rendering fix. 中英文弯引号共享 Unicode 码位,确保引号使用中文字体渲染 */
@font-face {
font-family: 'Chinese Quotes';
src: local('PingFang SC Regular'), local('PingFang SC'), local('SimHei'),
local('Source Han Sans SC');
unicode-range: U+2018, U+2019, U+201C, U+201D; /* 分别是 ‘’“” */
font-family: 'Punctuation SC';
font-weight: 400;
src: local('PingFang SC Regular'), local('Noto Sans CJK SC'),
local('Microsoft YaHei');
unicode-range: U+201C, U+201D, U+2018, U+2019, U+2E3A, U+2014, U+2013, U+2026,
U+00B7, U+007E, U+002F;
}

@font-face {
font-family: 'Punctuation SC';
font-weight: 500;
src: local('PingFang SC Medium'), local('Noto Sans CJK SC'),
local('Microsoft YaHei');
unicode-range: U+201C, U+201D, U+2018, U+2019, U+2E3A, U+2014, U+2013, U+2026,
U+00B7, U+007E, U+002F;
}

@font-face {
font-family: 'Punctuation SC';
font-weight: 600;
src: local('PingFang SC Semibold'), local('Noto Sans CJK SC Bold'),
local('Microsoft YaHei Bold');
unicode-range: U+201C, U+201D, U+2018, U+2019, U+2E3A, U+2014, U+2013, U+2026,
U+00B7, U+007E, U+002F;
}

@font-face {
font-family: 'Punctuation SC';
font-weight: 700;
src: local('PingFang SC Semibold'), local('Noto Sans CJK SC Bold'),
local('Microsoft YaHei Bold');
unicode-range: U+201C, U+201D, U+2018, U+2019, U+2E3A, U+2014, U+2013, U+2026,
U+00B7, U+007E, U+002F;
}

/* Generate the subsetted fonts using: `pyftsubset <file>.woff2 --unicodes="<range>" --output-file="inter-<style>-<subset>.woff2" --flavor=woff2` */
15 changes: 10 additions & 5 deletions src/client/theme-default/styles/vars.css
Original file line number Diff line number Diff line change
@@ -261,15 +261,20 @@
* -------------------------------------------------------------------------- */

:root {
--vp-font-family-base: 'Chinese Quotes', Inter, ui-sans-serif, system-ui,
sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
'Noto Color Emoji', 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
'Noto Color Emoji';
--vp-font-family-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
--vp-font-family-base: 'Inter', ui-sans-serif, system-ui, sans-serif,
'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
--vp-font-family-mono: ui-monospace, 'Menlo', 'Monaco', 'Consolas',
'Liberation Mono', 'Courier New', monospace;
font-optical-sizing: auto;
}

:root:lang(zh) {
--vp-font-family-base: 'Punctuation SC', 'Inter', ui-sans-serif, system-ui,
'PingFang SC', 'Noto Sans CJK SC', 'Noto Sans SC', 'Heiti SC', 'DengXian',
'Microsoft YaHei', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
'Segoe UI Symbol', 'Noto Color Emoji';
}

/**
* Shadows
* -------------------------------------------------------------------------- */
14 changes: 12 additions & 2 deletions src/node/cli.ts
Original file line number Diff line number Diff line change
@@ -20,6 +20,8 @@ if (root) {
argv.root = root
}

let restartPromise: Promise<void> | undefined

if (!command || command === 'dev') {
if (argv.force) {
delete argv.force
@@ -28,8 +30,16 @@ if (!command || command === 'dev') {

const createDevServer = async () => {
const server = await createServer(root, argv, async () => {
await server.close()
await createDevServer()
if (!restartPromise) {
restartPromise = (async () => {
await server.close()
await createDevServer()
})().finally(() => {
restartPromise = undefined
})
}

return restartPromise
})
await server.listen()
logVersion(server.config.logger)