fix(tui): render HTML tags as plain text in Markdown component

Handles both block-level and inline HTML tags that were previously
silently dropped.

fixes #359
This commit is contained in:
Mario Zechner 2025-12-29 21:57:24 +01:00
parent 4ef3325cec
commit 9427211f99
2 changed files with 15 additions and 1 deletions

View file

@ -2,6 +2,10 @@
## [Unreleased] ## [Unreleased]
### Fixed
- Markdown component now renders HTML tags as plain text instead of silently dropping them ([#359](https://github.com/badlogic/pi-mono/issues/359))
## [0.29.0] - 2025-12-25 ## [0.29.0] - 2025-12-25
### Added ### Added

View file

@ -317,7 +317,10 @@ export class Markdown implements Component {
break; break;
case "html": case "html":
// Skip HTML for terminal output // Render HTML as plain text (escaped for terminal)
if ("raw" in token && typeof token.raw === "string") {
lines.push(this.applyDefaultStyle(token.raw.trim()));
}
break; break;
case "space": case "space":
@ -394,6 +397,13 @@ export class Markdown implements Component {
break; break;
} }
case "html":
// Render inline HTML as plain text
if ("raw" in token && typeof token.raw === "string") {
result += this.applyDefaultStyle(token.raw);
}
break;
default: default:
// Handle any other inline token types as plain text // Handle any other inline token types as plain text
if ("text" in token && typeof token.text === "string") { if ("text" in token && typeof token.text === "string") {