Skip to content

Commit

Permalink
fix escaping issue. fixes #27
Browse files Browse the repository at this point in the history
  • Loading branch information
iansinnott committed Jan 29, 2024
1 parent d3d811f commit aa30461
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/lib/components/ChatMessageItem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import IconBrain from "./IconBrain.svelte";
import IconVerticalDots from "./IconVerticalDots.svelte";
import CodeBlock from "./CodeBlock.svelte";
import MarkdownHtmlBlock from "./MarkdownHtmlBlock.svelte";
import "./markdown.css";
import { currentlyEditingMessage, inProgressMessageId } from "$lib/stores/stores";
import { onMount } from "svelte";
Expand Down Expand Up @@ -103,7 +104,13 @@
<!-- User input is not considered markdown, but whitespace should be respected -->
<p class="whitespace-pre-wrap">{item.content}</p>
{:else}
<SvelteMarkdown source={item.content || NBSP} renderers={{ code: CodeBlock }} />
<SvelteMarkdown
source={item.content || NBSP}
renderers={{
code: CodeBlock,
html: MarkdownHtmlBlock,
}}
/>
{/if}

<!-- All this markup to accomplish a smooth animation -->
Expand Down
8 changes: 8 additions & 0 deletions src/lib/components/MarkdownHtmlBlock.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<script lang="ts">
import classNames from "classnames";
let _class: string = "";
export { _class as class };
export let text: string;
</script>

<span class={classNames("MarkdownHtmlBlock", _class)}>{text}</span>

0 comments on commit aa30461

Please sign in to comment.