feat: add id to documentation headings

This commit is contained in:
Valerio Ageno
2024-08-16 11:27:29 +02:00
parent 51e01ec142
commit 9f40a55907
4 changed files with 22 additions and 5 deletions
@@ -1,8 +1,17 @@
import { Title } from '@mantine/core'
import type { HTMLAttributes } from 'react'
import { useRef, type HTMLAttributes } from 'react'
export default function MdxH2(
props: HTMLAttributes<HTMLHeadingElement>,
): JSX.Element {
return <Title {...props} mt={20} order={2} />
return (
<Title
{...props}
mt={20}
order={2}
id={String(props.children ?? '')
.toLowerCase()
.replaceAll(' ', '-')}
/>
)
}
@@ -4,5 +4,13 @@ import type { HTMLAttributes } from 'react'
export default function MdxTitle(
props: HTMLAttributes<HTMLHeadingElement>,
): JSX.Element {
return <Title {...props} order={1} />
return (
<Title
{...props}
order={1}
id={String(props.children ?? '')
.toLowerCase()
.replaceAll(' ', '-')}
/>
)
}
@@ -26,7 +26,7 @@ The `tuono` project can mostly be split by the following sub-domains:
- The documentation website (which is written with tuono 🚀)
To check what are the knowledge requirement for each domain check the
[requirements](/documentation/contributing?#requirements) section below.
[requirements](#requirements) section below.
Currently I'm keeping a private dashboard to prioritize new features and bug fixes but if you
want to propose something please open a new issue on github or reach me using
+1 -1
View File
@@ -2,7 +2,7 @@
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"lib": ["ES2021", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,