fix: < rendering issue

This commit is contained in:
Timothy Jaeryang Baek 2025-01-07 23:59:58 -08:00
parent e0054298a4
commit 0129f463b4
3 changed files with 4 additions and 13 deletions

View File

@ -69,7 +69,7 @@
</del>
{:else if token.type === 'inlineKatex'}
{#if token.text}
<KatexRenderer content={revertSanitizedResponseContent(token.text)} displayMode={false} />
<KatexRenderer content={token.text} displayMode={false} />
{/if}
{:else if token.type === 'iframe'}
<iframe

View File

@ -82,7 +82,7 @@
id={`${id}-${tokenIdx}`}
{token}
lang={token?.lang ?? ''}
code={revertSanitizedResponseContent(token?.text ?? '')}
code={token?.text ?? ''}
{save}
on:code={(e) => {
dispatch('code', e.detail);
@ -245,17 +245,11 @@
{/if}
{:else if token.type === 'inlineKatex'}
{#if token.text}
<KatexRenderer
content={revertSanitizedResponseContent(token.text)}
displayMode={token?.displayMode ?? false}
/>
<KatexRenderer content={token.text} displayMode={token?.displayMode ?? false} />
{/if}
{:else if token.type === 'blockKatex'}
{#if token.text}
<KatexRenderer
content={revertSanitizedResponseContent(token.text)}
displayMode={token?.displayMode ?? false}
/>
<KatexRenderer content={token.text} displayMode={token?.displayMode ?? false} />
{/if}
{:else if token.type === 'space'}
<div class="my-2" />

View File

@ -74,9 +74,6 @@ export const processResponseContent = (content: string) => {
return content.trim();
};
export const revertSanitizedResponseContent = (content: string) => {
return content.replaceAll('&lt;', '<').replaceAll('&gt;', '>');
};
export function unescapeHtml(html: string) {
const doc = new DOMParser().parseFromString(html, 'text/html');