sass-site/source/assets/css/foundation/_code.scss

60 lines
1.2 KiB
SCSS
Raw Normal View History

%code-theme {
2018-10-24 00:06:39 +02:00
border-radius: 4px;
background: rgba($black, .0625);
color: $color-text-strong;
2018-10-24 00:06:39 +02:00
a & { color: darken($color-primary, 10%); }
}
2013-10-09 12:30:53 +02:00
code,
pre {
@extend %code-theme;
2013-10-09 12:30:53 +02:00
font: {
2018-10-24 00:06:39 +02:00
size: 87.50%;
2013-10-09 12:30:53 +02:00
weight: $font-weight-regular;
family: $font-family-code;
}
white-space: pre-wrap;
2018-10-24 00:06:39 +02:00
strong & { font-weight: $font-weight-bold; }
2013-02-09 04:10:33 +01:00
}
code {
2018-10-24 00:06:39 +02:00
display: inline-block;
padding: 0 .5em;
2012-11-28 17:23:08 +01:00
}
%pre-block {
@include rhythm(0, .5, .5, 0);
padding: {
right: 1em;
left: 1em;
}
display: block;
}
2012-11-28 17:23:08 +01:00
pre {
@extend %pre-block;
2013-10-09 12:30:53 +02:00
@include trailer;
@include rhythm(.5, .5, .5, .5);
2013-10-13 01:26:11 +02:00
@include bleed(1em);
// It's important that this be 22px so that we can easily compute the extra
// padding necessary to align sections in code examples. 22px is the line
// height (24px) minus the borders (2px) of a section, which means we can just
// add an extra line to sections to make them align.
margin: auto 0 22px;
2013-02-09 04:10:33 +01:00
2013-10-09 12:30:53 +02:00
// Account for some code outputs that place code tags in pre tags
2013-02-24 07:04:16 +01:00
code {
2013-10-09 12:30:53 +02:00
@extend %reset-padding;
2014-07-31 07:34:47 +02:00
border: 0;
2013-02-24 07:04:16 +01:00
background: none;
2013-10-09 12:30:53 +02:00
font-size: inherit;
line-height: inherit;
2013-02-24 07:04:16 +01:00
}
&.highlight .err {
background: none;
}
2013-02-24 07:04:16 +01:00
}