nsarrazin HF Staff commited on
Commit
ba5294b
·
1 Parent(s): 33d6f58

fix: don't escape newline

Browse files
src/lib/components/chat/MarkdownRenderer.svelte CHANGED
@@ -56,12 +56,11 @@
56
  "<": "&lt;",
57
  ">": "&gt;",
58
  "&": "&amp;",
59
- "\n": "<br />",
60
  }[x] || x)
61
  );
62
  }
63
 
64
- $: tokens = marked.lexer(addInlineCitations(escapeHTML(content), sources));
65
 
66
  function processLatex(parsed: string) {
67
  const delimiters = [
@@ -114,7 +113,7 @@
114
  {#if token.type === "code"}
115
  <CodeBlock lang={token.lang} code={token.text} />
116
  {:else}
117
- {@const parsed = marked.parse(processLatex(token.raw), options)}
118
  {#await parsed then parsed}
119
  <!-- eslint-disable-next-line svelte/no-at-html-tags -->
120
  {@html DOMPurify.sanitize(parsed)}
 
56
  "<": "&lt;",
57
  ">": "&gt;",
58
  "&": "&amp;",
 
59
  }[x] || x)
60
  );
61
  }
62
 
63
+ $: tokens = marked.lexer(addInlineCitations(content, sources));
64
 
65
  function processLatex(parsed: string) {
66
  const delimiters = [
 
113
  {#if token.type === "code"}
114
  <CodeBlock lang={token.lang} code={token.text} />
115
  {:else}
116
+ {@const parsed = marked.parse(processLatex(escapeHTML(token.raw)), options)}
117
  {#await parsed then parsed}
118
  <!-- eslint-disable-next-line svelte/no-at-html-tags -->
119
  {@html DOMPurify.sanitize(parsed)}