Skip to content

Commit

Permalink
update code block (#2297)
Browse files Browse the repository at this point in the history
  • Loading branch information
pablonyx authored Sep 2, 2024
1 parent 0027f16 commit 14a9fec
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions web/src/app/chat/message/CodeBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ export function CodeBlock({
);
codeText = codeText.trim();

// Find the last occurrence of closing backticks
const lastBackticksIndex = codeText.lastIndexOf("```");
if (lastBackticksIndex !== -1) {
codeText = codeText.slice(0, lastBackticksIndex + 3);
}

// Remove the language declaration and trailing backticks
const codeLines = codeText.split("\n");
if (
Expand Down

0 comments on commit 14a9fec

Please sign in to comment.