diff --git a/src/renderer/src/components/editor/raw-markdown-html.fences.test.ts b/src/renderer/src/components/editor/raw-markdown-html.fences.test.ts index 9d9d1e1fea5..3d79bedfef5 100644 --- a/src/renderer/src/components/editor/raw-markdown-html.fences.test.ts +++ b/src/renderer/src/components/editor/raw-markdown-html.fences.test.ts @@ -38,6 +38,40 @@ describe('HTML source encoding across fenced code blocks', () => { } ) + it('keeps JSX-like placeholders in the second consecutive block unencoded', () => { + const codec = createRichMarkdownEditorCodec(key) + const source = [ + '```python', + 'message = "hello"', + '```', + '', + '```bash', + 'run_tool ', + '```' + ].join('\n') + + expect(encodeRawMarkdownHtmlForRichEditor(source, codec)).toBe(source) + }) + + it('still encodes real HTML between consecutive fenced blocks', () => { + const codec = createRichMarkdownEditorCodec(key) + const source = [ + '```ts', + 'const value = 1', + '```', + '', + 'A real
tag.', + '', + '```sh', + 'echo hi', + '```' + ].join('\n') + const encoded = encodeRawMarkdownHtmlForRichEditor(source, codec) + + expect(encoded).toContain(codec.transport.create('inline-html', '
')) + expect(encoded).not.toContain('A real
tag.') + }) + it('keeps shorter fences and fence-like code lines inside an open block', () => { const content = '````\n```\n\n```` trailing text\n\n````\n'