From 889463065934312ce57546db1af9a25ace4dad23 Mon Sep 17 00:00:00 2001 From: Matt Wang <matt@matthewwang.me> Date: Sun, 5 Feb 2023 14:58:56 -0800 Subject: [PATCH] Fix copy code button interaction with kramdown line numbers (#1143) Co-authored-by: Simone <26844016+simonebortolin@users.noreply.github.com> --- assets/js/just-the-docs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/just-the-docs.js b/assets/js/just-the-docs.js index 07d4f076..953c6154 100644 --- a/assets/js/just-the-docs.js +++ b/assets/js/just-the-docs.js @@ -504,7 +504,7 @@ jtd.onReady(function(){ copyButton.addEventListener('click', function () { if(timeout === null) { - var code = codeBlock.querySelector('pre:not(.lineno)').innerText; + var code = (codeBlock.querySelector('pre:not(.lineno, .highlight)') || codeBlock.querySelector('code')).innerText; window.navigator.clipboard.writeText(code); copyButton.innerHTML = svgCopied; -- GitLab