MCPcopy Create free account
hub / github.com/pollinations/pollinations / sanitizeRenderedHtml

Function sanitizeRenderedHtml

apps/chat/src/utils/markdown.js:73–81  ·  view source on GitHub ↗
(html)

Source from the content-addressed store, hash-verified

71};
72
73const sanitizeRenderedHtml = (html) =>
74 String(html).replace(
75 URL_ATTRIBUTE_PATTERN,
76 (match, attributeName, doubleQuoted, singleQuoted, unquoted) => {
77 const value = doubleQuoted ?? singleQuoted ?? unquoted ?? "";
78 if (isSafeUrl(value, attributeName)) return match;
79 return ` ${attributeName.toLowerCase()}="#"`;
80 },
81 );
82
83marked.setOptions({
84 gfm: true,

Callers 2

formatMessageFunction · 0.85
formatStreamingMessageFunction · 0.85

Calls 2

isSafeUrlFunction · 0.85
replaceMethod · 0.65

Tested by

no test coverage detected