Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions components/AgentChat/MarkdownMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ const md = new MarkdownIt({
breaks: true,
});

// Schemeless text links only behind "www.": linkify-it links any name.tld, and
// file extensions such as .md, .py, .sh and .rs are country-code domains.
const matchLinks = md.linkify.match.bind(md.linkify);
md.linkify.match = (text) =>
matchLinks(text)?.filter((link) => link.schema !== '' || /^www\./i.test(link.raw)) ?? null;

export const ASSISTANT_HTML_SANITIZE_OPTIONS: sanitizeHtml.IOptions = {
allowedTags: [
'p',
Expand Down
Loading