feat(chat): render fenced latex math blocks

This commit is contained in:
Maxim Kirilyuk
2026-05-23 20:42:46 +03:00
committed by ekko
parent 3b1beb634b
commit 070de2499e
3 changed files with 61 additions and 4 deletions
+15 -1
View File
@@ -611,7 +611,21 @@ describe('MarkdownRenderer', () => {
expect(body.text()).not.toContain('$$')
})
it('does not render latex inside fenced code blocks', () => {
it('renders explicit latex fenced blocks with katex', () => {
const wrapper = mount(MarkdownRenderer, {
props: {
content: '```latex\n\\[\\text{Итог} = \\operatorname{Округление}\\!\\left(0.5\\,O_1 + 0.5\\,O_2\\right)\\]\n```',
},
})
const body = wrapper.find('.markdown-body')
expect(body.find('.katex-display').exists()).toBe(true)
expect(body.find('.katex').exists()).toBe(true)
expect(body.text()).not.toContain('```latex')
expect(body.text()).toContain('Округление')
})
it('does not render latex inside ordinary fenced code blocks', () => {
const wrapper = mount(MarkdownRenderer, {
props: {
content: '```ts\nconst formula = "$x^2 + y^2 = z^2$"\n```',