From f2050f615587e82b605b35e539fdb0be01452360 Mon Sep 17 00:00:00 2001 From: Evan Simkowitz Date: Sat, 7 Sep 2024 11:18:38 -0700 Subject: [PATCH] use built-in slug prefix --- frontend/app/element/markdown.tsx | 32 ++++++++++--------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/frontend/app/element/markdown.tsx b/frontend/app/element/markdown.tsx index b592252be..b9d7d8c9c 100644 --- a/frontend/app/element/markdown.tsx +++ b/frontend/app/element/markdown.tsx @@ -39,10 +39,10 @@ const Link = ({ ); }; -const Heading = ({ id, children, hnum }: { id?: string; children: React.ReactNode; hnum: number }) => { +const Heading = ({ props, hnum }: { props: React.HTMLAttributes; hnum: number }) => { return ( -
- {children} +
+ {props.children}
); }; @@ -197,24 +197,12 @@ const Markdown = ({ text, textAtom, showTocAtom, style, className, resolveOpts, a: (props: React.HTMLAttributes) => ( ), - h1: (props: React.HTMLAttributes) => ( - - ), - h2: (props: React.HTMLAttributes) => ( - - ), - h3: (props: React.HTMLAttributes) => ( - - ), - h4: (props: React.HTMLAttributes) => ( - - ), - h5: (props: React.HTMLAttributes) => ( - - ), - h6: (props: React.HTMLAttributes) => ( - - ), + h1: (props: React.HTMLAttributes) => , + h2: (props: React.HTMLAttributes) => , + h3: (props: React.HTMLAttributes) => , + h4: (props: React.HTMLAttributes) => , + h5: (props: React.HTMLAttributes) => , + h6: (props: React.HTMLAttributes) => , img: (props: React.HTMLAttributes) => , source: (props: React.HTMLAttributes) => , code: Code, @@ -251,7 +239,7 @@ const Markdown = ({ text, textAtom, showTocAtom, style, className, resolveOpts, > rehypeSlug({ prefix: idPrefix })]} components={markdownComponents} > {text}