update code block (#2297)

This commit is contained in:
pablodanswer 2024-09-02 13:33:18 -07:00 committed by GitHub
parent 0027f161d7
commit 14a9fecc64
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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 (