nsarrazin HF Staff commited on
Commit
69eb994
·
unverified ·
1 Parent(s): 9e5dd18

fix: escape html in preprocessing step

Browse files
src/lib/components/chat/MarkdownRenderer.svelte CHANGED
@@ -163,11 +163,11 @@
163
 
164
  const marked = new Marked({
165
  hooks: {
 
166
  postprocess: (html) => DOMPurify.sanitize(addInlineCitations(html, sources)),
167
  },
168
  extensions: [katexBlockExtension, katexInlineExtension],
169
  renderer: {
170
- html: (html) => escapeHTML(html),
171
  link: (href, title, text) =>
172
  `<a href="${href?.replace(/>$/, "")}" target="_blank" rel="noreferrer">${text}</a>`,
173
  },
 
163
 
164
  const marked = new Marked({
165
  hooks: {
166
+ preprocess: (md) => escapeHTML(md),
167
  postprocess: (html) => DOMPurify.sanitize(addInlineCitations(html, sources)),
168
  },
169
  extensions: [katexBlockExtension, katexInlineExtension],
170
  renderer: {
 
171
  link: (href, title, text) =>
172
  `<a href="${href?.replace(/>$/, "")}" target="_blank" rel="noreferrer">${text}</a>`,
173
  },