Skip to content

Commit

Permalink
fix line height again
Browse files Browse the repository at this point in the history
  • Loading branch information
samlhuillier committed Oct 21, 2024
1 parent e3d25a6 commit 4b41112
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/components/Common/MarkdownRenderer.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
/* eslint-disable react/jsx-props-no-spreading */
/* eslint-disable jsx-a11y/heading-has-content */
import React from 'react'
import ReactMarkdown from 'react-markdown'
import rehypeRaw from 'rehype-raw'

const customComponents = {
h1: ({ ...props }: React.ComponentPropsWithoutRef<'h1'>) => <h1 className="my-4 text-2xl font-bold" {...props} />,
h2: ({ ...props }: React.ComponentPropsWithoutRef<'h2'>) => <h2 className="my-3 text-xl font-semibold" {...props} />,
h3: ({ ...props }: React.ComponentPropsWithoutRef<'h3'>) => <h3 className="my-2 text-lg font-medium" {...props} />,
interface MarkdownRendererProps {
content: string
}

const MarkdownRenderer: React.FC<{ content: string }> = ({ content }) => {
const MarkdownRenderer: React.FC<MarkdownRendererProps> = ({ content }) => {
return (
<ReactMarkdown
className="overflow-hidden whitespace-normal break-words text-muted-foreground"
components={customComponents}
className="overflow-hidden whitespace-normal break-words leading-relaxed text-muted-foreground"
rehypePlugins={[rehypeRaw]}
>
{content}
</ReactMarkdown>
Expand Down

0 comments on commit 4b41112

Please sign in to comment.