docs-v2/assets/styles/layouts/article/_code.scss

107 lines
2.1 KiB
SCSS

//////////////////////////////////// Code ////////////////////////////////////
code,pre {
background: $article-code-bg;
font-family: $code;
color: $article-code;
}
p,li,table {
code {
padding: .1rem .4rem .2rem;
border-radius: $radius;
color: $article-code;
white-space: nowrap;
font-size: 1rem;
font-style: normal;
}
}
// Don't allow code formatting in headings
h1,h2,h3,h4,h5,h6 {
code {
padding: inherit !important;
background: inherit !important;
font-size: inherit !important;
font-weight: inherit !important;
font-family: $rubik;
color: inherit !important;
}
}
a {
code {
font-weight: normal;
transition: color .2s;
position: relative;
color: $article-code-link;
&:after {
content: "";
position: absolute;
display: block;
top: 0;
right: 0;
border-style: solid;
border-width: 0 .4rem .4rem 0;
border-color: transparent rgba($article-code-link, .35) transparent transparent;
transition: border .2s;
}
}
&:hover {
code {
color: $article-code-link-hover;
&:after {
border-color: transparent $article-link-hover transparent transparent;
}
}
}
}
pre {
margin: 2rem 0 2.25rem;
padding: 1.75rem 1.75rem 1.25rem;
border-radius: $radius;
overflow-x: scroll;
overflow-y: hidden;
font-size: 1rem;
code {
padding: 0;
line-height: 1.7rem;
white-space: pre;
}
@import "code-api-methods";
}
///////////////////////// Codeblocks fullscreen toggle /////////////////////////
.codeblock {
position: relative;
.fullscreen-toggle {
cursor: pointer;
position: absolute;
top: .5rem;
right: .5rem;
line-height: 0;
font-size: 1.15rem;
color: $article-code;
opacity: .5;
transition: opacity .2s;
&:hover {opacity: 1}
}
}
////////////////////////////////////////////////////////////////////////////////
///////////////////////////////// MEDIA QUERIES ////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
@include media(small) {
pre {
padding: 1.2em 1.2em .75rem;
}
}