Skip to content

Commit

Permalink
style: add list style for chat message markdown (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
thucpn authored Mar 26, 2024
1 parent e8db041 commit 76aa336
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion templates/components/ui/html/chat/chat-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function ChatItem(message: Message) {
return (
<div className="flex items-start gap-4 pt-5">
<ChatAvatar {...message} />
<p className="break-words">{message.content}</p>
<p className="break-words whitespace-pre-wrap">{message.content}</p>
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const MemoizedReactMarkdown: FC<Options> = memo(
export default function Markdown({ content }: { content: string }) {
return (
<MemoizedReactMarkdown
className="prose dark:prose-invert prose-p:leading-relaxed prose-pre:p-0 break-words"
className="prose dark:prose-invert prose-p:leading-relaxed prose-pre:p-0 break-words custom-markdown"
remarkPlugins={[remarkGfm, remarkMath]}
components={{
p({ children }) {
Expand Down
1 change: 1 addition & 0 deletions templates/types/streaming/nextjs/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { Metadata } from "next";
import { Inter } from "next/font/google";
import "./globals.css";
import "./markdown.css";

const inter = Inter({ subsets: ["latin"] });

Expand Down
23 changes: 23 additions & 0 deletions templates/types/streaming/nextjs/app/markdown.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* Custom CSS for chat message markdown */
.custom-markdown ul {
list-style-type: disc;
margin-left: 20px;
}

.custom-markdown ol {
list-style-type: decimal;
margin-left: 20px;
}

.custom-markdown li {
margin-bottom: 5px;
}

.custom-markdown ol ol {
list-style: lower-alpha;
}

.custom-markdown ul ul,
.custom-markdown ol ol {
margin-left: 20px;
}

0 comments on commit 76aa336

Please sign in to comment.