From 6e35822708a1236a7a6afb54a4e3f232bd99f950 Mon Sep 17 00:00:00 2001 From: beo3000 Date: Sat, 28 Feb 2026 16:57:44 +0100 Subject: [PATCH] upd md render --- ka-note/VERSION | 2 +- .../src/lib/components/RenderedMarkdown.svelte | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ka-note/VERSION b/ka-note/VERSION index b3350ea..83fa8bf 100644 --- a/ka-note/VERSION +++ b/ka-note/VERSION @@ -1 +1 @@ -1.1.104 \ No newline at end of file +1.1.105 \ No newline at end of file diff --git a/ka-note/client/src/lib/components/RenderedMarkdown.svelte b/ka-note/client/src/lib/components/RenderedMarkdown.svelte index c850ef2..a385b9c 100644 --- a/ka-note/client/src/lib/components/RenderedMarkdown.svelte +++ b/ka-note/client/src/lib/components/RenderedMarkdown.svelte @@ -35,18 +35,27 @@ chip.style.color = color; } + function markUnknown(chip: HTMLElement, prefix: string) { + // Replace the chip (and its preceding arrow span) with plain text + const arrow = chip.previousElementSibling; + const text = document.createTextNode(`${prefix}${chip.dataset.assignment ?? chip.dataset.person ?? ''}`); + chip.parentNode?.insertBefore(text, chip); + chip.remove(); + if (arrow && /→|→/.test(arrow.textContent ?? '')) arrow.remove(); + } + const assignmentChips = containerEl.querySelectorAll('[data-assignment]'); const personChips = containerEl.querySelectorAll('[data-person]'); await Promise.all([ ...Array.from(assignmentChips).map(async chip => { const ctx = await findContextByAbbreviation(chip.dataset.assignment!); - if (!ctx) return; + if (!ctx) { markUnknown(chip, '-> '); return; } const subType = (ctx.meta as Record | null)?.personSubType as PersonSubType | undefined; applySubtypeColor(chip, subType); }), ...Array.from(personChips).map(async chip => { const ctx = await findContextByMentionName(chip.dataset.person!, 'person'); - if (!ctx) return; + if (!ctx) { markUnknown(chip, '@'); return; } const subType = (ctx.meta as Record | null)?.personSubType as PersonSubType | undefined; applySubtypeColor(chip, subType); }),