fix(tui): cleaned up markdown rendering of inline tags and entities
- Stripped `<span>` and `<text>` tags from rendered markdown while preserving their contents. - Updated HTML entity normalization to handle common special characters and numeric codes within the TUI. - Ensured whitespace surrounding stripped inline tags is preserved, preventing content merging.
This commit is contained in:
@@ -29,4 +29,18 @@ describe("Transcript Markdown", () => {
|
||||
expect(html).toContain("<img src=x onerror=alert(1)>");
|
||||
expect(html).not.toContain("<img src=x");
|
||||
});
|
||||
|
||||
it("strips span and text HTML tags but preserves their contents and inline text rendering", () => {
|
||||
const html = renderMarkdown("<span></span><text>▃</text>");
|
||||
|
||||
expect(html).toContain("▃");
|
||||
expect(html).not.toContain("<span>");
|
||||
expect(html).not.toContain("<text>");
|
||||
});
|
||||
|
||||
it("unescapes HTML entities inside span and text HTML tags safely", () => {
|
||||
const html = renderMarkdown("<span><▃> & "test" 😀 😀</span>");
|
||||
|
||||
expect(html).toContain("<▃> & "test" 😀 😀");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user