{#each $outputHistory as item (item.id)}
{#if item.isInput}
{:else}
{@const processedContent = applyHighlights(processAnsi(item.text), item.highlights || [])}
{@const lines = splitIntoLines(processedContent)}
{#if lines.length <= 1}
{#if $uiSettings.showTimestamps}
[{formatTimestamp(item.timestamp)}]
{/if}
{@html processedContent}
{:else}
{#each lines as line, lineIndex}
{#if $uiSettings.showTimestamps && lineIndex === 0}
[{formatTimestamp(item.timestamp)}]
{/if}
{@html line}
{/each}
{/if}
{/if}
{/each}