diff --git a/src/vs/workbench/contrib/chat/browser/chatMarkdownRenderer.ts b/src/vs/workbench/contrib/chat/browser/chatMarkdownRenderer.ts
index 225ecdd120e65..3e4b6a9349f50 100644
--- a/src/vs/workbench/contrib/chat/browser/chatMarkdownRenderer.ts
+++ b/src/vs/workbench/contrib/chat/browser/chatMarkdownRenderer.ts
@@ -39,8 +39,10 @@ const allowedHtmlTags = [
'a',
'img',
+ // TODO@roblourens when we sanitize attributes in markdown source, we can ban these elements at that step. microsoft/vscode-copilot#5091
// Not in the official list, but used for codicons and other vscode markdown extensions
'span',
+ 'div',
];
/**
diff --git a/src/vs/workbench/contrib/chat/test/browser/__snapshots__/ChatMarkdownRenderer_html_comments.0.snap b/src/vs/workbench/contrib/chat/test/browser/__snapshots__/ChatMarkdownRenderer_html_comments.0.snap
index c1ba30be800a4..9def37d5acb5c 100644
--- a/src/vs/workbench/contrib/chat/test/browser/__snapshots__/ChatMarkdownRenderer_html_comments.0.snap
+++ b/src/vs/workbench/contrib/chat/test/browser/__snapshots__/ChatMarkdownRenderer_html_comments.0.snap
@@ -1 +1 @@
-
<!-- comment1 <div></div> --><div>content</div><!-- comment2 -->
\ No newline at end of file
+<!-- comment1 <div></div> -->
content
<!-- comment2 -->
\ No newline at end of file
diff --git a/src/vs/workbench/contrib/chat/test/browser/__snapshots__/ChatMarkdownRenderer_invalid_HTML.0.snap b/src/vs/workbench/contrib/chat/test/browser/__snapshots__/ChatMarkdownRenderer_invalid_HTML.0.snap
index 02c52ac2aa40c..0d3458d76b7d4 100644
--- a/src/vs/workbench/contrib/chat/test/browser/__snapshots__/ChatMarkdownRenderer_invalid_HTML.0.snap
+++ b/src/vs/workbench/contrib/chat/test/browser/__snapshots__/ChatMarkdownRenderer_invalid_HTML.0.snap
@@ -1 +1 @@
-1<canvas>2<div>3</div></canvas>4
\ No newline at end of file
+1<canvas>2<details>3</details></canvas>4
\ No newline at end of file
diff --git a/src/vs/workbench/contrib/chat/test/browser/__snapshots__/ChatMarkdownRenderer_invalid_HTML_with_attributes.0.snap b/src/vs/workbench/contrib/chat/test/browser/__snapshots__/ChatMarkdownRenderer_invalid_HTML_with_attributes.0.snap
index 67381fee546d8..3bb96899c111c 100644
--- a/src/vs/workbench/contrib/chat/test/browser/__snapshots__/ChatMarkdownRenderer_invalid_HTML_with_attributes.0.snap
+++ b/src/vs/workbench/contrib/chat/test/browser/__snapshots__/ChatMarkdownRenderer_invalid_HTML_with_attributes.0.snap
@@ -1 +1 @@
-1<div id="id1" style="display: none">2<div id="my id 2">3</div></div>4
\ No newline at end of file
+1<details id="id1" style="display: none">2<details id="my id 2">3</details></details>4
\ No newline at end of file
diff --git a/src/vs/workbench/contrib/chat/test/browser/__snapshots__/ChatMarkdownRenderer_mixed_valid_and_invalid_HTML.0.snap b/src/vs/workbench/contrib/chat/test/browser/__snapshots__/ChatMarkdownRenderer_mixed_valid_and_invalid_HTML.0.snap
index a58ce687e96e8..ba72307e53354 100644
--- a/src/vs/workbench/contrib/chat/test/browser/__snapshots__/ChatMarkdownRenderer_mixed_valid_and_invalid_HTML.0.snap
+++ b/src/vs/workbench/contrib/chat/test/browser/__snapshots__/ChatMarkdownRenderer_mixed_valid_and_invalid_HTML.0.snap
@@ -1,8 +1,8 @@
heading
-<div>
+<details>
- - <div>1</div>
+ - <details>1</details>
- hi
-</div>
+</details>
<canvas>canvas here</canvas>
<details></details>
\ No newline at end of file
diff --git a/src/vs/workbench/contrib/chat/test/browser/__snapshots__/ChatMarkdownRenderer_remote_images.0.snap b/src/vs/workbench/contrib/chat/test/browser/__snapshots__/ChatMarkdownRenderer_remote_images.0.snap
index 247cce5ff8ead..34a719b061328 100644
--- a/src/vs/workbench/contrib/chat/test/browser/__snapshots__/ChatMarkdownRenderer_remote_images.0.snap
+++ b/src/vs/workbench/contrib/chat/test/browser/__snapshots__/ChatMarkdownRenderer_remote_images.0.snap
@@ -1 +1 @@
- <div><img src="http://disallowed.com/image.jpg"></div>
\ No newline at end of file
+ <img src="http://disallowed.com/image.jpg">
\ No newline at end of file
diff --git a/src/vs/workbench/contrib/chat/test/browser/chatMarkdownRenderer.test.ts b/src/vs/workbench/contrib/chat/test/browser/chatMarkdownRenderer.test.ts
index f006d1afbf7b5..e9975f252834d 100644
--- a/src/vs/workbench/contrib/chat/test/browser/chatMarkdownRenderer.test.ts
+++ b/src/vs/workbench/contrib/chat/test/browser/chatMarkdownRenderer.test.ts
@@ -28,14 +28,14 @@ suite('ChatMarkdownRenderer', () => {
});
test('invalid HTML', async () => {
- const md = new MarkdownString('14');
+ const md = new MarkdownString('14');
md.supportHtml = true;
const result = store.add(testRenderer.render(md));
await assertSnapshot(result.element.outerHTML);
});
test('invalid HTML with attributes', async () => {
- const md = new MarkdownString('14');
+ const md = new MarkdownString('123 4');
md.supportHtml = true;
const result = store.add(testRenderer.render(md));
await assertSnapshot(result.element.outerHTML);
@@ -57,12 +57,12 @@ suite('ChatMarkdownRenderer', () => {
test('mixed valid and invalid HTML', async () => {
const md = new MarkdownString(`
heading
-
+
`);
md.supportHtml = true;
const result = store.add(testRenderer.render(md));