1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-03 15:16:40 -04:00

add copy-to-clipboard button to code fences

This commit is contained in:
2021-08-16 08:08:56 -04:00
parent 86ded40854
commit fdb9532cc5
5 changed files with 119 additions and 31 deletions

View File

@ -32,6 +32,7 @@ div.highlight {
overflow-x: scroll;
margin: 1em 0;
border: 1px solid;
position: relative;
pre {
padding-left: 1.5em;
@ -42,6 +43,25 @@ div.highlight {
> pre > code {
padding-right: 1.5em;
}
button.copy-button {
position: absolute;
top: 0;
right: 0;
z-index: 2;
cursor: pointer;
width: 5em;
padding: 0.75em 0.25em;
font-size: 0.9em;
font-weight: 500;
background: transparent;
border-top: 0;
border-right: 0;
border-left: 1px solid;
border-bottom: 1px solid;
}
}
// global table styles for line numbers and font styles
@ -95,6 +115,7 @@ div.highlight {
/*! Syntax Highlighting (light) - modified from Monokai Light: https://github.com/mlgill/pygments-style-monokailight */
body.light {
div.highlight,
button.copy-button,
:not(pre) > code {
color: #313131;
background-color: #fbfbfb;
@ -170,6 +191,7 @@ body.light {
/*! Syntax Highlighting (dark) - modified from Dracula: https://github.com/dracula/pygments */
body.dark {
div.highlight,
button.copy-button,
:not(pre) > code {
color: #e4e4e4;
background-color: #252525;