From d038cc319619d0614d9f328bdeb394df25a69ebb Mon Sep 17 00:00:00 2001 From: Markus Graf Date: Sun, 29 Mar 2026 21:26:04 +0200 Subject: [PATCH] feat(quick-260329-ton): replace textContent with innerHTML + renderInlineMarkdown at all AI-text insertion points - src/app.ts: greeting text now renders inline markdown - src/ui/screens.ts: letter intro text now renders inline markdown - src/forest/reward.ts: forest comment now renders inline markdown - All 3 sites use innerHTML with XSS-safe renderInlineMarkdown --- src/app.ts | 3 ++- src/forest/reward.ts | 3 ++- src/ui/screens.ts | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/app.ts b/src/app.ts index 96ff8c7..597f409 100644 --- a/src/app.ts +++ b/src/app.ts @@ -1,6 +1,7 @@ import { speakText } from "./audio/speech"; import { companions } from "./companion/characters"; import { getGreeting } from "./companion/companion"; +import { renderInlineMarkdown } from "./utils/markdown"; import { initRewardScreen, startPreGeneration } from "./forest/reward"; import { initForestScreen, renderForestScene } from "./forest/scene"; import { getProgress, openDB, saveProgress } from "./storage/db"; @@ -224,7 +225,7 @@ export async function initApp(): Promise { // Fetch greeting async (shows immediately with avatar, text fills in) getGreeting(progress.selectedCharacter, db).then((text) => { - textEl.textContent = text; + textEl.innerHTML = renderInlineMarkdown(text); speakText(text); }); } diff --git a/src/forest/reward.ts b/src/forest/reward.ts index e24b9c6..12425fc 100644 --- a/src/forest/reward.ts +++ b/src/forest/reward.ts @@ -22,6 +22,7 @@ import { getRandomFallbackForestComment } from "../companion/fallbacks"; import type { CompanionType, ForestElement } from "../types"; import { playRewardSound } from "../audio/sounds"; import { speakText } from "../audio/speech"; +import { renderInlineMarkdown } from "../utils/markdown"; // --- Element types for random selection --- @@ -204,7 +205,7 @@ export async function initRewardScreen( playRewardSound(); // 7. Show companion comment + speak it aloud - companionTextEl.textContent = comment; + companionTextEl.innerHTML = renderInlineMarkdown(comment); speakText(comment); // 8. Wire buttons diff --git a/src/ui/screens.ts b/src/ui/screens.ts index 25d8801..13ea883 100644 --- a/src/ui/screens.ts +++ b/src/ui/screens.ts @@ -20,6 +20,7 @@ import { getLevelByNumber } from "../game/levels"; import { getLetterIntro } from "../companion/companion"; import { getWordsForLevel } from "../game/words"; import { playCorrectSound } from "../audio/sounds"; +import { renderInlineMarkdown } from "../utils/markdown"; export function initWelcomeScreen( db: IDBDatabase, @@ -419,7 +420,7 @@ export function initLessonScreen( if (cancelled) return; // Show companion intro text - companionText.textContent = introText; + companionText.innerHTML = renderInlineMarkdown(introText); companionArea.style.display = "flex"; // Show the letter