(fix) docs: パス決定を余分に行わないように

This commit is contained in:
kakkokari-gtyih 2024-01-30 13:03:22 +09:00
parent 099f3c9cb6
commit 79a1cb0ee4
2 changed files with 20 additions and 7 deletions

View File

@ -175,3 +175,8 @@ html.light .markdown-body {
.markdown-body :not(.ignore) ol {
list-style: decimal;
}
.markdown-body u {
text-decoration: underline;
text-underline-offset: .2em;
}

View File

@ -26,19 +26,27 @@ const realHref = ref(props.href);
const realTarget = ref(props.target);
const url = parseURL(realHref.value);
let pathDetermined = false;
if (isLocalPath(realHref.value)) {
// trailing slash
if (isRelative(realHref.value) && route.meta.__isDocsIndexPage !== true) {
realHref.value = joinURL('../', realHref.value.replace(/^\.\//, ''));
const resolved = resolve(realHref.value);
if (resolved.name && resolved.name.toString().includes('___')) {
//
pathDetermined = true;
}
}
//
if (/^\/[a-z]{2}\//.test(realHref.value)) {
realHref.value = sanitizeInternalPath(realHref.value);
} else {
//
realHref.value = sanitizeInternalPath(localePath(resolve(realHref.value).fullPath));
if (!pathDetermined) {
//
if (/^\/[a-z]{2}\//.test(realHref.value)) {
realHref.value = sanitizeInternalPath(realHref.value);
} else {
//
realHref.value = sanitizeInternalPath(localePath(resolve(realHref.value).fullPath));
}
}
} else if (rootDomain.host !== url.host) {
realTarget.value = '_blank';