From 48cdc3d19a319981a8a4128be98db3c283f81790 Mon Sep 17 00:00:00 2001 From: Adam Malczewski Date: Sat, 24 Oct 2026 18:34:12 +0900 Subject: feat: render live text-file embeds in expandable Markdown blocks Show rendered first/last six-line previews with expand, refresh and retry; bound and deduplicate context-guarded fetches. Verify 2586 tests twice with Node Web Storage compatibility flag, 2 live integration tests, typecheck, Biome and production build. --- src/features/markdown/ui/TextFileEmbed.svelte | 113 ++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 src/features/markdown/ui/TextFileEmbed.svelte (limited to 'src/features/markdown/ui/TextFileEmbed.svelte') diff --git a/src/features/markdown/ui/TextFileEmbed.svelte b/src/features/markdown/ui/TextFileEmbed.svelte new file mode 100644 index 0000000..2e1a7a3 --- /dev/null +++ b/src/features/markdown/ui/TextFileEmbed.svelte @@ -0,0 +1,113 @@ + + +
+
+ + {reference.label} + {reference.path} + +
+
+ {#if loadState.kind === "loading"} +

+ Loading text file… +

+ {:else if loadState.kind === "error"} + + {:else if loadState.file.text === ""} +

Empty file

+ {:else if preview} + {#if expanded} + {@render content(loadState.file.text, loadState.file.format)} + {:else} + {@render content(preview.head, loadState.file.format)} + {#if preview.omitted > 0} +

+ ⋯ {preview.omitted} source lines omitted ⋯ +

+ {@render content(preview.tail, loadState.file.format)} + {/if} + {/if} + +

+ Live file · Refresh rereads disk · maximum 256 KiB +

+ {/if} +
+
+ +{#snippet content(text: string, format: "markdown" | "text")} + {#if format === "markdown"} + + + {:else} +
{text}
+ {/if} +{/snippet} -- cgit v1.2.3