a200832cfb
docs/LETTER.md holds slots as comments only, so the player sees no change
until the author writes. The app bundles the letter at build time, a small
Markdown subset renders without {@html}, only https: and tel: become links,
and lint:copy now reads the letter. Review found turbo replaying a stale
build after the letter changed; docs/LETTER.md is now in its cache key.
62 lines
1.4 KiB
Svelte
62 lines
1.4 KiB
Svelte
<script lang="ts">
|
|
import type { Inline, LetterBlock } from './parse.js';
|
|
|
|
let { blocks }: { blocks: readonly LetterBlock[] } = $props();
|
|
</script>
|
|
|
|
{#snippet inlines(parts: readonly Inline[])}
|
|
{#each parts as part, i (i)}
|
|
{#if part.kind === 'link' && part.href.startsWith('tel:')}
|
|
<a href={part.href}>{part.text}</a>
|
|
{:else if part.kind === 'link'}
|
|
<a href={part.href} target="_blank" rel="noopener noreferrer">{part.text}</a>
|
|
{:else if part.kind === 'em'}
|
|
<em>{part.text}</em>
|
|
{:else}
|
|
{part.text}
|
|
{/if}
|
|
{/each}
|
|
{/snippet}
|
|
|
|
<article class="letter">
|
|
{#each blocks as block, i (i)}
|
|
{#if block.kind === 'heading' && block.level === 2}
|
|
<h2>{@render inlines(block.inlines)}</h2>
|
|
{:else if block.kind === 'heading'}
|
|
<h3>{@render inlines(block.inlines)}</h3>
|
|
{:else if block.kind === 'paragraph'}
|
|
<p>{@render inlines(block.inlines)}</p>
|
|
{:else}
|
|
<ul>
|
|
{#each block.items as item, j (j)}
|
|
<li>{@render inlines(item)}</li>
|
|
{/each}
|
|
</ul>
|
|
{/if}
|
|
{/each}
|
|
</article>
|
|
|
|
<style>
|
|
.letter {
|
|
max-width: 38rem;
|
|
line-height: 1.65;
|
|
}
|
|
|
|
h2,
|
|
h3 {
|
|
font-family: var(--font-display);
|
|
font-weight: 400;
|
|
color: var(--rose);
|
|
margin: var(--space-4) 0 var(--space-2);
|
|
}
|
|
|
|
p,
|
|
ul {
|
|
margin: 0 0 var(--space-3);
|
|
}
|
|
|
|
a {
|
|
color: var(--rose);
|
|
}
|
|
</style>
|