diff --git a/src/lib/components/CodeBlock.svelte b/src/lib/components/CodeBlock.svelte
index 585050cf5be..db8513825d6 100644
--- a/src/lib/components/CodeBlock.svelte
+++ b/src/lib/components/CodeBlock.svelte
@@ -4,10 +4,10 @@
interface Props {
code?: string;
- lang?: string;
+ rawCode?: string;
}
- let { code = "" }: Props = $props();
+ let { code = "", rawCode = "" }: Props = $props();
- {#each messages.toReversed() as message, idx (message.id)}
+
+ {#each messages as message, idx (message.id)}
+
{/if}
{/each}
diff --git a/src/lib/utils/marked.ts b/src/lib/utils/marked.ts
index ee1c47290d2..84fa7bc5081 100644
--- a/src/lib/utils/marked.ts
+++ b/src/lib/utils/marked.ts
@@ -172,6 +172,7 @@ type CodeToken = {
type: "code";
lang: string;
code: string;
+ rawCode: string;
};
type TextToken = {
@@ -190,6 +191,7 @@ export async function processTokens(content: string, sources: WebSearchSource[])
type: "code" as const,
lang: token.lang,
code: hljs.highlightAuto(token.text, hljs.getLanguage(token.lang)?.aliases).value,
+ rawCode: token.text,
};
} else {
return {
@@ -212,6 +214,7 @@ export function processTokensSync(content: string, sources: WebSearchSource[]):
type: "code" as const,
lang: token.lang,
code: hljs.highlightAuto(token.text, hljs.getLanguage(token.lang)?.aliases).value,
+ rawCode: token.text,
};
}
return { type: "text" as const, html: marked.parse(token.raw) };