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.0
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.1
Choose a head ref
  • 12 commits
  • 15 files changed
  • 5 contributors

Commits on Apr 10, 2024

  1. docs: improve zh translation for mpa mode

    meteorlxy committed Apr 10, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    27f8644 View commit details
  2. build: set up sort-package-json

    meteorlxy committed Apr 10, 2024
    Copy the full SHA
    972c100 View commit details
  3. docs: added nginx deployment documentation (#3770)

    closes #3235
    florian-sattler authored Apr 10, 2024
    Copy the full SHA
    f65053c View commit details
  4. fix(client): don't reload page on hash change (#3777)

    brc-dd authored Apr 10, 2024
    Copy the full SHA
    74b725a View commit details

Commits on Apr 11, 2024

  1. feat: upgrade markdown-it types to v14 (#3772)

    meteorlxy authored Apr 11, 2024
    Copy the full SHA
    d3dd4bc View commit details

Commits on Apr 15, 2024

  1. feat: config file hot update error prints error message (#3592)

    btea authored Apr 15, 2024
    Copy the full SHA
    cd5adf3 View commit details
  2. fix: sync updates of markdown-it types

    meteorlxy committed Apr 15, 2024
    Copy the full SHA
    11f4c9a View commit details
  3. build: bump deps

    meteorlxy committed Apr 15, 2024
    Copy the full SHA
    3831204 View commit details
  4. chore: remove missing type

    brc-dd committed Apr 15, 2024
    Copy the full SHA
    469ff38 View commit details

Commits on Apr 18, 2024

  1. fix: let vue compiler handle entity decoding

    yyx990803 committed Apr 18, 2024
    Copy the full SHA
    f86ac56 View commit details
  2. chore: override text renderer before calling user config

    brc-dd committed Apr 18, 2024
    Copy the full SHA
    a1ced36 View commit details
  3. release: v1.1.1

    brc-dd committed Apr 18, 2024
    Copy the full SHA
    3f551ea View commit details
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -15,3 +15,4 @@ examples-temp
node_modules
pnpm-global
TODOs.md
*.timestamp-*.mjs
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## [1.1.1](https://github.com/vuejs/vitepress/compare/v1.1.0...v1.1.1) (2024-04-18)

### Bug Fixes

- **client:** don't reload page on hash change ([#3777](https://github.com/vuejs/vitepress/issues/3777)) ([74b725a](https://github.com/vuejs/vitepress/commit/74b725a224438ef776fed25ee82274429d94ac83))
- let vue compiler handle entity decoding ([f86ac56](https://github.com/vuejs/vitepress/commit/f86ac56b78da76f3061e6537b897bb13c1ed802d))
- hot updating config file suppresses error logs ([#3592](https://github.com/vuejs/vitepress/issues/3592)) ([cd5adf3](https://github.com/vuejs/vitepress/commit/cd5adf3011d677263c93ce6f8066aaa7870b1dfc))

# [1.1.0](https://github.com/vuejs/vitepress/compare/v1.0.2...v1.1.0) (2024-04-09)

### Bug Fixes
44 changes: 44 additions & 0 deletions docs/guide/deploy.md
Original file line number Diff line number Diff line change
@@ -291,3 +291,47 @@ You can deploy your Vitepress website on [Kinsta](https://kinsta.com/static-site
### Stormkit

You can deploy your VitePress project to [Stormkit](https://www.stormkit.io) by following these [instructions](https://stormkit.io/blog/how-to-deploy-vitepress).

### Nginx

Here is a example of an Nginx server block configuration. This setup includes gzip compression for common text-based assets, rules for serving your VitePress site's static files with proper caching headers as well as handling `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";
}
}
}
```

This configuration assumes that your built VitePress site is located in the `/app` directory on your server. Adjust the `root` directive accordingly if your site's files are located elsewhere.

::: warning Do not default to index.html
The try_files resolution must not default to index.html like in other Vue applications. This would result in an invalid page state.
:::

Further information can be found in the [official nginx documentation](https://nginx.org/en/docs/), in these issues [#2837](https://github.com/vuejs/vitepress/discussions/2837), [#3235](https://github.com/vuejs/vitepress/issues/3235) as well as in this [blog post](https://blog.mehdi.cc/articles/vitepress-cleanurls-on-nginx-environment#readings) by Mehdi Merah.
6 changes: 3 additions & 3 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -3,11 +3,11 @@
"private": true,
"type": "module",
"scripts": {
"dev": "vitepress dev",
"build": "vitepress build",
"preview": "vitepress preview",
"dev": "vitepress dev",
"lunaria:build": "lunaria build",
"lunaria:open": "open-cli .vitepress/dist/_translations/index.html"
"lunaria:open": "open-cli .vitepress/dist/_translations/index.html",
"preview": "vitepress preview"
},
"devDependencies": {
"@lunariajs/core": "^0.0.32",
6 changes: 3 additions & 3 deletions docs/zh/guide/mpa-mode.md
Original file line number Diff line number Diff line change
@@ -2,9 +2,9 @@

可以通过命令行输入 `vitepress build --mpa` 或在配置文件中指定 `mpa: true` 配置选项来启用 MPA (Multi-Page Application) 模式。

在 MPA 模式下,所有页面都会默认不包含任何 JavaScript。因此,站点可能评估工具中获得更好的初始访问性能分数
在 MPA 模式下,所有页面都默认不会包含任何 JavaScript。因此,站点也许可以在评估工具中获得更好的初始访问性能分数

但是,由于 SPA 导航的缺失,跨页面链接将导致重新加载整个页面。MPA 模式下的导航不会像 SPA 模式那样立即响应。
但是,由于缺少 SPA 路由,在 MPA 模式下切换页面时会重新加载整个页面,而不会像 SPA 模式那样立即响应。

同时请注意,默认情况下不使用 JavaScript 意味着你实际上只是将 Vue 作为服务器端模板语言。浏览器不会附加任何事件处理程序,因此将不会有任何交互性。要加载客户端 JavaScript,需要使用特殊的 `<script client>` 标签:

@@ -20,4 +20,4 @@ document.querySelector('h1').addEventListener('click', () => {

`<script client>` 是 VitePress 独有的功能,而不是 Vue 的功能。它可以在 `.md``.vue` 文件中使用,但只能在 MPA 模式下使用。所有主题组件中的客户端脚本将被打包在一起,而特定页面的客户端脚本将会分开处理。

请注意,`<script client>` **不会被视为 Vue 组件代码**:它将是普通的 JavaScript 模块。因此,只有在站点需要绝对最小的客户端交互性时,才应该使用 MPA 模式。
请注意,`<script client>` **不会被视为 Vue 组件代码**,它只是普通的 JavaScript 模块。因此,只有在站点需要极少的客户端交互时,才应该使用 MPA 模式。
124 changes: 64 additions & 60 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
{
"name": "vitepress",
"version": "1.1.0",
"version": "1.1.1",
"description": "Vite & Vue powered static site generator",
"keywords": [
"vite",
"vue",
"vitepress"
],
"homepage": "https://github.com/vuejs/vitepress/tree/main/#readme",
"bugs": {
"url": "https://github.com/vuejs/vitepress/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vitepress.git"
},
"license": "MIT",
"author": "Evan You",
"type": "module",
"packageManager": "pnpm@8.15.6",
"main": "dist/node/index.js",
"types": "types/index.d.ts",
"exports": {
".": {
"types": "./types/index.d.ts",
@@ -29,6 +41,8 @@
"default": "./lib/vue-demi.mjs"
}
},
"main": "dist/node/index.js",
"types": "types/index.d.ts",
"bin": {
"vitepress": "bin/vitepress.js"
},
@@ -42,21 +56,6 @@
"theme-without-fonts.d.ts",
"lib"
],
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vitepress.git"
},
"keywords": [
"vite",
"vue",
"vitepress"
],
"author": "Evan You",
"license": "MIT",
"homepage": "https://github.com/vuejs/vitepress/tree/main/#readme",
"bugs": {
"url": "https://github.com/vuejs/vitepress/issues"
},
"scripts": {
"dev": "rimraf dist && run-s dev:shared dev:start",
"dev:start": "run-p dev:client dev:node dev:watch",
@@ -95,44 +94,39 @@
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
"release": "node scripts/release.js"
},
"simple-git-hooks": {
"pre-commit": "pnpm lint-staged"
},
"lint-staged": {
"*": "prettier --write --ignore-unknown",
"package.json": "sort-package-json"
},
"dependencies": {
"@docsearch/css": "^3.6.0",
"@docsearch/js": "^3.6.0",
"@shikijs/core": "^1.2.4",
"@shikijs/transformers": "^1.2.4",
"@types/markdown-it": "^13.0.7",
"@shikijs/core": "^1.3.0",
"@shikijs/transformers": "^1.3.0",
"@types/markdown-it": "^14.0.1",
"@vitejs/plugin-vue": "^5.0.4",
"@vue/devtools-api": "^7.0.25",
"@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.2.4",
"shiki": "^1.3.0",
"vite": "^5.2.8",
"vue": "^3.4.21"
},
"peerDependencies": {
"markdown-it-mathjax3": "^4",
"postcss": "^8"
},
"peerDependenciesMeta": {
"markdown-it-mathjax3": {
"optional": true
},
"postcss": {
"optional": true
}
"vue": "^3.4.22"
},
"devDependencies": {
"@clack/prompts": "^0.7.0",
"@mdit-vue/plugin-component": "2.0.0",
"@mdit-vue/plugin-frontmatter": "2.0.0",
"@mdit-vue/plugin-headers": "2.0.0",
"@mdit-vue/plugin-sfc": "2.0.0",
"@mdit-vue/plugin-title": "2.0.0",
"@mdit-vue/plugin-toc": "2.0.0",
"@mdit-vue/shared": "2.0.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",
"@polka/compression": "1.0.0-next.25",
"@rollup/plugin-alias": "^5.1.0",
"@rollup/plugin-commonjs": "^25.0.7",
@@ -148,12 +142,12 @@
"@types/markdown-it-attrs": "^4.1.3",
"@types/markdown-it-container": "^2.0.10",
"@types/markdown-it-emoji": "^2.0.5",
"@types/micromatch": "^4.0.6",
"@types/micromatch": "^4.0.7",
"@types/minimist": "^1.2.5",
"@types/node": "^20.12.6",
"@types/node": "^20.12.7",
"@types/postcss-prefix-selector": "^1.16.3",
"@types/prompts": "^2.4.9",
"@vue/shared": "^3.4.21",
"@vue/shared": "^3.4.22",
"chokidar": "^3.6.0",
"conventional-changelog-cli": "^4.1.0",
"cross-spawn": "^7.0.3",
@@ -183,44 +177,54 @@
"path-to-regexp": "^6.2.2",
"picocolors": "^1.0.0",
"pkg-dir": "^8.0.0",
"playwright-chromium": "^1.43.0",
"playwright-chromium": "^1.43.1",
"polka": "1.0.0-next.25",
"postcss-prefix-selector": "^1.16.0",
"prettier": "^3.2.5",
"prompts": "^2.4.2",
"punycode": "^2.3.1",
"rimraf": "^5.0.5",
"rollup": "^4.14.1",
"rollup": "^4.14.3",
"rollup-plugin-dts": "^6.1.0",
"rollup-plugin-esbuild": "^6.1.1",
"semver": "^7.6.0",
"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.4",
"vitest": "^1.4.0",
"vue-tsc": "^2.0.11",
"typescript": "^5.4.5",
"vitest": "^1.5.0",
"vue-tsc": "^2.0.13",
"wait-on": "^7.2.0"
},
"simple-git-hooks": {
"pre-commit": "pnpm lint-staged"
"peerDependencies": {
"markdown-it-mathjax3": "^4",
"postcss": "^8"
},
"lint-staged": {
"*": [
"prettier --write --ignore-unknown"
]
"peerDependenciesMeta": {
"markdown-it-mathjax3": {
"optional": true
},
"postcss": {
"optional": true
}
},
"packageManager": "pnpm@8.15.7",
"pnpm": {
"overrides": {
"ora>string-width": "^5"
},
"peerDependencyRules": {
"ignoreMissing": [
"@algolia/client-search",
"search-insights",
"postcss"
]
},
"overrides": {
"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"
}
}
}
13 changes: 13 additions & 0 deletions patches/@types__markdown-it@14.0.1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/package.json b/package.json
index 3b3cdfc4427a1a64fdd3b37604a7174e4646e423..afaea16b115554fcf15a905642562e881ece7ca6 100644
--- a/package.json
+++ b/package.json
@@ -27,7 +27,7 @@
}
],
"main": "",
- "types": "index.d.ts",
+ "types": "index.d.mts",
"exports": {
".": {
"import": "./index.d.mts",
29 changes: 29 additions & 0 deletions patches/markdown-it-anchor@8.6.7.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
diff --git a/types/index.d.ts b/types/index.d.ts
index 7c94aae194faa66ca006ace98cdb0dee82a3e471..0377cace7c4a9653d4ecf963babffd4bd68494b0 100644
--- a/types/index.d.ts
+++ b/types/index.d.ts
@@ -1,10 +1,10 @@
-import MarkdownIt = require('markdown-it');
-import Token = require('markdown-it/lib/token');
-import State = require('markdown-it/lib/rules_core/state_core');
+import MarkdownIt from 'markdown-it';
+import Token from 'markdown-it/lib/token.mjs';
+import StateCore from 'markdown-it/lib/rules_core/state_core.mjs';

declare namespace anchor {
- export type RenderHref = (slug: string, state: State) => string;
- export type RenderAttrs = (slug: string, state: State) => Record<string, string | number>;
+ export type RenderHref = (slug: string, state: StateCore) => string;
+ export type RenderAttrs = (slug: string, state: StateCore) => Record<string, string | number>;

export interface PermalinkOptions {
class?: string,
@@ -37,7 +37,7 @@ declare namespace anchor {
placement?: 'before' | 'after'
}

- export type PermalinkGenerator = (slug: string, opts: PermalinkOptions, state: State, index: number) => void;
+ export type PermalinkGenerator = (slug: string, opts: PermalinkOptions, state: StateCore, index: number) => void;

export interface AnchorInfo {
slug: string;
Loading