(enhance) maxTocDepth

fix #10
This commit is contained in:
kakkokari-gtyih 2023-11-11 21:59:03 +09:00
parent 720b088c6d
commit 2f83cb02cc
4 changed files with 14 additions and 12 deletions

View File

@ -14,7 +14,7 @@
</a>
<TocLinks
class="mt-2"
v-if="link.children"
v-if="link.children && (link.depth ?? 0 + 1) < maxDepth"
:links="link.children"
@move="childMove($event)"
/>
@ -23,14 +23,13 @@
</template>
<script setup lang="ts">
import type { PropType } from 'vue'
import type { TocLink } from '@nuxt/content/dist/runtime/types'
import type { TocLink } from '@nuxt/content/dist/runtime/types';
const props = defineProps({
links: {
type: Array as PropType<TocLink[]>,
default: () => []
}
const props = withDefaults(defineProps<{
links?: TocLink[];
maxDepth?: number;
}>(), {
maxDepth: Infinity,
});
const emit = defineEmits(['move', 'child-click']);

View File

@ -36,10 +36,10 @@ date: 2023-11-11
```
### `maxTocDepth`
Docsのみもくじの見出しを遡る限度を指定できます。
Docsのみもくじの見出しを遡る限度を指定できます。`<h2>`タグまでにしたい場合は`2`を指定します。
```yml
maxTocDepth: 1
maxTocDepth: 2
```
### `ignoreDirBasedNav`

View File

@ -1,3 +1,7 @@
---
maxTocDepth: 2
---
# リリースノート
Misskeyのリリースートを掲載しています。

View File

@ -29,14 +29,13 @@
<div class="hidden lg:block text-sm">
<div class="sticky top-16 h-[calc(100vh-4rem)] overflow-y-auto py-6 pl-6">
<h3 class="font-bold mb-6">{{ $t('_docs._toc.title') }}</h3>
<DocsTocLinks v-if="data?.body" :links="data?.body.toc.links" class="break-words" />
<DocsTocLinks v-if="data?.body" :links="data?.body.toc?.links" :max-depth="data?.maxTocDepth ?? undefined" class="break-words" />
</div>
</div>
</div>
</template>
<script setup lang="ts">
import type { LocaleObject } from '@nuxtjs/i18n/dist/runtime/composables';
import AsideNavIco from 'bi/text-indent-left.svg';
const isAsideNavOpen = useState<boolean>('miHub_docs_asideNav_openState', () => false);