Skip to content

Commit

Permalink
fix(links): keep relative hash links as is
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Sep 16, 2020
1 parent 4e47701 commit a90d971
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 114 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
"author": "Evan You",
"license": "MIT",
"dependencies": {
"@vue/compiler-sfc": "3.0.0-rc.10",
"@vue/server-renderer": "3.0.0-rc.10",
"@vue/compiler-sfc": "^3.0.0-rc.11",
"@vue/server-renderer": "^3.0.0-rc.11",
"debug": "^4.1.1",
"diacritics": "^1.3.0",
"escape-html": "^1.0.3",
Expand All @@ -72,7 +72,7 @@
"prismjs": "^1.20.0",
"slash": "^3.0.0",
"vite": "^1.0.0-rc.4",
"vue": "3.0.0-rc.10"
"vue": "^3.0.0-rc.11"
},
"devDependencies": {
"@types/fs-extra": "^9.0.1",
Expand Down
6 changes: 3 additions & 3 deletions src/client/theme-default/components/NextAndPrevLinks.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { defineComponent, computed } from 'vue'
import { computed } from 'vue'
import { usePageData, useSiteData } from 'vitepress'
import { DefaultTheme } from '../config'

export default defineComponent({
export default {
setup() {
const pageData = usePageData()
// TODO: could this be useSiteData<DefaultTheme.Config> or is the siteData
Expand Down Expand Up @@ -51,4 +51,4 @@ export default defineComponent({
hasLinks
}
}
})
}
7 changes: 6 additions & 1 deletion src/client/theme-default/components/SideBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,12 @@ function resolveMultiSidebar(
}

function resolveLink(base: string, path: string): string | undefined {
return path ? joinUrl(base, path || '') : undefined
return path
? // keep relative hash to the same page
path.startsWith('#')
? path
: joinUrl(base, path)
: undefined
}

function createLink(active: boolean, text: string, link?: string): VNode {
Expand Down
120 changes: 13 additions & 107 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
chalk "^2.0.0"
js-tokens "^4.0.0"

"@babel/parser@^7.10.4", "@babel/parser@^7.11.5":
"@babel/parser@^7.11.5":
version "7.11.5"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.11.5.tgz#c7ff6303df71080ec7a4f5b8c003c58f1cf51037"
integrity sha512-X9rD8qqm695vgmeaQ4fvz/o3+Wk4ZzQvSHkDBgpYKxpD4qTAUm88ZKtHkVqIOsYFFbIQ6wQYhC6q7pjqVK0E0Q==
Expand All @@ -45,7 +45,7 @@
dependencies:
regenerator-runtime "^0.13.4"

"@babel/types@^7.10.4", "@babel/types@^7.11.5":
"@babel/types@^7.11.5":
version "7.11.5"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.11.5.tgz#d9de577d01252d77c6800cee039ee64faf75662d"
integrity sha512-bvM7Qz6eKnJVFIn+1LPtjlBFPVN5jNDc1XmN15vWe7Q3DPBufWWsLiIvUu7xW87uTG6QoggpIDnUgLQvPheU+Q==
Expand Down Expand Up @@ -314,17 +314,6 @@
"@types/express-serve-static-core" "*"
"@types/mime" "*"

"@vue/[email protected]":
version "3.0.0-rc.10"
resolved "https://registry.yarnpkg.com/@vue/compiler-core/-/compiler-core-3.0.0-rc.10.tgz#a76f713fb0462429ec0ec10a472fff1f539c5772"
integrity sha512-kQzHzRsM0NPAWHeqSTb2J4VsHhjRkGeLTsGzeMnW+sojgTnS3T94KacwvYgVS4qeZAKiDq0bMNZoJWrHVQ3T8g==
dependencies:
"@babel/parser" "^7.10.4"
"@babel/types" "^7.10.4"
"@vue/shared" "3.0.0-rc.10"
estree-walker "^2.0.1"
source-map "^0.6.1"

"@vue/[email protected]":
version "3.0.0-rc.11"
resolved "https://registry.yarnpkg.com/@vue/compiler-core/-/compiler-core-3.0.0-rc.11.tgz#4fb60aeab0b8e560fe4e587b02a546a5ad575754"
Expand All @@ -336,14 +325,6 @@
estree-walker "^2.0.1"
source-map "^0.6.1"

"@vue/[email protected]":
version "3.0.0-rc.10"
resolved "https://registry.yarnpkg.com/@vue/compiler-dom/-/compiler-dom-3.0.0-rc.10.tgz#dd1380d1ee61170de76f9eb91e0d8ac7985f0ae0"
integrity sha512-pqIUf5leZm0P9379utrRSVBMxhV8XaqJTEFFp5etCtbEa/H5ALs29EjFMtMcm9sQaVkZlKLu86mgIacbYB9Q3w==
dependencies:
"@vue/compiler-core" "3.0.0-rc.10"
"@vue/shared" "3.0.0-rc.10"

"@vue/[email protected]", "@vue/compiler-dom@^3.0.0-rc.5":
version "3.0.0-rc.11"
resolved "https://registry.yarnpkg.com/@vue/compiler-dom/-/compiler-dom-3.0.0-rc.11.tgz#f991bba3d312e58b80927454e42d2e75adae186f"
Expand All @@ -352,29 +333,7 @@
"@vue/compiler-core" "3.0.0-rc.11"
"@vue/shared" "3.0.0-rc.11"

"@vue/[email protected]":
version "3.0.0-rc.10"
resolved "https://registry.yarnpkg.com/@vue/compiler-sfc/-/compiler-sfc-3.0.0-rc.10.tgz#4351ece66cdf4d758877482f69421c43d994dbaf"
integrity sha512-VIJ+VXqeM7WoRNgD9uYSARVb6CYq+JS2NNHfeerfNc7Uk3pjYHRv1MwEicAvN6zWFm5GLC1ZYTVD+WFg3xGAkQ==
dependencies:
"@babel/parser" "^7.10.4"
"@babel/types" "^7.10.4"
"@vue/compiler-core" "3.0.0-rc.10"
"@vue/compiler-dom" "3.0.0-rc.10"
"@vue/compiler-ssr" "3.0.0-rc.10"
"@vue/shared" "3.0.0-rc.10"
consolidate "^0.15.1"
estree-walker "^2.0.1"
hash-sum "^2.0.0"
lru-cache "^5.1.1"
magic-string "^0.25.7"
merge-source-map "^1.1.0"
postcss "^7.0.27"
postcss-modules "^3.1.0"
postcss-selector-parser "^6.0.2"
source-map "^0.6.1"

"@vue/compiler-sfc@^3.0.0-rc.5":
"@vue/compiler-sfc@^3.0.0-rc.11", "@vue/compiler-sfc@^3.0.0-rc.5":
version "3.0.0-rc.11"
resolved "https://registry.yarnpkg.com/@vue/compiler-sfc/-/compiler-sfc-3.0.0-rc.11.tgz#bea07c12c5985ed97e744af1b0461169e7501a60"
integrity sha512-5rNbRiY9pG/govbwv53Y5PcL5qZRDv6twz7Nmap+hfo06u/yhjFmMeU6ftulc6fu/u/hpePVu4rrthFrmOj3hg==
Expand All @@ -396,14 +355,6 @@
postcss-selector-parser "^6.0.2"
source-map "^0.6.1"

"@vue/[email protected]":
version "3.0.0-rc.10"
resolved "https://registry.yarnpkg.com/@vue/compiler-ssr/-/compiler-ssr-3.0.0-rc.10.tgz#95a5f6b65b19a514c94f056994ec144b3b1b03ae"
integrity sha512-JBPil8sO5j7puB8acX2CQMRXEYB/EP8PoEur7RcF/+aqATI7C4yqWcSLC5TRJpigj6xE6ku6sx8om+j7ZHvgBw==
dependencies:
"@vue/compiler-dom" "3.0.0-rc.10"
"@vue/shared" "3.0.0-rc.10"

"@vue/[email protected]":
version "3.0.0-rc.11"
resolved "https://registry.yarnpkg.com/@vue/compiler-ssr/-/compiler-ssr-3.0.0-rc.11.tgz#b88df800c890de939955d6e620c7a1316a89b763"
Expand All @@ -412,28 +363,13 @@
"@vue/compiler-dom" "3.0.0-rc.11"
"@vue/shared" "3.0.0-rc.11"

"@vue/[email protected]":
version "3.0.0-rc.10"
resolved "https://registry.yarnpkg.com/@vue/reactivity/-/reactivity-3.0.0-rc.10.tgz#34d5f51bcc5a7c36e27d7a9c1bd7a3d25ffa7c56"
integrity sha512-mkUZfOJlbqGZx2cARmhCs5r2+xLJPL7VFNagmlA3Fd66ZXBc3ZvTQdYsY4VUbYJFe5ByIzqu9TZiAkzXY+JVaA==
dependencies:
"@vue/shared" "3.0.0-rc.10"

"@vue/[email protected]":
version "3.0.0-rc.11"
resolved "https://registry.yarnpkg.com/@vue/reactivity/-/reactivity-3.0.0-rc.11.tgz#e3a856f2e4e7ebbd7050b2ef71997c91e3a28a40"
integrity sha512-dlnCZdv4rKm6z4szfaua0Hsd5LQeUeZi6BI5c9Y+CBRU1Dwo8wb9Sz3I42ZRKDrkxB2ii9WhprW4d4H50RCnCA==
dependencies:
"@vue/shared" "3.0.0-rc.11"

"@vue/[email protected]":
version "3.0.0-rc.10"
resolved "https://registry.yarnpkg.com/@vue/runtime-core/-/runtime-core-3.0.0-rc.10.tgz#9055aef5113cbc328aaec29760c2151e0ed3cf40"
integrity sha512-VK/kq4gDDoqZ45CVwdbLLpikXLYLCt6YLhdgXX3fhf20gvPqrbEZv1ZNLruNnhhTpf9cLyU4tZ18DHeaUYPziw==
dependencies:
"@vue/reactivity" "3.0.0-rc.10"
"@vue/shared" "3.0.0-rc.10"

"@vue/[email protected]":
version "3.0.0-rc.11"
resolved "https://registry.yarnpkg.com/@vue/runtime-core/-/runtime-core-3.0.0-rc.11.tgz#6fade3a5d7ceed6a61683e375855bf452ce9d301"
Expand All @@ -442,15 +378,6 @@
"@vue/reactivity" "3.0.0-rc.11"
"@vue/shared" "3.0.0-rc.11"

"@vue/[email protected]":
version "3.0.0-rc.10"
resolved "https://registry.yarnpkg.com/@vue/runtime-dom/-/runtime-dom-3.0.0-rc.10.tgz#50f95cb991483a4262163723320967ad17bb321f"
integrity sha512-bH4GuneHt3FQ+/21jba5orM/CO9N1cnT7J3wtrxopFJ4/4H5cvHXyG6v+ZVTu1d733Ij/6yMRA7xbtfi9a4zJw==
dependencies:
"@vue/runtime-core" "3.0.0-rc.10"
"@vue/shared" "3.0.0-rc.10"
csstype "^2.6.8"

"@vue/[email protected]":
version "3.0.0-rc.11"
resolved "https://registry.yarnpkg.com/@vue/runtime-dom/-/runtime-dom-3.0.0-rc.11.tgz#3700e1f95b822cb6bf9a01c8cd389ae3d54af64c"
Expand All @@ -460,18 +387,13 @@
"@vue/shared" "3.0.0-rc.11"
csstype "^2.6.8"

"@vue/[email protected].10":
version "3.0.0-rc.10"
resolved "https://registry.yarnpkg.com/@vue/server-renderer/-/server-renderer-3.0.0-rc.10.tgz#57e42d5783b526c4fe7cc6a2555d49dca55d328a"
integrity sha512-yJeRmN+pEWvJy/+3RhwBd7sL+H977oNZHI4SbFR88fDbMuYVSF6YEVVnTcP+v51Z1bVfoQSxZMCsQ9dTRY79MQ==
"@vue/server-renderer@^3.0.0-rc.11":
version "3.0.0-rc.11"
resolved "https://registry.yarnpkg.com/@vue/server-renderer/-/server-renderer-3.0.0-rc.11.tgz#ddf583e2dfebb6670d20a4545dddf89358d192f7"
integrity sha512-F5CimUuZd70YLVearQIHmmgCKfGogmyirCg/W3ro9yVercqMKTLKLht8ZsjjTask9eV44/bxLUjBhGSxgRCPiw==
dependencies:
"@vue/compiler-ssr" "3.0.0-rc.10"
"@vue/shared" "3.0.0-rc.10"

"@vue/[email protected]":
version "3.0.0-rc.10"
resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.0.0-rc.10.tgz#e7ab62abcabbfc738545902b96a3aa78f59f3286"
integrity sha512-fI6gVhhgb3cAmEkY4oeVVA2hWZ2xvkgogHdBI5PL7gSvZnOB6XZ2eQGsYjC4W+7BegvEkoMBuZsFXVa4ZQ07XQ==
"@vue/compiler-ssr" "3.0.0-rc.11"
"@vue/shared" "3.0.0-rc.11"

"@vue/[email protected]":
version "3.0.0-rc.11"
Expand Down Expand Up @@ -604,7 +526,7 @@ binary-extensions@^2.0.0:
resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.0.0.tgz#23c0df14f6a88077f5f986c0d167ec03c3d5537c"
integrity sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow==

bluebird@^3.1.1, bluebird@^3.7.2:
bluebird@^3.7.2:
version "3.7.2"
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f"
integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==
Expand Down Expand Up @@ -890,13 +812,6 @@ [email protected]:
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=

consolidate@^0.15.1:
version "0.15.1"
resolved "https://registry.yarnpkg.com/consolidate/-/consolidate-0.15.1.tgz#21ab043235c71a07d45d9aad98593b0dba56bab7"
integrity sha512-DW46nrsMJgy9kqAbPt5rKaCr7uFtpo4mSUvLHIUbJEjm0vo+aY5QLwBUq3FK4tRnJr/X0Psc0C4jf/h+HtXSMw==
dependencies:
bluebird "^3.1.1"

consolidate@^0.16.0:
version "0.16.0"
resolved "https://registry.yarnpkg.com/consolidate/-/consolidate-0.16.0.tgz#a11864768930f2f19431660a65906668f5fbdc16"
Expand Down Expand Up @@ -3062,7 +2977,7 @@ postcss-modules-values@^3.0.0:
icss-utils "^4.0.0"
postcss "^7.0.6"

postcss-modules@^3.1.0, postcss-modules@^3.2.2:
postcss-modules@^3.2.2:
version "3.2.2"
resolved "https://registry.yarnpkg.com/postcss-modules/-/postcss-modules-3.2.2.tgz#ee390de0f9f18e761e1778dfb9be26685c02c51f"
integrity sha512-JQ8IAqHELxC0N6tyCg2UF40pACY5oiL6UpiqqcIFRWqgDYO8B0jnxzoQ0EOpPrWXvcpu6BSbQU/3vSiq7w8Nhw==
Expand Down Expand Up @@ -3096,7 +3011,7 @@ postcss-value-parser@^4.1.0:
resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.1.0.tgz#443f6a20ced6481a2bda4fa8532a6e55d789a2cb"
integrity sha512-97DXOFbQJhk71ne5/Mt6cOu6yxsSfM0QGQyl0L25Gca4yGWEGJaig7l7gbCX623VqTBNGLRLaVUCnNkcedlRSQ==

postcss@^7.0.0, postcss@^7.0.14, postcss@^7.0.27, postcss@^7.0.32, postcss@^7.0.5, postcss@^7.0.6:
postcss@^7.0.0, postcss@^7.0.14, postcss@^7.0.32, postcss@^7.0.5, postcss@^7.0.6:
version "7.0.32"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.32.tgz#4310d6ee347053da3433db2be492883d62cec59d"
integrity sha512-03eXong5NLnNCD05xscnGKGDZ98CyzoqPSMjOe6SuoQY7Z2hIj0Ld1g/O/UQRuOle2aRtiIRDg9tDcTGAkLfKw==
Expand Down Expand Up @@ -4010,16 +3925,7 @@ vite@^1.0.0-rc.4:
vue "^3.0.0-rc.5"
ws "^7.2.3"

[email protected]:
version "3.0.0-rc.10"
resolved "https://registry.yarnpkg.com/vue/-/vue-3.0.0-rc.10.tgz#31298a757b4fad6ee8973d0fa27c4fde8574bd01"
integrity sha512-nRsyIQtOWLDMBb5dsPwg/WdIqznCMVWN6O6wJSzhseKC768wHlZKcJ7SPHhWPid9wi3Ykhtl9vtgvxTK/qICkw==
dependencies:
"@vue/compiler-dom" "3.0.0-rc.10"
"@vue/runtime-dom" "3.0.0-rc.10"
"@vue/shared" "3.0.0-rc.10"

vue@^3.0.0-rc.5:
vue@^3.0.0-rc.11, vue@^3.0.0-rc.5:
version "3.0.0-rc.11"
resolved "https://registry.yarnpkg.com/vue/-/vue-3.0.0-rc.11.tgz#c383e74262a51f6bcffd8da9b2049db617533000"
integrity sha512-5Hbgf5c17gZvKXxxwYXL3Xsf+IsknQMiNoKCf/JcS2OvzUdiwRrlu/Pk2kNFPxD/EGX7k1+OTPWUxoq5Aq55ow==
Expand Down

0 comments on commit a90d971

Please sign in to comment.