diff --git a/_sass/code.scss b/_sass/code.scss
index c12421b65a6ad1919a755be124c0ea8d4c2b2f2f..ee8a1f05043cfd42911bc67594f3b73da15fad4b 100644
--- a/_sass/code.scss
+++ b/_sass/code.scss
@@ -3,8 +3,8 @@
 
 // {% raw %}
 
-// This instruction applies to all queues not within 'pre', avoiding 'code' generated by the highlight.
-:not(pre) {
+// This instruction applies to all queues not within 'pre' or 'figure', avoiding 'code' generated by the highlight.
+:not(pre, figure) {
   & > code {
     padding: 0.2em 0.15em;
     font-weight: 400;
@@ -52,13 +52,13 @@ a:visited code {
 // ```[LANG]...```
 
 // the code may appear with 3 different types:
-// container \ case:  default case,          code with line number,          code with html rendering
-// top level:         div.highlighter-rouge, div.listingblock > div.content, figure.highlight
-// second level:      div.highlight,         .table-wrapper,                 pre
-// third level:       pre.highlight,         td.code,                        absent
-// last level:        code,                  pre,                            code (optionality)
-// highlighter level: span,                  span,                           span
-// the spacing are only in the second level for case 1, 3 and in the thirt level for case 2
+// container \ case:  default case,          code with line number,   code with html rendering
+// top level:         div.highlighter-rouge, figure.highlight,        figure.highlight
+// second level:      div.highlight,         div.table-wrapper,       pre.highlight
+// third level:       pre.highlight,         td.code,                 absent
+// last level:        code,                  pre,                     code (optionality)
+// highlighter level: span,                  span,                    span
+// the spacing are only in the second level for case 1, 3 and in the third level for case 2
 
 // select top level container
 div.highlighter-rouge,
@@ -150,7 +150,7 @@ figure.highlight {
 
 // setting the spacing and scrollbar on the thirt level for the second case
 .highlight .table-wrapper {
-  padding: 0;
+  padding: $sp-3 0;
   margin: 0;
   border: 0;
   box-shadow: none;
diff --git a/assets/js/just-the-docs.js b/assets/js/just-the-docs.js
index 223f28b8b76fa3ee3974acf56f8fa8355d4e417b..8aabf325db6d6902865bcc5b04e5c5c4b56f7158 100644
--- a/assets/js/just-the-docs.js
+++ b/assets/js/just-the-docs.js
@@ -501,7 +501,7 @@ jtd.onReady(function(){
 
     copyButton.addEventListener('click', function () {
       if(timeout === null) {
-        var code = codeBlock.querySelector('code').innerText.trim();
+        var code = codeBlock.querySelector('pre:not(.lineno)').innerText;
         window.navigator.clipboard.writeText(code);
 
         copyButton.innerHTML = svgCopied;