This commit is contained in:
Timothy Jaeryang Baek 2026-10-22 07:14:26 +09:00
parent 52f51ea4f3
commit 4d70ed07ff

View file

@ -11,7 +11,7 @@
import { getFileById, getFileContentById } from '$lib/apis/files';
import CodeBlock from '$lib/components/chat/Messages/CodeBlock.svelte';
import Markdown from '$lib/components/chat/Messages/Markdown.svelte';
import MarkdownDocument from '$lib/components/chat/FileNav/MarkdownDocument.svelte';
const i18n: any = getContext('i18n');
@ -72,7 +72,7 @@
$: isMarkdown =
item?.meta?.content_type === 'text/markdown' ||
(item?.name && item?.name.toLowerCase().endsWith('.md'));
(item?.name && /\.(md|markdown|mdx)$/i.test(item.name));
$: isCode =
item?.name &&
@ -442,10 +442,8 @@
rawContent.length > CONTENT_PREVIEW_LIMIT &&
!expandedContent}
{#if $settings?.renderMarkdownInPreviews ?? true}
<div
class="max-h-96 overflow-scroll scrollbar-hidden text-sm prose dark:prose-invert max-w-full"
>
<Markdown
<div class="max-h-96 overflow-scroll scrollbar-hidden">
<MarkdownDocument
content={isTruncated ? rawContent.slice(0, CONTENT_PREVIEW_LIMIT) : rawContent}
id="file-preview"
/>
@ -474,10 +472,8 @@
rawContent.length > CONTENT_PREVIEW_LIMIT &&
!expandedContent}
{#if $settings?.renderMarkdownInPreviews ?? true}
<div
class="max-h-96 overflow-scroll scrollbar-hidden text-sm prose dark:prose-invert max-w-full"
>
<Markdown
<div class="max-h-96 overflow-scroll scrollbar-hidden">
<MarkdownDocument
content={isTruncated ? rawContent.slice(0, CONTENT_PREVIEW_LIMIT) : rawContent}
id="file-preview-content"
/>
@ -557,10 +553,8 @@
/>
</div>
{:else if isMarkdown}
<div
class="max-h-[60vh] overflow-scroll scrollbar-hidden text-sm prose dark:prose-invert max-w-full"
>
<Markdown content={item.file.data.content} id="markdown-viewer" />
<div class="max-h-[60vh] overflow-scroll scrollbar-hidden">
<MarkdownDocument content={item.file.data.content} id="markdown-viewer" />
</div>
{:else if isDocx}
{#if docxError}