Skip to content

Commit

Permalink
feat(chat): add/apply marked to support highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
PleahMaCaka committed Oct 26, 2023
1 parent ab4ef6d commit bd0a16b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"@tiptap/starter-kit": "^2.1.12",
"@types/cookie": "^0.5.3",
"autoprefixer": "^10.4.16",
"marked": "^9.1.2",
"postcss": "^8.4.31",
"postcss-import": "^15.1.0",
"postcss-nesting": "^12.0.1",
Expand Down
9 changes: 9 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions src/lib/components/chat/messages/BaseMessage.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<script lang="ts">
import { marked } from "marked"
export let profilePic: string
export let bgColor: string
export let message: string
Expand All @@ -14,7 +16,9 @@
src={profilePic}
alt={"Profile"}
/>
<p class="chat-msg">{message}</p>
<div class="chat-msg">
{@html marked(message)}
</div>
</div>

<style>
Expand Down Expand Up @@ -42,9 +46,10 @@
object-fit: cover;
}
.chat-msg {
.chat-msg, .chat-msg :global(p) {
font-weight: 400;
line-height: 1.5rem;
align-self: center;
}
</style>

0 comments on commit bd0a16b

Please sign in to comment.