mirror of
https://github.com/hanzo-docs/docs.git
synced 2026-10-26 10:55:57 +00:00
19 lines
425 B
TypeScript
19 lines
425 B
TypeScript
import type { ReactNode } from 'react';
|
|
import { Heading } from 'fumadocs-ui/components/heading';
|
|
import type { RenderContext } from '@/types';
|
|
|
|
export function heading(
|
|
depth: number,
|
|
text: string,
|
|
ctx: RenderContext,
|
|
children: ReactNode = text,
|
|
): ReactNode {
|
|
const id = ctx.slugger.slug(text);
|
|
|
|
return (
|
|
<Heading id={id} key={id} as={`h${depth.toString()}` as `h1`}>
|
|
{children}
|
|
</Heading>
|
|
);
|
|
}
|