Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/codeBlock/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function CodeBlock({filename, language, children}: CodeBlockProps) {
<div className={styles.copied} style={{opacity: showCopied ? 1 : 0}}>
Copied
</div>
<div ref={codeRef}>
<div data-codeblock ref={codeRef}>
{makeKeywordsClickable(makeHighlightBlocks(children, language))}
</div>
</div>
Expand Down
5 changes: 3 additions & 2 deletions src/components/expandable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ export function Expandable({

emit('Copy Expandable Content', {props: {page: window.location.pathname, title}});

// Attempt to get text from markdown code blocks if they exist
const codeBlocks = contentRef.current.querySelectorAll('code');
// Attempt to get text from markdown code blocks if they exist. Only
// targets CodeBlock components using the data-codeblock marker.
const codeBlocks = contentRef.current.querySelectorAll('[data-codeblock]');
let contentToCopy = '';

if (codeBlocks.length > 0) {
Expand Down
Loading