Skip to content

Commit c32cf01

Browse files
Fix deleted comments
1 parent 03c316c commit c32cf01

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

components/blocks/code.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,15 +304,16 @@ async function highlightElement(
304304
console.error(`Prism doesn't support this language: ${importLanguage}`);
305305
}
306306
}
307-
307+
// Highlight the code block and conditionally enable toolbar plugins (including copy button)
308308
if (codeElement) {
309+
// First highlight the element
309310
Prism.highlightElement(codeElement);
310-
311+
// Then activate toolbar plugins on the parent container if copy button is not hidden
311312
if (!hideCopyButton) {
312313
const container = codeElement.closest(`.${styles.Container}`);
313314
if (container) {
314315
Prism.highlightAllUnder(container);
315-
316+
// If the code block is a diff, add diff markers and override the copy button
316317
if (isDiff) {
317318
addDiffMarkers(container, codeElement);
318319
overrideDiffCopyButton(container, codeElement);

0 commit comments

Comments
 (0)