From 729d9335ca221adf618981986cb6a27538994401 Mon Sep 17 00:00:00 2001 From: John Bowdre Date: Wed, 8 Nov 2023 22:02:57 -0600 Subject: [PATCH] don't copy line-remove (diff) lines --- assets/js/code-copy-button.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/js/code-copy-button.js b/assets/js/code-copy-button.js index aff9abc..cff2619 100644 --- a/assets/js/code-copy-button.js +++ b/assets/js/code-copy-button.js @@ -16,8 +16,8 @@ function createCopyButton(highlightDiv) { document.querySelectorAll(".highlight").forEach((highlightDiv) => createCopyButton(highlightDiv)); async function copyCodeToClipboard(button, highlightDiv) { - // capture all code lines in the selected block which aren't classed `nocopy` - let codeToCopy = highlightDiv.querySelectorAll(":last-child > .torchlight > code > .line:not(.nocopy)"); + // capture all code lines in the selected block which aren't classed `nocopy` or `line-remove` + let codeToCopy = highlightDiv.querySelectorAll(":last-child > .torchlight > code > .line:not(.nocopy, .line-remove)"); // now remove the first-child of each line which has class `line-number` codeToCopy = Array.from(codeToCopy).reduce((accumulator, line) => { if (line.firstChild.className != "line-number") {