upd md render

This commit is contained in:
beo3000 2026-02-28 16:57:44 +01:00
parent 1752e3c27c
commit 6e35822708
2 changed files with 12 additions and 3 deletions

View File

@ -1 +1 @@
1.1.104 1.1.105

View File

@ -35,18 +35,27 @@
chip.style.color = color; 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<HTMLElement>('[data-assignment]'); const assignmentChips = containerEl.querySelectorAll<HTMLElement>('[data-assignment]');
const personChips = containerEl.querySelectorAll<HTMLElement>('[data-person]'); const personChips = containerEl.querySelectorAll<HTMLElement>('[data-person]');
await Promise.all([ await Promise.all([
...Array.from(assignmentChips).map(async chip => { ...Array.from(assignmentChips).map(async chip => {
const ctx = await findContextByAbbreviation(chip.dataset.assignment!); const ctx = await findContextByAbbreviation(chip.dataset.assignment!);
if (!ctx) return; if (!ctx) { markUnknown(chip, '-> '); return; }
const subType = (ctx.meta as Record<string, unknown> | null)?.personSubType as PersonSubType | undefined; const subType = (ctx.meta as Record<string, unknown> | null)?.personSubType as PersonSubType | undefined;
applySubtypeColor(chip, subType); applySubtypeColor(chip, subType);
}), }),
...Array.from(personChips).map(async chip => { ...Array.from(personChips).map(async chip => {
const ctx = await findContextByMentionName(chip.dataset.person!, 'person'); const ctx = await findContextByMentionName(chip.dataset.person!, 'person');
if (!ctx) return; if (!ctx) { markUnknown(chip, '@'); return; }
const subType = (ctx.meta as Record<string, unknown> | null)?.personSubType as PersonSubType | undefined; const subType = (ctx.meta as Record<string, unknown> | null)?.personSubType as PersonSubType | undefined;
applySubtypeColor(chip, subType); applySubtypeColor(chip, subType);
}), }),