Skip to content

Commit 1e24c1a

Browse files
AI-805 : Fix table rendering + improve markdown rendering (#20)
* Fix table rendering + improve markdown rendering * Theme scrollbar
1 parent 24a9cec commit 1e24c1a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/solace_ai_connector_web/frontend/app/components/CustomMarkdown.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const CustomMarkdown = ({ children, className = '' }: CustomMarkdownProps
2121
return htmlPatterns.some(pattern => pattern.test(content));
2222
};
2323

24-
let processedContent = children.replace(/\n\s*\n/g, '\n');
24+
let processedContent = children;
2525

2626
// If content seems to be HTML and not already in a code block
2727
if (containsHtml(processedContent) && !processedContent.includes('```')) {
@@ -43,20 +43,23 @@ export const CustomMarkdown = ({ children, className = '' }: CustomMarkdownProps
4343
dark:prose-headings:text-gray-100
4444
prose-a:text-blue-600 dark:prose-a:text-blue-400 hover:prose-a:text-blue-500 dark:hover:prose-a:text-blue-300
4545
[&_ul>li]:marker:text-black dark:[&_ul>li]:marker:text-gray-400
46-
prose-p:my-0.5
46+
prose-p:mt-0
4747
[&_ul]:mt-[-1.875rem] [&_ul]:mb-[-2.75rem]
4848
[&_li>ul]:mt-[0.125rem]
4949
[&_ol]:mt-[-1.875rem] [&_ol]:mb-[-1.875rem]
5050
[&_ul+ol]:mt-[1.125rem]
5151
[&_ul_li+ol]:mt-[1.125rem]
5252
[&_li]:mt-[-28px]
53-
[&_ul_li_ol]:mt-[1rem]
53+
[&_li]:mb-0
54+
[&_ul_li_ol]:mt-[1rem]
5455
[&_ul>li>ol]:mt-[0.5rem]
56+
[&_li>p]:my-[-1rem]
5557
prose-headings:my-1
5658
prose-pre:my-1
5759
prose-blockquote:my-1 dark:prose-blockquote:text-gray-300 dark:prose-blockquote:border-gray-700
5860
prose-hr:my-1
59-
[&>*:first-child]:!mt-0
61+
[&_table]:block scrollbar-themed [&_table]:overflow-x-auto
62+
[&>*:first-child]:!mt-0
6063
[&>*:last-child]:!mb-[-30px]
6164
${className}
6265
`}

0 commit comments

Comments
 (0)