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.4
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.2.0
Choose a head ref
  • 19 commits
  • 34 files changed
  • 5 contributors

Commits on Apr 28, 2024

  1. fix(dev): match dev and prod routing behavior (#3837)

    brc-dd authored Apr 28, 2024
    1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    b360ac8 View commit details
  2. fix(theme): fix invalid vp-offset in ssr

    brc-dd committed Apr 28, 2024
    1
    Copy the full SHA
    9794877 View commit details
  3. fix(build): show file info on error

    brc-dd committed Apr 28, 2024
    1
    Copy the full SHA
    f0debd2 View commit details
  4. fix(theme): external link icon not visible for target _blank links

    closes #3327
    brc-dd committed Apr 28, 2024
    1
    Copy the full SHA
    d08eeed View commit details
  5. ci: add discussions permission to lock threads

    brc-dd committed Apr 28, 2024
    1
    Copy the full SHA
    c245ee0 View commit details
  6. ci: use random time for cron

    brc-dd committed Apr 28, 2024
    2
    Copy the full SHA
    3ec48f1 View commit details

Commits on Apr 29, 2024

  1. chore: minor tweaks

    brc-dd committed Apr 29, 2024
    1
    Copy the full SHA
    9b2dd50 View commit details

Commits on May 2, 2024

  1. chore: bump deps, fix dts generation (#3856)

    brc-dd authored May 2, 2024
    1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    620ee6a View commit details
  2. fix: render 404 page completely on client to infer locale from browse…

    …r path (#3858)
    brc-dd authored May 2, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    728cb15 View commit details
  3. feat(build/i18n): support customizing copy code button's tooltip text (

    …#3854)
    
    Co-authored-by: Divyansh Singh <40380293+brc-dd@users.noreply.github.com>
    nozomuikuta and brc-dd authored May 2, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    ed6ada7 View commit details

Commits on May 3, 2024

  1. feat(build): add localeIndex to md.env (#3862)

    brc-dd authored May 3, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    0cbb469 View commit details

Commits on May 4, 2024

  1. fix(theme/regression): custom font not applying in Chinese docs becau…

    …se of specificity
    
    closes #3864
    brc-dd committed May 4, 2024
    Copy the full SHA
    fa2f38a View commit details
  2. docs: add notes for sitemap + base

    closes #3863
    brc-dd committed May 4, 2024
    Copy the full SHA
    99c0cec View commit details

Commits on May 11, 2024

  1. fix(markdown): entities and escapes not working properly (#3882)

    brc-dd authored May 11, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    d5dbd70 View commit details

Commits on May 12, 2024

  1. docs(zh): sync and tweak translations (#3883)

    Co-authored-by: Xavi Lee <xavilee2002@outlook.com>
    Jinzedev and awxiaoxian2020 authored May 12, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    9447cee View commit details

Commits on May 15, 2024

  1. fix(style): prefer YaHei over DengXian

    brc-dd committed May 15, 2024
    Copy the full SHA
    f0a37b4 View commit details

Commits on May 17, 2024

  1. build: bump deps

    meteorlxy committed May 17, 2024
    Copy the full SHA
    db51f7a View commit details

Commits on May 18, 2024

  1. chore: bump deps

    brc-dd committed May 18, 2024
    Copy the full SHA
    241a7c8 View commit details
  2. release: v1.2.0

    brc-dd committed May 18, 2024
    Copy the full SHA
    1699abf View commit details
3 changes: 2 additions & 1 deletion .github/workflows/lock-threads.yml
Original file line number Diff line number Diff line change
@@ -2,12 +2,13 @@ name: Lock Threads

on:
schedule:
- cron: 0 0 * * *
- cron: 38 4 * * *
workflow_dispatch:

permissions:
issues: write
pull-requests: write
discussions: write

concurrency:
group: lock
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
# [1.2.0](https://github.com/vuejs/vitepress/compare/v1.1.4...v1.2.0) (2024-05-18)

### Bug Fixes

- **build:** show file info on error ([f0debd2](https://github.com/vuejs/vitepress/commit/f0debd20f48ab7eb58cfd142147531509d6c0209))
- **dev:** match dev and prod routing behavior ([#3837](https://github.com/vuejs/vitepress/issues/3837)) ([b360ac8](https://github.com/vuejs/vitepress/commit/b360ac88df3bfd60e3498cc19066c0c90261ee4f))
- **markdown:** entities and escapes not working properly ([#3882](https://github.com/vuejs/vitepress/issues/3882)) ([d5dbd70](https://github.com/vuejs/vitepress/commit/d5dbd704ceb215ebf3ce9b23deec6e6c90634f0a))
- render 404 page completely on client to infer locale from browser path ([#3858](https://github.com/vuejs/vitepress/issues/3858)) ([728cb15](https://github.com/vuejs/vitepress/commit/728cb15677f4f84b33bed6bb2f70f47600ea1057))
- **style:** prefer YaHei over DengXian ([f0a37b4](https://github.com/vuejs/vitepress/commit/f0a37b4b8445ec914700df054c0897721382e5b1))
- **theme/regression:** custom font not applying in Chinese docs because of specificity ([fa2f38a](https://github.com/vuejs/vitepress/commit/fa2f38a0c3bd121dcb7e07420566087c19b10f96)), closes [#3864](https://github.com/vuejs/vitepress/issues/3864)
- **theme:** external link icon not visible for target \_blank links ([d08eeed](https://github.com/vuejs/vitepress/commit/d08eeed89726572f7ea341df59864cc72716751c)), closes [#3327](https://github.com/vuejs/vitepress/issues/3327)
- **theme:** fix invalid vp-offset in ssr ([9794877](https://github.com/vuejs/vitepress/commit/9794877347140c7b4955d735cd8867c260a5089d))

### Features

- **build/i18n:** support customizing copy code button's tooltip text ([#3854](https://github.com/vuejs/vitepress/issues/3854)) ([ed6ada7](https://github.com/vuejs/vitepress/commit/ed6ada7a688c466920f3e0ef33b7176b8eb01eee))
- **build:** add localeIndex to md.env ([#3862](https://github.com/vuejs/vitepress/issues/3862)) ([0cbb469](https://github.com/vuejs/vitepress/commit/0cbb469842d74381ad56d44b7975f34c405b78f8))

## [1.1.4](https://github.com/vuejs/vitepress/compare/v1.1.3...v1.1.4) (2024-04-27)

### Bug Fixes
29 changes: 17 additions & 12 deletions docs/guide/sitemap-generation.md
Original file line number Diff line number Diff line change
@@ -3,13 +3,11 @@
VitePress comes with out-of-the-box support for generating a `sitemap.xml` file for your site. To enable it, add the following to your `.vitepress/config.js`:

```ts
import { defineConfig } from 'vitepress'

export default defineConfig({
export default {
sitemap: {
hostname: 'https://example.com'
}
})
}
```

To have `<lastmod>` tags in your `sitemap.xml`, you can enable the [`lastUpdated`](../reference/default-theme-last-updated) option.
@@ -19,24 +17,31 @@ To have `<lastmod>` tags in your `sitemap.xml`, you can enable the [`lastUpdated
Sitemap support is powered by the [`sitemap`](https://www.npmjs.com/package/sitemap) module. You can pass any options supported by it to the `sitemap` option in your config file. These will be passed directly to the `SitemapStream` constructor. Refer to the [`sitemap` documentation](https://www.npmjs.com/package/sitemap#options-you-can-pass) for more details. Example:

```ts
import { defineConfig } from 'vitepress'

export default defineConfig({
export default {
sitemap: {
hostname: 'https://example.com',
lastmodDateOnly: false
}
})
}
```

If you're using `base` in your config, you should append it to the `hostname` option:

```ts
export default {
base: '/my-site/',
sitemap: {
hostname: 'https://example.com/my-site/'
}
}
```

## `transformItems` Hook

You can use the `sitemap.transformItems` hook to modify the sitemap items before they are written to the `sitemap.xml` file. This hook is called with an array of sitemap items and expects an array of sitemap items to be returned. Example:

```ts
import { defineConfig } from 'vitepress'

export default defineConfig({
export default {
sitemap: {
hostname: 'https://example.com',
transformItems: (items) => {
@@ -49,5 +54,5 @@ export default defineConfig({
return items
}
}
})
}
```
48 changes: 48 additions & 0 deletions docs/zh/guide/deploy.md
Original file line number Diff line number Diff line change
@@ -287,3 +287,51 @@ Cache-Control: max-age=31536000,immutable
### Kinsta 静态站点托管 {#kinsta-static-site-hosting}

你可以按照这些[说明](https://kinsta.com/docs/vitepress-static-site-example/) 在 [Kinsta](https://kinsta.com/static-site-hosting/) 上部署 Vitepress 站点。

### Stormkit

你可以按照这些[说明](https://stormkit.io/blog/how-to-deploy-vitepress)将你的 VitePress 项目部署到 [Stormkit](https://www.stormkit.io)。

### Nginx

下面是一个 Nginx 服务器块配置示例。此配置包括对基于文本的常见资源的 gzip 压缩、使用适当缓存头为 VitePress 站点静态文件提供服务的规则以及处理 `cleanUrls: true` 的方法。

```nginx
server {
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
listen 80;
server_name _;
index index.html;
location / {
# content location
root /app;
# exact matches -> reverse clean urls -> folders -> not found
try_files $uri $uri.html $uri/ =404;
# non existent pages
error_page 404 /404.html;
# a folder without index.html raises 403 in this setup
error_page 403 /404.html;
# adjust caching headers
# files in the assets folder have hashes filenames
location ~* ^/assets/ {
expires 1y;
add_header Cache-Control "public, immutable";
}
}
}
```

本配置默认已构建的 VitePress 站点位于服务器上的 `/app` 目录中。如果站点文件位于其他位置,请相应调整 `root` 指令。

::: warning 不要默认为 index.html
try_files 解析不能像其他 Vue 应用那样默认为 index.html。这会导致页面状态处于无效。
:::

更多信息请参见 [nginx 官方文档](https://nginx.org/en/docs/)、这些 GitHub Issue [#2837](https://github.com/vuejs/vitepress/discussions/2837)、[#3235](https://github.com/vuejs/vitepress/issues/3235)以及 Mehdi Merah 发表的[博客](https://blog.mehdi.cc/articles/vitepress-cleanurls-on-nginx-environment#readings)。
2 changes: 1 addition & 1 deletion docs/zh/guide/getting-started.md
Original file line number Diff line number Diff line change
@@ -86,7 +86,7 @@ $ bun vitepress init
<<< @/snippets/init.ansi

:::tip Vue 作为 peer dependency
如果打算使用 Vue 组件或 API 进行自定义,还应该明确地将 `vue` 安装为 peer dependency。
如果打算使用 Vue 组件或 API 进行自定义,还应该明确地将 `vue` 安装为 dependency。
:::

## 文件结构 {#file-structure}
31 changes: 18 additions & 13 deletions docs/zh/guide/sitemap-generation.md
Original file line number Diff line number Diff line change
@@ -3,13 +3,11 @@
VitePress 提供开箱即用的配置,为站点生成 `sitemap.xml` 文件。要启用它,请将以下内容添加到 `.vitepress/config.js` 中:

```ts
import { defineConfig } from 'vitepress'

export default defineConfig({
export default {
sitemap: {
hostname: 'https://example.com'
}
})
}
```

要在 `sitemap.xml` 中包含 `<lastmod>` 标签,可以启用 [`lastUpdated`](../reference/default-theme-last-updated) 选项。
@@ -19,28 +17,35 @@ export default defineConfig({
VitePress 的 sitemap 由 [`sitemap`](https://www.npmjs.com/package/sitemap) 模块提供支持。可以将该模块支持的选项传递给配置文件中的 `sitemap` 选项。这些选项将直接传递给 `SitemapStream` 构造函数。有关更多详细信息,请参阅 [`sitemap` 文档](https://www.npmjs.com/package/sitemap#options-you-can-pass)。例如:

```ts
import { defineConfig } from 'vitepress'

export default defineConfig({
export default {
sitemap: {
hostname: 'https://example.com',
lastmodDateOnly: false
}
})
}
```

如果在配置中使用 `base`,则应将其追加到 `hostname` 选项中:

```ts
export default {
base: '/my-site/',
sitemap: {
hostname: 'https://example.com/my-site/'
}
}
```

## `transformItems` Hook

在将 sitemap 写入 `sitemap.xml` 文件之前,可以使用 `sitemap.transformItems` 钩子来修改 sitemap。使用 sitemap 调用该钩子,应返回 sitemap 数组。例如:

```ts
import { defineConfig } from 'vitepress'

export default defineConfig({
export default {
sitemap: {
hostname: 'https://example.com',
transformItems: (items) => {
// 添加新选项或修改/过滤现有选项
// 添加新项目或修改/筛选现有选项
items.push({
url: '/extra-page',
changefreq: 'monthly',
@@ -49,5 +54,5 @@ export default defineConfig({
return items
}
}
})
}
```
72 changes: 34 additions & 38 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
{
"name": "vitepress",
"version": "1.1.4",
"version": "1.2.0",
"description": "Vite & Vue powered static site generator",
"keywords": [
"vite",
"vue",
"vitepress"
],
"homepage": "https://github.com/vuejs/vitepress/tree/main/#readme",
"homepage": "https://vitepress.dev/",
"bugs": {
"url": "https://github.com/vuejs/vitepress/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vitepress.git"
},
"repository": "github:vuejs/vitepress",
"license": "MIT",
"author": "Evan You",
"type": "module",
@@ -104,29 +101,30 @@
"dependencies": {
"@docsearch/css": "^3.6.0",
"@docsearch/js": "^3.6.0",
"@shikijs/core": "^1.3.0",
"@shikijs/transformers": "^1.3.0",
"@types/markdown-it": "^14.0.1",
"@shikijs/core": "^1.5.2",
"@shikijs/transformers": "^1.5.2",
"@types/markdown-it": "^14.1.1",
"@vitejs/plugin-vue": "^5.0.4",
"@vue/devtools-api": "^7.0.27",
"@vue/devtools-api": "^7.2.0",
"@vue/shared": "^3.4.27",
"@vueuse/core": "^10.9.0",
"@vueuse/integrations": "^10.9.0",
"focus-trap": "^7.5.4",
"mark.js": "8.11.1",
"minisearch": "^6.3.0",
"shiki": "^1.3.0",
"vite": "^5.2.10",
"vue": "^3.4.25"
"shiki": "^1.5.2",
"vite": "^5.2.11",
"vue": "^3.4.27"
},
"devDependencies": {
"@clack/prompts": "^0.7.0",
"@mdit-vue/plugin-component": "^2.1.2",
"@mdit-vue/plugin-frontmatter": "^2.1.2",
"@mdit-vue/plugin-headers": "^2.1.2",
"@mdit-vue/plugin-sfc": "^2.1.2",
"@mdit-vue/plugin-title": "^2.1.2",
"@mdit-vue/plugin-toc": "^2.1.2",
"@mdit-vue/shared": "^2.1.2",
"@mdit-vue/plugin-component": "^2.1.3",
"@mdit-vue/plugin-frontmatter": "^2.1.3",
"@mdit-vue/plugin-headers": "^2.1.3",
"@mdit-vue/plugin-sfc": "^2.1.3",
"@mdit-vue/plugin-title": "^2.1.3",
"@mdit-vue/plugin-toc": "^2.1.3",
"@mdit-vue/shared": "^2.1.3",
"@polka/compression": "1.0.0-next.25",
"@rollup/plugin-alias": "^5.1.0",
"@rollup/plugin-commonjs": "^25.0.7",
@@ -141,29 +139,28 @@
"@types/mark.js": "^8.11.12",
"@types/markdown-it-attrs": "^4.1.3",
"@types/markdown-it-container": "^2.0.10",
"@types/markdown-it-emoji": "^2.0.5",
"@types/markdown-it-emoji": "^3.0.1",
"@types/micromatch": "^4.0.7",
"@types/minimist": "^1.2.5",
"@types/node": "^20.12.7",
"@types/node": "^20.12.12",
"@types/postcss-prefix-selector": "^1.16.3",
"@types/prompts": "^2.4.9",
"@vue/shared": "^3.4.25",
"chokidar": "^3.6.0",
"conventional-changelog-cli": "^4.1.0",
"conventional-changelog-cli": "^5.0.0",
"cross-spawn": "^7.0.3",
"debug": "^4.3.4",
"esbuild": "^0.20.2",
"esbuild": "^0.21.3",
"escape-html": "^1.0.3",
"execa": "^8.0.1",
"execa": "^9.1.0",
"fast-glob": "^3.3.2",
"fs-extra": "^11.2.0",
"get-port": "^7.1.0",
"gray-matter": "^4.0.3",
"lint-staged": "^15.2.2",
"lodash.template": "^4.5.0",
"lru-cache": "^10.2.1",
"lru-cache": "^10.2.2",
"markdown-it": "^14.1.0",
"markdown-it-anchor": "^8.6.7",
"markdown-it-anchor": "^9.0.1",
"markdown-it-attrs": "^4.1.6",
"markdown-it-container": "^4.0.0",
"markdown-it-emoji": "^3.0.0",
@@ -175,27 +172,27 @@
"ora": "^8.0.1",
"p-map": "^7.0.2",
"path-to-regexp": "^6.2.2",
"picocolors": "^1.0.0",
"picocolors": "^1.0.1",
"pkg-dir": "^8.0.0",
"playwright-chromium": "^1.43.1",
"playwright-chromium": "^1.44.0",
"polka": "1.0.0-next.25",
"postcss-prefix-selector": "^1.16.1",
"prettier": "^3.2.5",
"prompts": "^2.4.2",
"punycode": "^2.3.1",
"rimraf": "^5.0.5",
"rollup": "^4.17.0",
"rimraf": "^5.0.7",
"rollup": "^4.17.2",
"rollup-plugin-dts": "^6.1.0",
"rollup-plugin-esbuild": "^6.1.1",
"semver": "^7.6.0",
"semver": "^7.6.2",
"simple-git-hooks": "^2.11.1",
"sirv": "^2.0.4",
"sitemap": "^7.1.1",
"sort-package-json": "^2.10.0",
"supports-color": "^9.4.0",
"typescript": "^5.4.5",
"vitest": "^1.5.2",
"vue-tsc": "^2.0.14",
"vitest": "^1.6.0",
"vue-tsc": "^2.0.19",
"wait-on": "^7.2.0"
},
"peerDependencies": {
@@ -210,7 +207,7 @@
"optional": true
}
},
"packageManager": "pnpm@9.0.6",
"packageManager": "pnpm@9.1.1",
"pnpm": {
"peerDependencyRules": {
"ignoreMissing": [
@@ -223,8 +220,7 @@
"ora>string-width": "^5"
},
"patchedDependencies": {
"@types/markdown-it@14.0.1": "patches/@types__markdown-it@14.0.1.patch",
"markdown-it-anchor@8.6.7": "patches/markdown-it-anchor@8.6.7.patch"
"rollup-plugin-dts@6.1.0": "patches/rollup-plugin-dts@6.1.0.patch"
}
}
}
Loading