mirror of
https://github.com/Crosstalk-Solutions/project-nomad.git
synced 2026-04-05 08:16:16 +02:00
fix(AI Assistant): inline code rendering
This commit is contained in:
parent
60d7eaf1dc
commit
3072324907
|
|
@ -25,14 +25,27 @@ export default function ChatMessageBubble({ message }: ChatMessageBubbleProps) {
|
||||||
<ReactMarkdown
|
<ReactMarkdown
|
||||||
remarkPlugins={[remarkGfm]}
|
remarkPlugins={[remarkGfm]}
|
||||||
components={{
|
components={{
|
||||||
code: ({ node, className, children, ...props }) => (
|
code: ({ node, className, children, ...props }: any) => {
|
||||||
<code
|
const isInline = !className?.includes('language-')
|
||||||
className="block bg-gray-800 text-gray-100 p-3 rounded-lg overflow-x-auto font-mono text-sm"
|
if (isInline) {
|
||||||
{...props}
|
return (
|
||||||
>
|
<code
|
||||||
{children}
|
className="bg-gray-800 text-gray-100 px-2 py-0.5 rounded font-mono text-sm"
|
||||||
</code>
|
{...props}
|
||||||
),
|
>
|
||||||
|
{children}
|
||||||
|
</code>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<code
|
||||||
|
className="block bg-gray-800 text-gray-100 p-3 rounded-lg overflow-x-auto font-mono text-sm my-2"
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</code>
|
||||||
|
)
|
||||||
|
},
|
||||||
p: ({ children }) => <p className="mb-2 last:mb-0">{children}</p>,
|
p: ({ children }) => <p className="mb-2 last:mb-0">{children}</p>,
|
||||||
ul: ({ children }) => <ul className="list-disc pl-5 mb-2">{children}</ul>,
|
ul: ({ children }) => <ul className="list-disc pl-5 mb-2">{children}</ul>,
|
||||||
ol: ({ children }) => <ol className="list-decimal pl-5 mb-2">{children}</ol>,
|
ol: ({ children }) => <ol className="list-decimal pl-5 mb-2">{children}</ol>,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user