(fix) docs: broken types, broken components

This commit is contained in:
kakkokari-gtyih 2023-07-15 17:32:48 +09:00
parent 9ed746f7f0
commit 0f504aa51a
8 changed files with 89 additions and 10 deletions

View File

@ -133,11 +133,19 @@ html.light .markdown-body {
.markdown-body h4 > a[href^='#'],
.markdown-body h5 > a[href^='#'],
.markdown-body h6 > a[href^='#'] {
all: unset;
color: var(--color-fg-default);
cursor: pointer;
}
.markdown-body h1 > a[href^='#']:hover,
.markdown-body h2 > a[href^='#']:hover,
.markdown-body h3 > a[href^='#']:hover,
.markdown-body h4 > a[href^='#']:hover,
.markdown-body h5 > a[href^='#']:hover,
.markdown-body h6 > a[href^='#']:hover {
text-decoration: none;
}
.markdown-body ul {
list-style: disc;
}

View File

@ -11,4 +11,31 @@ export function resolveObjPath(o: object, s: string): any {
}
}
return o;
}
export function isLocalPath(link: string, base?: string): boolean {
let baseUrl;
if (base) {
baseUrl = base;
} else {
const runtimeConfig = useRuntimeConfig();
baseUrl = runtimeConfig.public.baseUrl;
}
const rootDomain = new URL(baseUrl);
try {
const url = new URL(link);
if (!url.hostname || rootDomain.hostname === url.hostname) {
return true;
} else if (rootDomain.hostname !== url.hostname) {
return false;
}
return false;
} catch(error) {
if(link !== '') {
return true;
} else {
throw error;
}
}
}

View File

@ -1,5 +1,6 @@
<template>
<div class="rounded-lg border border-slate-200 dark:border-slate-800 p-6 mfm-root mb-4">
<div class="rounded-lg border border-slate-200 dark:border-slate-800 p-6 mfm-root mb-4 relative overflow-hidden">
<div class="absolute top-0 left-0 px-1 py-0.5 text-xs bg-slate-200 dark:bg-slate-800 rounded-br-lg z-20">{{ $t('_content.preview') }}</div>
<MkMfm :text="text" />
</div>
</template>

View File

@ -7,10 +7,10 @@
:key="item._path"
:to="localePath(item._path)"
>
<h3 class="font-bold text-lg mb-2">
<h3 class="font-bold !text-lg !mt-0 !mb-2">
{{ item.navTitle || item.title }}<ArrowRightIco class="ml-1.5" />
</h3>
<p class="text-sm opacity-80">
<p class="text-sm text-slate-500 dark:text-slate-400 !mb-0 truncate-box">
{{ item.description ?? "" }}
</p>
</GNuxtLink>
@ -61,4 +61,13 @@ const findDeepObject = (obj: Record<string, any>, condition: (v: any) => boolean
const query = queryContent(realBasePath.value);
</script>
<style scoped></style>
<style scoped>
.truncate-box {
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
word-break: break-all;
display: -webkit-box;
}
</style>

View File

@ -14,7 +14,7 @@ const props = defineProps({
type: String,
default: undefined,
required: false
}
},
})
let realHref = props.href;

View File

@ -0,0 +1,34 @@
<template>
<img :src="refinedSrc" :alt="alt" :width="width" :height="height" loading="lazy" />
</template>
<script setup lang="ts">
import { withBase } from 'ufo'
import { useRuntimeConfig, computed } from '#imports'
const props = defineProps({
src: {
type: String,
default: ''
},
alt: {
type: String,
default: ''
},
width: {
type: [String, Number],
default: undefined
},
height: {
type: [String, Number],
default: undefined
}
})
const refinedSrc = computed(() => {
if (props.src?.startsWith('/') && !props.src.startsWith('//')) {
return withBase(props.src, useRuntimeConfig().app.baseURL)
}
return props.src
})
</script>

View File

@ -9,8 +9,8 @@ const QUOTE_STYLE = `
display: block;
margin: 8px;
padding: 6px 0 6px 12px;
color: var(--fg);
border-left: solid 3px var(--fg);
color: currentColor;
border-left: solid 3px currentColor;
opacity: 0.7;
`.split('\n').join(' ');
@ -231,7 +231,7 @@ export default function(props: {
}
case 'link': {
return [h(NuxtLink, {
return [h(ProseAVue, {
key: Math.random(),
to: token.props.url,
rel: 'nofollow noopener',

View File

@ -44,10 +44,10 @@ export default defineNuxtConfig({
},
},
content: {
//sources: Object.fromEntries(locales.map((e) => [e.code, { driver: 'fs', prefix: `/${e.code}`, base: resolve(__dirname, `content/${e.iso}`), }])),
navigation: {
fields: [
'date',
'description',
]
}
},