fix extendedHx href

This commit is contained in:
sup39 2022-11-05 02:42:47 +09:00
parent 9bb235133b
commit d7efcc1073

View file

@ -8,7 +8,7 @@ import '../styles/index.sass';
const hx = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] as const; const hx = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] as const;
const extendedHx = Object.fromEntries(hx.map(H => [H, const extendedHx = Object.fromEntries(hx.map(H => [H,
({children, id, ...props}: React.ComponentProps<(typeof hx)[number]>) => <H id={id} {...props}> ({children, id, ...props}: React.ComponentProps<(typeof hx)[number]>) => <H id={id} {...props}>
{id && <a className="anchor" />} {id && <a className="anchor" href={'#'+encodeURIComponent(id)} />}
{children} {children}
</H>, </H>,
])); ]));