mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2024-11-19 04:30:10 +01:00
Fix markdown styling for rendered images (#2125)
fix md styling for rendered images
This commit is contained in:
parent
99f2c25b1c
commit
fd16773295
@ -44,7 +44,19 @@ const markdown = markdownIt({
|
||||
"</pre></div>"
|
||||
);
|
||||
},
|
||||
}).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 `<div class="w-full max-w-[800px]"><img src="${src}" alt="${alt}" class="w-full h-auto" /></div>`;
|
||||
};
|
||||
|
||||
markdown.use(markdownItKatex);
|
||||
|
||||
export default function renderMarkdown(text = "") {
|
||||
return markdown.render(text);
|
||||
|
Loading…
Reference in New Issue
Block a user