Skip to content

Commit 3b2b1bd

Browse files
authored
fix: extra spacing in rendered markdown (#115)
1 parent be41931 commit 3b2b1bd

File tree

3 files changed

+119
-125
lines changed

3 files changed

+119
-125
lines changed

src/components/BotMessage.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ export function BotMessage({ message, isLoading }: BotMessageProps) {
4848
)}
4949
>
5050
<div data-raw-markdown={message.content}>
51-
<div className="prose prose-sm dark:prose-invert max-w-none break-words break-all whitespace-pre-wrap">
52-
<MarkdownContent content={message.content} />
53-
</div>
51+
<MarkdownContent content={message.content} />
5452
</div>
5553
</div>
5654
<div className="flex gap-1 items-center text-xs text-gray-500 dark:text-gray-400 space-x-1">

src/components/MarkdownContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export function MarkdownContent({ content }: MarkdownContentProps) {
1717
}
1818

1919
return (
20-
<div className="prose prose-sm dark:prose-invert max-w-none break-words [&>*+*]:mt-4 [&>h1+*]:mt-3 [&>h2+*]:mt-3 [&>h3+*]:mt-3 [&>p+ul]:mt-3 [&>p+ol]:mt-3">
20+
<div className="prose prose-sm dark:prose-invert max-w-none break-words">
2121
<ReactMarkdown
2222
remarkPlugins={[remarkGfm]}
2323
components={{

src/components/__snapshots__/BotMessage.test.tsx.snap

Lines changed: 117 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -69,131 +69,127 @@ exports[`BotMessage > renders a markdown table correctly 1`] = `
6969
Here is a summary table of total sales from every year. If you need additional detail, just let me know!"
7070
>
7171
<div
72-
class="prose prose-sm dark:prose-invert max-w-none break-words break-all whitespace-pre-wrap"
72+
class="prose prose-sm dark:prose-invert max-w-none break-words"
7373
>
7474
<div
75-
class="prose prose-sm dark:prose-invert max-w-none break-words [&>*+*]:mt-4 [&>h1+*]:mt-3 [&>h2+*]:mt-3 [&>h3+*]:mt-3 [&>p+ul]:mt-3 [&>p+ol]:mt-3"
75+
class="overflow-x-auto my-4"
7676
>
77-
<div
78-
class="overflow-x-auto my-4"
79-
>
80-
<table>
81-
<thead>
82-
<tr>
83-
<th>
84-
Year
85-
</th>
86-
<th>
87-
Total Sales
88-
</th>
89-
</tr>
90-
</thead>
91-
<tbody>
92-
<tr>
93-
<td>
94-
2012
95-
</td>
96-
<td>
97-
$18,823,201.72
98-
</td>
99-
</tr>
100-
<tr>
101-
<td>
102-
2013
103-
</td>
104-
<td>
105-
$38,633,120.01
106-
</td>
107-
</tr>
108-
<tr>
109-
<td>
110-
2014
111-
</td>
112-
<td>
113-
$38,870,148.13
114-
</td>
115-
</tr>
116-
<tr>
117-
<td>
118-
2015
119-
</td>
120-
<td>
121-
$41,423,456.72
122-
</td>
123-
</tr>
124-
<tr>
125-
<td>
126-
2016
127-
</td>
128-
<td>
129-
$40,568,672.36
130-
</td>
131-
</tr>
132-
<tr>
133-
<td>
134-
2017
135-
</td>
136-
<td>
137-
$40,209,904.23
138-
</td>
139-
</tr>
140-
<tr>
141-
<td>
142-
2018
143-
</td>
144-
<td>
145-
$38,326,623.43
146-
</td>
147-
</tr>
148-
<tr>
149-
<td>
150-
2019
151-
</td>
152-
<td>
153-
$38,516,963.86
154-
</td>
155-
</tr>
156-
<tr>
157-
<td>
158-
2020
159-
</td>
160-
<td>
161-
$38,862,436.79
162-
</td>
163-
</tr>
164-
<tr>
165-
<td>
166-
2021
167-
</td>
168-
<td>
169-
$41,355,549.74
170-
</td>
171-
</tr>
172-
<tr>
173-
<td>
174-
2022
175-
</td>
176-
<td>
177-
$39,742,066.18
178-
</td>
179-
</tr>
180-
<tr>
181-
<td>
182-
2023
183-
</td>
184-
<td>
185-
$33,054,490.00
186-
</td>
187-
</tr>
188-
</tbody>
189-
</table>
190-
</div>
191-
192-
193-
<p>
194-
Here is a summary table of total sales from every year. If you need additional detail, just let me know!
195-
</p>
77+
<table>
78+
<thead>
79+
<tr>
80+
<th>
81+
Year
82+
</th>
83+
<th>
84+
Total Sales
85+
</th>
86+
</tr>
87+
</thead>
88+
<tbody>
89+
<tr>
90+
<td>
91+
2012
92+
</td>
93+
<td>
94+
$18,823,201.72
95+
</td>
96+
</tr>
97+
<tr>
98+
<td>
99+
2013
100+
</td>
101+
<td>
102+
$38,633,120.01
103+
</td>
104+
</tr>
105+
<tr>
106+
<td>
107+
2014
108+
</td>
109+
<td>
110+
$38,870,148.13
111+
</td>
112+
</tr>
113+
<tr>
114+
<td>
115+
2015
116+
</td>
117+
<td>
118+
$41,423,456.72
119+
</td>
120+
</tr>
121+
<tr>
122+
<td>
123+
2016
124+
</td>
125+
<td>
126+
$40,568,672.36
127+
</td>
128+
</tr>
129+
<tr>
130+
<td>
131+
2017
132+
</td>
133+
<td>
134+
$40,209,904.23
135+
</td>
136+
</tr>
137+
<tr>
138+
<td>
139+
2018
140+
</td>
141+
<td>
142+
$38,326,623.43
143+
</td>
144+
</tr>
145+
<tr>
146+
<td>
147+
2019
148+
</td>
149+
<td>
150+
$38,516,963.86
151+
</td>
152+
</tr>
153+
<tr>
154+
<td>
155+
2020
156+
</td>
157+
<td>
158+
$38,862,436.79
159+
</td>
160+
</tr>
161+
<tr>
162+
<td>
163+
2021
164+
</td>
165+
<td>
166+
$41,355,549.74
167+
</td>
168+
</tr>
169+
<tr>
170+
<td>
171+
2022
172+
</td>
173+
<td>
174+
$39,742,066.18
175+
</td>
176+
</tr>
177+
<tr>
178+
<td>
179+
2023
180+
</td>
181+
<td>
182+
$33,054,490.00
183+
</td>
184+
</tr>
185+
</tbody>
186+
</table>
196187
</div>
188+
189+
190+
<p>
191+
Here is a summary table of total sales from every year. If you need additional detail, just let me know!
192+
</p>
197193
</div>
198194
</div>
199195
</div>

0 commit comments

Comments
 (0)