Skip to content

Commit 082d589

Browse files
conwnetSiddhant-K-codeCopilot
authored
feat(ai): add mermaid support to markdown (#780)
* feat(ai): add mermaid support to markdown * Update extensions/github1s-ai/src/webview/components/Markdown.ts Co-authored-by: Siddhant Khare <Siddhantkhare2694@gmail.com> * Update extensions/github1s-ai/src/webview/components/Markdown.ts Co-authored-by: Siddhant Khare <Siddhantkhare2694@gmail.com> * fix(ai): stabilize Mermaid rendering * fix(ai): sync Mermaid toggle with the visible view - Derive the toggle label from what is shown, disable it while a render is pending, and reset the selection when rendering fails so the next click retries. - Debounce re-renders while the source of an open diagram is still streaming, which avoids flicker and a render per token. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Siddhant Khare <Siddhantkhare2694@gmail.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 4508751 commit 082d589

7 files changed

Lines changed: 1429 additions & 135 deletions

File tree

‎extensions/github1s-ai/assets/chat.css‎

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ summary:focus-visible,
875875
min-height: 27px;
876876
align-items: center;
877877
justify-content: space-between;
878-
gap: 8px;
878+
gap: 2px;
879879
padding: 0 5px 0 9px;
880880
color: var(--vscode-descriptionForeground);
881881
background: var(--vscode-editorGroupHeader-tabsBackground, transparent);
@@ -889,8 +889,8 @@ summary:focus-visible,
889889
white-space: nowrap;
890890
}
891891

892-
.code-copy {
893-
min-width: 42px;
892+
.code-block-header button {
893+
min-width: 24px;
894894
padding: 2px 5px;
895895
color: inherit;
896896
background: transparent;
@@ -899,18 +899,35 @@ summary:focus-visible,
899899
font-size: inherit;
900900
}
901901

902-
.code-copy:hover {
902+
.code-block-header button:hover {
903903
color: var(--vscode-foreground);
904904
background: var(--vscode-toolbar-hoverBackground, var(--vscode-list-hoverBackground));
905905
}
906906

907-
.code-block pre {
907+
.code-block pre,
908+
.mermaid-diagram {
908909
max-height: 480px;
909910
margin: 0;
910911
overflow: auto;
911912
padding: 10px 11px;
912913
}
913914

915+
.mermaid-diagram {
916+
box-sizing: border-box;
917+
}
918+
919+
.mermaid-diagram > svg {
920+
display: block;
921+
height: auto;
922+
margin: 0 auto;
923+
}
924+
925+
.mermaid-controls {
926+
display: flex;
927+
gap: inherit;
928+
margin-left: auto;
929+
}
930+
914931
.code-block code {
915932
display: block;
916933
min-width: max-content;

0 commit comments

Comments
 (0)