diff --git a/.changeset/fix-list-rendering-p-tags.md b/.changeset/fix-list-rendering-p-tags.md
new file mode 100644
index 000000000..813308d6c
--- /dev/null
+++ b/.changeset/fix-list-rendering-p-tags.md
@@ -0,0 +1,5 @@
+---
+default: patch
+---
+
+Fixed lists rendering `p` html tags on new lines.
diff --git a/src/app/plugins/react-custom-html-parser.test.tsx b/src/app/plugins/react-custom-html-parser.test.tsx
index 5f0cb8fb3..c29158224 100644
--- a/src/app/plugins/react-custom-html-parser.test.tsx
+++ b/src/app/plugins/react-custom-html-parser.test.tsx
@@ -446,4 +446,15 @@ describe('react custom html parser', () => {
expect(screen.queryByText('<test>')).not.toBeInTheDocument();
}
);
+
+ it('unwraps paragraph tags inside list items instead of rendering block breaks', () => {
+ const { container } = renderMessage(
+ '
one
two
'
+ );
+
+ expect(container.querySelector('p')).toBeNull();
+ expect(container.textContent).toContain('one');
+ expect(container.textContent).toContain('two');
+ expect(container.textContent).toContain('bullet');
+ });
});
diff --git a/src/app/plugins/react-custom-html-parser.tsx b/src/app/plugins/react-custom-html-parser.tsx
index 8a15df7ea..adb78f3a6 100644
--- a/src/app/plugins/react-custom-html-parser.tsx
+++ b/src/app/plugins/react-custom-html-parser.tsx
@@ -111,7 +111,7 @@ function KatexRenderer({
useEffect(() => {
let mounted = true;
- Promise.all([import('katex'), import('katex/dist/katex.min.css')]).then(([katex]) => {
+ void Promise.all([import('katex'), import('katex/dist/katex.min.css')]).then(([katex]) => {
if (mounted) {
setHtml(katex.default.renderToString(math, { throwOnError: false, displayMode }));
}
@@ -430,7 +430,7 @@ export function CodeBlock({
const [copied, setCopied] = useTimeoutToggle();
const handleCopy = () => {
- copyToClipboard(extractTextFromChildren(children));
+ void copyToClipboard(extractTextFromChildren(children));
setCopied();
};
@@ -631,6 +631,9 @@ export const getReactCustomHtmlParser = (
}
if (name === 'p') {
+ if (parent instanceof Element && parent.name === 'li') {
+ return <>{renderChildren()}>;
+ }
return (
{renderChildren()}