fix(telegram): render HTML with markdown-it and strip HTML from Discord bodies

This commit is contained in:
RhenCloud 2026-08-18 18:29:17 +08:00
parent ea049e28c9
commit 9899cd01bf
No known key found for this signature in database
GPG key ID: A574A617378C4E0B
7 changed files with 90 additions and 18 deletions

View file

@ -88,6 +88,20 @@ describe("telegram renderNeutralMessage", () => {
);
});
it("keeps query strings and parens intact in link URLs", () => {
const out = renderNeutralMessage({
title: "acme/widget: t",
description:
"[View](https://github.com/acme/widget/compare/a?w=1&diff=split) and " +
"[wiki](https://en.wikipedia.org/wiki/Foo_(bar))",
});
expect(out).toContain(
'<a href="https://github.com/acme/widget/compare/a?w=1&amp;diff=split">View</a>',
);
expect(out).toContain('<a href="https://en.wikipedia.org/wiki/Foo_(bar)">wiki</a>');
expect(out).not.toContain("&amp;amp;");
});
it("formats ISO timestamps into a readable UTC string", () => {
const out = renderNeutralMessage({
title: "acme/widget: t",