{#each items as item}
{#if item.type === 'text'}
{#if 'tokens' in item && item.tokens}
{#if 'tokens' in item && item.tokens}
{:else if item.type === 'codespan'}
{
const text = 'text' in item ? item.text : item.raw;
navigator.clipboard.writeText(text);
}}>{'text' in item ? item.text : item.raw}
{:else if item.type === 'link'}
{@const href = 'href' in item ? item.href : ''}
{#if href?.startsWith('file:///')}
{@const rawPath = decodeURIComponent(href.replace('file://', ''))}
{@const isDirectory = rawPath.endsWith('/')}
{@const filePath = isDirectory ? rawPath.slice(0, -1) : rawPath}
{@const fileName = filePath.split('/').pop() || filePath}
{:else}
{#if 'tokens' in item && item.tokens}
{:else if item.type === 'br'}
{:else if item.type === 'escape'}
{'text' in item ? item.text : item.raw}
{:else if item.type === 'html'}
{@const wl = parseWikilink(item.raw)}
{#if wl}
{wl.label}
{/if}
{/if}
{/each}