From 75115f4f8223d67dab2dc82fadaf2941aabf6330 Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Sat, 27 Apr 2024 12:43:12 +0530 Subject: [PATCH 01/17] fix(theme): don't use Chinese quotes on non-Chinese documents (#3834) --- src/client/theme-default/styles/fonts.css | 38 ++++++++++++++++++++--- src/client/theme-default/styles/vars.css | 14 ++++++--- 2 files changed, 43 insertions(+), 9 deletions(-) diff --git a/src/client/theme-default/styles/fonts.css b/src/client/theme-default/styles/fonts.css index 94e016b4..0cda21d7 100644 --- a/src/client/theme-default/styles/fonts.css +++ b/src/client/theme-default/styles/fonts.css @@ -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 .woff2 --unicodes="" --output-file="inter- From f0debd20f48ab7eb58cfd142147531509d6c0209 Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Sun, 28 Apr 2024 15:55:40 +0530 Subject: [PATCH 07/17] fix(build): show file info on error --- src/node/cli.ts | 8 +++++--- src/node/plugins/dynamicRoutesPlugin.ts | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/node/cli.ts b/src/node/cli.ts index acccda7f..7c452138 100644 --- a/src/node/cli.ts +++ b/src/node/cli.ts @@ -48,7 +48,7 @@ if (!command || command === 'dev') { } createDevServer().catch((err) => { createLogger().error( - `${c.red(`failed to start server. error:`)}\n${err.stack}` + `${c.red(`failed to start server. error:`)}\n${err.message}\n${err.stack}` ) process.exit(1) }) @@ -59,13 +59,15 @@ if (!command || command === 'dev') { logVersion() if (command === 'build') { build(root, argv).catch((err) => { - createLogger().error(`${c.red(`build error:`)}\n${err.stack}`) + createLogger().error( + `${c.red(`build error:`)}\n${err.message}\n${err.stack}` + ) process.exit(1) }) } else if (command === 'serve' || command === 'preview') { serve(argv).catch((err) => { createLogger().error( - `${c.red(`failed to start server. error:`)}\n${err.stack}` + `${c.red(`failed to start server. error:`)}\n${err.message}\n${err.stack}` ) process.exit(1) }) diff --git a/src/node/plugins/dynamicRoutesPlugin.ts b/src/node/plugins/dynamicRoutesPlugin.ts index cf9576ae..49dd1963 100644 --- a/src/node/plugins/dynamicRoutesPlugin.ts +++ b/src/node/plugins/dynamicRoutesPlugin.ts @@ -200,8 +200,10 @@ export async function resolveDynamicRoutes( 'silent' )) as RouteModule routeModuleCache.set(pathsFile, mod) - } catch (e: any) { - logger.warn(`${c.yellow(`Failed to load ${pathsFile}:`)}\n${e.stack}`) + } catch (err: any) { + logger.warn( + `${c.yellow(`Failed to load ${pathsFile}:`)}\n${err.message}\n${err.stack}` + ) continue } } From d08eeed89726572f7ea341df59864cc72716751c Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Sun, 28 Apr 2024 17:46:24 +0530 Subject: [PATCH 08/17] fix(theme): external link icon not visible for target _blank links closes #3327 --- src/client/theme-default/components/VPLink.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/client/theme-default/components/VPLink.vue b/src/client/theme-default/components/VPLink.vue index a10ee04a..f57e3328 100644 --- a/src/client/theme-default/components/VPLink.vue +++ b/src/client/theme-default/components/VPLink.vue @@ -12,7 +12,11 @@ const props = defineProps<{ }>() const tag = computed(() => props.tag ?? (props.href ? 'a' : 'span')) -const isExternal = computed(() => props.href && EXTERNAL_URL_RE.test(props.href)) +const isExternal = computed( + () => + (props.href && EXTERNAL_URL_RE.test(props.href)) || + props.target === '_blank' +)