Skip to content

Commit

Permalink
feat: allow hidding titles from toc (fixes #20)
Browse files Browse the repository at this point in the history
Signed-off-by: ZTL-UwU <[email protected]>
  • Loading branch information
ZTL-UwU committed Aug 7, 2024
1 parent 0c31a8e commit 6ecf66f
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
6 changes: 5 additions & 1 deletion components/layout/Toc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
<p class="mb-2 text-base font-semibold">
{{ title }}
</p>
<LayoutTocTree :links="toc.links" :level="0" :class="[links.length && 'pb-5 border-b']" />
<LayoutTocTree
:links="toc.links.filter((x: any) => x.id !== 'hide-toc')"
:level="0"
:class="[links.length && 'pb-5 border-b']"
/>
<div v-if="links" class="pt-5 text-muted-foreground">
<NuxtLink
v-for="(link, i) in links"
Expand Down
11 changes: 11 additions & 0 deletions content/1.getting-started/3.writing/1.markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,14 @@ target: _blank
---
Read the detailed MDC usage guide in the **Nuxt Content** Docs.
::

## Tips

### Hide title from toc
:badge[0.4.7]{variant="outline"}

Set title `id` to `hide-toc` will hide the header from toc.

```mdc
:h2[Footnotes]{id="hide-toc"}
```
4 changes: 3 additions & 1 deletion content/1.getting-started/3.writing/2.components.md
Original file line number Diff line number Diff line change
Expand Up @@ -494,10 +494,12 @@ npm i -D @iconify-json/collection-name
```
::

#### Multi-level headings
:badge[0.4.6]{variant="outline"}
::code-group
::div{label="Preview"}
::steps{level=5}
##### Multi-level headings
##### Specify the level of headings to use

```mdc
::steps{level=5}
Expand Down
2 changes: 1 addition & 1 deletion content/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ navigation: false
::hero
---
announcement:
title: 'Release v0.4.6'
title: 'Release v0.4.7'
icon: 'noto:party-popper'
to: /getting-started/changelog
actions:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "shadcn-docs-nuxt",
"type": "module",
"version": "0.4.6",
"version": "0.4.7",
"author": "Tony Zhang <[email protected]>",
"license": "MIT",
"homepage": "https://shadcn-docs.nuxt.dev/",
Expand Down

0 comments on commit 6ecf66f

Please sign in to comment.