hugo-book/assets/_markdown.scss
2020-04-21 22:30:00 +02:00

157 lines
2.5 KiB
SCSS

@import 'variables';
.markdown {
line-height: 1.6em;
// remove padding at the beginning of page
> :first-child {
margin-top: 0;
}
h1, h2, h3, h4, h5, h6 {
font-weight: normal;
line-height: 1em;
margin-top: 1.5em;
margin-bottom: $padding-16;
}
h4, h5, h6 {
font-weight: bolder;
}
h5 {
font-size: .875em;
}
h6 {
font-size: .75em;
}
b, optgroup, strong {
font-weight: bolder;
}
a {
text-decoration: none;
&:hover {
text-decoration: underline;
}
&:visited {
color: $color-visited-link;
}
}
img {
max-width: 100%;
}
code {
padding: 0 $padding-4;
background: $gray-200;
border-radius: $border-radius;
font-size: .875em;
}
pre {
padding: $padding-16;
background: $gray-100;
border-radius: $border-radius;
overflow-x: auto;
code {
padding: 0;
background: none;
}
}
blockquote {
margin: $padding-16 0;
padding: $padding-8 $padding-16 $padding-8 ($padding-16 - $padding-4); //to keep total left space 16dp
border-left: $padding-4 solid $gray-200;
border-radius: $border-radius;
:first-child { margin-top: 0; }
:last-child { margin-bottom: 0; }
}
table {
overflow: auto;
display: block;
border-spacing: 0;
border-collapse: collapse;
margin-top: $padding-16;
margin-bottom: $padding-16;
tr th, tr td {
padding: $padding-8 $padding-16;
border: $padding-1 solid $gray-200;
}
tr:nth-child(2n) {
background: $gray-100;
}
}
hr {
height: $padding-1;
border: none;
background: $gray-200;
}
ul, ol {
padding-left: $padding-16 * 2;
}
dl {
dt {
font-weight: bolder;
margin-top: $padding-16;
}
dd {
margin-left: $padding-16 * 2;
}
}
// Special case for highlighted code with line numbers
.highlight table tr {
td:nth-child(1) pre {
margin: 0;
padding-right: 0;
}
td:nth-child(2) pre {
margin: 0;
padding-left: 0;
}
}
details {
padding: $padding-16;
border: $padding-1 solid $gray-200;
border-radius: $border-radius;
summary {
line-height: 1;
padding: $padding-16;
margin: -$padding-16;
cursor: pointer;
}
&[open] summary {
margin-bottom: 0;
}
}
}
.markdown-inner {
// Util class to remove extra margin in nested markdown content
> :first-child {
margin-top: 0;
}
> :last-child {
margin-bottom: 0;
}
}