Skip to content

Commit 3e31f5f

Browse files
committed
try to solve image scrolling
1 parent 94a39fa commit 3e31f5f

File tree

5 files changed

+148
-2
lines changed

5 files changed

+148
-2
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"dependencies": {
2424
"@gtm-support/vue-gtm": "^3.1.0",
2525
"@justinribeiro/lite-youtube": "^1.8.2",
26+
"markdown-it-image-size": "^15.0.1",
2627
"smartlook-client": "^10.0.0"
2728
}
2829
}

src/.vitepress/config.mts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
import { defineConfig } from "vitepress";
1+
import { defineConfig, } from "vitepress";
22
import en from "./sidebar/en";
3+
import { markdownItImageSize } from "markdown-it-image-size";
4+
import path from "path";
35

46
// https://vitepress.dev/reference/site-config
57
export default defineConfig({
@@ -10,6 +12,11 @@ export default defineConfig({
1012
ignoreDeadLinks: true,
1113
cleanUrls: true,
1214
outDir: "../dist/docs",
15+
markdown: {
16+
config: (md) => {
17+
markdownItImageSize(md, { publicDir: path.resolve(import.meta.dirname, '../public'), });
18+
},
19+
},
1320
themeConfig: {
1421
// https://vitepress.dev/reference/default-theme-config
1522
search: {

src/.vitepress/theme/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// https://vitepress.dev/guide/custom-theme
2-
import { h } from "vue";
2+
import { h, nextTick, watch } from "vue";
33
import type { Theme } from "vitepress";
44
import DefaultTheme, { VPBadge } from "vitepress/theme";
55
import "./style.css";

src/.vitepress/theme/style.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,11 @@ a img,svg {
147147
img {
148148
max-width: 90%;
149149
max-height: 500px;
150+
width: auto;
150151
cursor: pointer;
152+
height: auto;
153+
aspect-ratio: attr(width) / attr(height);
154+
display: block;
151155
}
152156

153157
/** Custom mm theme styles */
@@ -157,3 +161,8 @@ img {
157161
align-items: center;
158162
gap: 0.25em;
159163
}
164+
165+
h1, h2, h3, h4, h5{
166+
/** For proper anchor offset when using scroll to hash links */
167+
scroll-margin-top: 60px;
168+
}

yarn.lock

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,24 @@
170170
"@babel/helper-string-parser" "^7.25.9"
171171
"@babel/helper-validator-identifier" "^7.25.9"
172172

173+
"@cacheable/memory@^2.0.6":
174+
version "2.0.7"
175+
resolved "https://registry.yarnpkg.com/@cacheable/memory/-/memory-2.0.7.tgz#1e066dc543b7c6797d0d230ce23d90898aca14c7"
176+
integrity sha512-RbxnxAMf89Tp1dLhXMS7ceft/PGsDl1Ip7T20z5nZ+pwIAsQ1p2izPjVG69oCLv/jfQ7HDPHTWK0c9rcAWXN3A==
177+
dependencies:
178+
"@cacheable/utils" "^2.3.3"
179+
"@keyv/bigmap" "^1.3.0"
180+
hookified "^1.14.0"
181+
keyv "^5.5.5"
182+
183+
"@cacheable/utils@^2.3.2", "@cacheable/utils@^2.3.3":
184+
version "2.3.3"
185+
resolved "https://registry.yarnpkg.com/@cacheable/utils/-/utils-2.3.3.tgz#56f0c0a3b2cad85f32ee2de3c73ff05d455e2c6c"
186+
integrity sha512-JsXDL70gQ+1Vc2W/KUFfkAJzgb4puKwwKehNLuB+HrNKWf91O736kGfxn4KujXCCSuh6mRRL4XEB0PkAFjWS0A==
187+
dependencies:
188+
hashery "^1.3.0"
189+
keyv "^5.5.5"
190+
173191
"@docsearch/[email protected]":
174192
version "3.8.2"
175193
resolved "https://registry.npmjs.org/@docsearch/css/-/css-3.8.2.tgz"
@@ -344,6 +362,19 @@
344362
resolved "https://registry.yarnpkg.com/@justinribeiro/lite-youtube/-/lite-youtube-1.8.2.tgz#7b0b1b43623a52fe8381a8b84d8ee4153191fc14"
345363
integrity sha512-wayU5sYA/e5J/1j7zFk8Hoi72Hk67Axy7Za2OFRzsytd9gvtv7ZeWhmdi2lOGbnXwMZHkeMsqxRGFxH60lo5bg==
346364

365+
"@keyv/bigmap@^1.3.0":
366+
version "1.3.0"
367+
resolved "https://registry.yarnpkg.com/@keyv/bigmap/-/bigmap-1.3.0.tgz#f06d9bb38488a59f012cd2758e6f429dfd312fb5"
368+
integrity sha512-KT01GjzV6AQD5+IYrcpoYLkCu1Jod3nau1Z7EsEuViO3TZGRacSbO9MfHmbJ1WaOXFtWLxPVj169cn2WNKPkIg==
369+
dependencies:
370+
hashery "^1.2.0"
371+
hookified "^1.13.0"
372+
373+
"@keyv/serialize@^1.1.1":
374+
version "1.1.1"
375+
resolved "https://registry.yarnpkg.com/@keyv/serialize/-/serialize-1.1.1.tgz#0c01dd3a3483882af7cf3878d4e71d505c81fc4a"
376+
integrity sha512-dXn3FZhPv0US+7dtJsIi2R+c7qWYiReoEh5zUntWCf4oSpMNib8FDhSoed6m3QyZdx5hK7iLFkYk3rNxwt8vTA==
377+
347378
348379
version "2.5.1"
349380
resolved "https://registry.yarnpkg.com/@parcel/watcher-android-arm64/-/watcher-android-arm64-2.5.1.tgz#507f836d7e2042f798c7d07ad19c3546f9848ac1"
@@ -828,6 +859,17 @@ braces@^3.0.3:
828859
dependencies:
829860
fill-range "^7.1.1"
830861

862+
cacheable@^2.2.0:
863+
version "2.3.1"
864+
resolved "https://registry.yarnpkg.com/cacheable/-/cacheable-2.3.1.tgz#db374342fbb48b032d57a2a7d296555be4ad574e"
865+
integrity sha512-yr+FSHWn1ZUou5LkULX/S+jhfgfnLbuKQjE40tyEd4fxGZVMbBL5ifno0J0OauykS8UiCSgHi+DV/YD+rjFxFg==
866+
dependencies:
867+
"@cacheable/memory" "^2.0.6"
868+
"@cacheable/utils" "^2.3.2"
869+
hookified "^1.14.0"
870+
keyv "^5.5.5"
871+
qified "^0.5.3"
872+
831873
ccount@^2.0.0:
832874
version "2.0.1"
833875
resolved "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz"
@@ -935,6 +977,20 @@ fill-range@^7.1.1:
935977
dependencies:
936978
to-regex-range "^5.0.1"
937979

980+
flat-cache@^6.1.17:
981+
version "6.1.19"
982+
resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-6.1.19.tgz#20e5b201c9b181a7b773b3b150108932077d2bbf"
983+
integrity sha512-l/K33newPTZMTGAnnzaiqSl6NnH7Namh8jBNjrgjprWxGmZUuxx/sJNIRaijOh3n7q7ESbhNZC+pvVZMFdeU4A==
984+
dependencies:
985+
cacheable "^2.2.0"
986+
flatted "^3.3.3"
987+
hookified "^1.13.0"
988+
989+
flatted@^3.3.3:
990+
version "3.3.3"
991+
resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.3.3.tgz#67c8fad95454a7c7abebf74bb78ee74a44023358"
992+
integrity sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==
993+
938994
focus-trap@^7.6.4:
939995
version "7.6.4"
940996
resolved "https://registry.npmjs.org/focus-trap/-/focus-trap-7.6.4.tgz"
@@ -947,6 +1003,13 @@ fsevents@~2.3.2, fsevents@~2.3.3:
9471003
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6"
9481004
integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==
9491005

1006+
hashery@^1.2.0, hashery@^1.3.0:
1007+
version "1.4.0"
1008+
resolved "https://registry.yarnpkg.com/hashery/-/hashery-1.4.0.tgz#3af04d9af0c63ff2f15a353ee9c2d11fdef7919f"
1009+
integrity sha512-Wn2i1In6XFxl8Az55kkgnFRiAlIAushzh26PTjL2AKtQcEfXrcLa7Hn5QOWGZEf3LU057P9TwwZjFyxfS1VuvQ==
1010+
dependencies:
1011+
hookified "^1.14.0"
1012+
9501013
hast-util-to-html@^9.0.4:
9511014
version "9.0.5"
9521015
resolved "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-9.0.5.tgz"
@@ -976,11 +1039,21 @@ hookable@^5.5.3:
9761039
resolved "https://registry.npmjs.org/hookable/-/hookable-5.5.3.tgz"
9771040
integrity sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ==
9781041

1042+
hookified@^1.13.0, hookified@^1.14.0:
1043+
version "1.15.0"
1044+
resolved "https://registry.yarnpkg.com/hookified/-/hookified-1.15.0.tgz#d51db9fe134b8bd19c1aa88f9fcd7878995e4b66"
1045+
integrity sha512-51w+ZZGt7Zw5q7rM3nC4t3aLn/xvKDETsXqMczndvwyVQhAHfUmUuFBRFcos8Iyebtk7OAE9dL26wFNzZVVOkw==
1046+
9791047
html-void-elements@^3.0.0:
9801048
version "3.0.0"
9811049
resolved "https://registry.npmjs.org/html-void-elements/-/html-void-elements-3.0.0.tgz"
9821050
integrity sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==
9831051

1052+
image-size@^2.0.2:
1053+
version "2.0.2"
1054+
resolved "https://registry.yarnpkg.com/image-size/-/image-size-2.0.2.tgz#84a7b43704db5736f364bf0d1b029821299b4bdc"
1055+
integrity sha512-IRqXKlaXwgSMAMtpNzZa1ZAe8m+Sa1770Dhk8VkSsP9LS+iHD62Zd8FQKs8fbPiagBE7BzoFX23cxFnwshpV6w==
1056+
9841057
immutable@^5.0.2:
9851058
version "5.0.3"
9861059
resolved "https://registry.npmjs.org/immutable/-/immutable-5.0.3.tgz"
@@ -1008,6 +1081,13 @@ is-what@^4.1.8:
10081081
resolved "https://registry.npmjs.org/is-what/-/is-what-4.1.16.tgz"
10091082
integrity sha512-ZhMwEosbFJkA0YhFnNDgTM4ZxDRsS6HqTo7qsZM08fehyRYIYa0yHu5R6mgo1n/8MgaPBXiPimPD77baVFYg+A==
10101083

1084+
keyv@^5.5.5:
1085+
version "5.5.5"
1086+
resolved "https://registry.yarnpkg.com/keyv/-/keyv-5.5.5.tgz#a975b32fc03e300a0e443c705b103d8b05220834"
1087+
integrity sha512-FA5LmZVF1VziNc0bIdCSA1IoSVnDCqE8HJIZZv2/W8YmoAM50+tnUgJR/gQZwEeIMleuIOnRnHA/UaZRNeV4iQ==
1088+
dependencies:
1089+
"@keyv/serialize" "^1.1.1"
1090+
10111091
magic-string@^0.30.11:
10121092
version "0.30.17"
10131093
resolved "https://registry.npmjs.org/magic-string/-/magic-string-0.30.17.tgz"
@@ -1020,6 +1100,16 @@ [email protected]:
10201100
resolved "https://registry.npmjs.org/mark.js/-/mark.js-8.11.1.tgz"
10211101
integrity sha512-1I+1qpDt4idfgLQG+BNWmrqku+7/2bi5nLf4YwF8y8zXvmfiTBY3PV3ZibfrjBueCByROpuBjLLFCajqkgYoLQ==
10221102

1103+
markdown-it-image-size@^15.0.1:
1104+
version "15.0.1"
1105+
resolved "https://registry.yarnpkg.com/markdown-it-image-size/-/markdown-it-image-size-15.0.1.tgz#bdf544a3649478ed28cb8654b971ef955bcd6748"
1106+
integrity sha512-qnnnYtXXdUsBtNyywsMpgXDGi0X4Judba0+MJFGa2GrKrE9zwWlng+3GWlv2uRRtM0BO/le3G6x1Xw/iCjiT5g==
1107+
dependencies:
1108+
"@types/markdown-it" "^14.1.2"
1109+
flat-cache "^6.1.17"
1110+
image-size "^2.0.2"
1111+
sync-fetch "^0.5.2"
1112+
10231113
mdast-util-to-hast@^13.0.0:
10241114
version "13.2.0"
10251115
resolved "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.0.tgz"
@@ -1095,6 +1185,13 @@ node-addon-api@^7.0.0:
10951185
resolved "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.1.tgz"
10961186
integrity sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==
10971187

1188+
node-fetch@^2.6.1:
1189+
version "2.7.0"
1190+
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d"
1191+
integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==
1192+
dependencies:
1193+
whatwg-url "^5.0.0"
1194+
10981195
oniguruma-to-es@^3.1.0:
10991196
version "3.1.1"
11001197
resolved "https://registry.npmjs.org/oniguruma-to-es/-/oniguruma-to-es-3.1.1.tgz"
@@ -1138,6 +1235,13 @@ property-information@^7.0.0:
11381235
resolved "https://registry.npmjs.org/property-information/-/property-information-7.0.0.tgz"
11391236
integrity sha512-7D/qOz/+Y4X/rzSB6jKxKUsQnphO046ei8qxG59mtM3RG3DHgTK81HrxrmoDVINJb8NKT5ZsRbwHvQ6B68Iyhg==
11401237

1238+
qified@^0.5.3:
1239+
version "0.5.3"
1240+
resolved "https://registry.yarnpkg.com/qified/-/qified-0.5.3.tgz#2d01866eb99c8de3a18965a4a809d9349e26210a"
1241+
integrity sha512-kXuQdQTB6oN3KhI6V4acnBSZx8D2I4xzZvn9+wFLLFCoBNQY/sFnCW6c43OL7pOQ2HvGV4lnWIXNmgfp7cTWhQ==
1242+
dependencies:
1243+
hookified "^1.13.0"
1244+
11411245
readdirp@^4.0.1:
11421246
version "4.1.2"
11431247
resolved "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz"
@@ -1256,6 +1360,13 @@ superjson@^2.2.1:
12561360
dependencies:
12571361
copy-anything "^3.0.2"
12581362

1363+
sync-fetch@^0.5.2:
1364+
version "0.5.2"
1365+
resolved "https://registry.yarnpkg.com/sync-fetch/-/sync-fetch-0.5.2.tgz#65e7ae1133219938dc92eb19aa21d5eb79ebadec"
1366+
integrity sha512-6gBqqkHrYvkH65WI2bzrDwrIKmt3U10s4Exnz3dYuE5Ah62FIfNv/F63inrNhu2Nyh3GH5f42GKU3RrSJoaUyQ==
1367+
dependencies:
1368+
node-fetch "^2.6.1"
1369+
12591370
tabbable@^6.2.0:
12601371
version "6.2.0"
12611372
resolved "https://registry.npmjs.org/tabbable/-/tabbable-6.2.0.tgz"
@@ -1268,6 +1379,11 @@ to-regex-range@^5.0.1:
12681379
dependencies:
12691380
is-number "^7.0.0"
12701381

1382+
tr46@~0.0.3:
1383+
version "0.0.3"
1384+
resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a"
1385+
integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==
1386+
12711387
trim-lines@^3.0.0:
12721388
version "3.0.1"
12731389
resolved "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz"
@@ -1392,6 +1508,19 @@ vue@^3.5.13:
13921508
"@vue/server-renderer" "3.5.13"
13931509
"@vue/shared" "3.5.13"
13941510

1511+
webidl-conversions@^3.0.0:
1512+
version "3.0.1"
1513+
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871"
1514+
integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==
1515+
1516+
whatwg-url@^5.0.0:
1517+
version "5.0.0"
1518+
resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d"
1519+
integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==
1520+
dependencies:
1521+
tr46 "~0.0.3"
1522+
webidl-conversions "^3.0.0"
1523+
13951524
zwitch@^2.0.4:
13961525
version "2.0.4"
13971526
resolved "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz"

0 commit comments

Comments
 (0)