nsarrazin HF Staff commited on
Commit
0f674e1
·
unverified ·
1 Parent(s): 800644b

fix: markdown escaping for good

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