Skip to content

Soul-driven AI agent with permission-hardened tools, token budgets, and multi-channel access. Runs 24/7 from CLI, Telegram or More.

fix: decode HTML entities after markdown rendering to prevent double-encoding by marked

Salman Qureshibb3b6b631590
diff --git a/src/utils/markdown.ts b/src/utils/markdown.ts
index 23f0b3cb..724f51f7 100644
--- a/src/utils/markdown.ts
+++ b/src/utils/markdown.ts
@@ -31,12 +31,11 @@ function decodeHtmlEntities(text: string): string {
export function renderMarkdown(text: string): string {
try {
- const decoded = decodeHtmlEntities(text);
- const tokens = lexer.lexer(decoded);
+ const tokens = lexer.lexer(text);
const result = renderTokens(tokens);
- return result.replace(/\n{3,}/g, '\n\n').trimEnd();
+ return decodeHtmlEntities(result.replace(/\n{3,}/g, '\n\n').trimEnd());
} catch {
- return text;
+ return decodeHtmlEntities(text);
}
}