Merge f184161ba4 into 09be5d45d5
This commit is contained in:
commit
298ea72a7e
@ -282,7 +282,14 @@ function renderGroupedMessage(
|
|||||||
)}</div>`
|
)}</div>`
|
||||||
: nothing}
|
: nothing}
|
||||||
${markdown
|
${markdown
|
||||||
? html`<div class="chat-text">${unsafeHTML(toSanitizedMarkdownHtml(markdown))}</div>`
|
? html`
|
||||||
|
<div class="chat-text">
|
||||||
|
${unsafeHTML(toSanitizedMarkdownHtml(
|
||||||
|
// Ensure horizontal rules (---) are padded with newlines
|
||||||
|
// so the markdown parser recognizes them correctly.
|
||||||
|
markdown.replace(/^(---|\*\*\*|___)$/gm, '\n$1\n')
|
||||||
|
))}
|
||||||
|
</div>`
|
||||||
: nothing}
|
: nothing}
|
||||||
${toolCards.map((card) => renderToolCardSidebar(card, onOpenSidebar))}
|
${toolCards.map((card) => renderToolCardSidebar(card, onOpenSidebar))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -29,4 +29,9 @@ describe("toSanitizedMarkdownHtml", () => {
|
|||||||
expect(html).toContain("<code");
|
expect(html).toContain("<code");
|
||||||
expect(html).toContain("console.log(1)");
|
expect(html).toContain("console.log(1)");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("renders horizontal rules", () => {
|
||||||
|
const html = toSanitizedMarkdownHtml("Line 1\n\n---\n\nLine 2");
|
||||||
|
expect(html).toContain("<hr");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user