diff --git a/frontend/src/utils/chat/markdown.js b/frontend/src/utils/chat/markdown.js index 77004491d..17b5acbb8 100644 --- a/frontend/src/utils/chat/markdown.js +++ b/frontend/src/utils/chat/markdown.js @@ -44,7 +44,19 @@ const markdown = markdownIt({ "" ); }, -}).use(markdownItKatex); +}); + +// Custom renderer for responsive images rendered in markdown +markdown.renderer.rules.image = function (tokens, idx) { + const token = tokens[idx]; + const srcIndex = token.attrIndex("src"); + const src = token.attrs[srcIndex][1]; + const alt = token.content || ""; + + return `
${alt}
`; +}; + +markdown.use(markdownItKatex); export default function renderMarkdown(text = "") { return markdown.render(text);