File tree 2 files changed +14
-3
lines changed
2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 44
44
direction : ltr;
45
45
}
46
46
47
- div .highlight {
47
+ div .highlight , pre {
48
48
position : relative;
49
49
}
50
50
@@ -60,6 +60,7 @@ div.highlight {
60
60
font-size : 14px ;
61
61
}
62
62
63
- div .highlight : hover .copy-code {
63
+ div .highlight : hover .copy-code ,
64
+ pre : hover .copy-code {
64
65
display : block;
65
66
}
Original file line number Diff line number Diff line change 120
120
selection . removeRange ( range ) ;
121
121
} ) ;
122
122
123
- container . appendChild ( copybutton ) ;
123
+ if ( container . classList . contains ( "highlight" ) ) {
124
+ container . appendChild ( copybutton ) ;
125
+ } else if ( container . parentNode . firstChild == container ) {
126
+ // td containing LineNos
127
+ } else if ( codeblock . parentNode . parentNode . parentNode . parentNode . parentNode . nodeName == "TABLE" ) {
128
+ // table containing LineNos and code
129
+ codeblock . parentNode . parentNode . parentNode . parentNode . parentNode . appendChild ( copybutton ) ;
130
+ } else {
131
+ // code blocks not having highlight as parent class
132
+ codeblock . parentNode . appendChild ( copybutton ) ;
133
+ }
124
134
} ) ;
125
135
</ script >
126
136
{{- end }}
You can’t perform that action at this time.
0 commit comments