import { markupAccessibilityText, parseMarkup } from '@datamoc/mw_games/two-d/ui';
const spans = parseMarkup("Pay <b>10</b> gold<img>coin.png</img>");
console.log(markupAccessibilityText(spans)); // 'Pay 10 gold[image]'
console.log(markupAccessibilityText(spans, { describeImage: () => ' (coin icon)' }));
// 'Pay 10 gold (coin icon)'
The plain-text projection for a place that cannot render any markup at all - a screen reader, a log line, a tooltip that only takes a string. Unlike
stripMarkup(which keeps an image span's raw path, useful for round-tripping but not for reading aloud), an image becomesdescribeImage's result, defaulting to[image]so an image is at least announced as present rather than silently dropped or read as a file path.