Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy code to clipboard #2812

Merged
merged 12 commits into from
May 5, 2024
6 changes: 6 additions & 0 deletions assets/js/_main.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@ $(document).ready(function() {
console.warn(thisButton);
throw new Error("No code block found for this button.");
}

// Skip line numbers if present (i.e. {% highlight lineno %})
var realCodeBlock = codeBlock.querySelector("td.code");
iBug marked this conversation as resolved.
Show resolved Hide resolved
if (realCodeBlock) {
codeBlock = realCodeBlock;
}
return copyText(codeBlock.innerText);
};

Expand Down
2 changes: 1 addition & 1 deletion assets/js/main.min.js

Large diffs are not rendered by default.