mirror of
https://github.com/alex-shpak/hugo-book.git
synced 2024-11-22 03:19:25 +00:00
Add anchors to headings
This commit is contained in:
parent
1608ade3f4
commit
aa7c486e76
@ -1,33 +1,53 @@
|
||||
@import 'variables';
|
||||
@import "variables";
|
||||
|
||||
.markdown {
|
||||
line-height: 1.6em;
|
||||
line-height: 1.6;
|
||||
|
||||
// remove padding at the beginning of page
|
||||
> :first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
font-weight: normal;
|
||||
line-height: 1em;
|
||||
line-height: 1;
|
||||
margin-top: 1.5em;
|
||||
margin-bottom: $padding-16;
|
||||
|
||||
a.anchor {
|
||||
display: none;
|
||||
font-size: .75em;
|
||||
vertical-align: middle;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
h4, h5, h6 {
|
||||
&:hover a.anchor {
|
||||
display: initial;
|
||||
}
|
||||
}
|
||||
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
h5 {
|
||||
font-size: .875em;
|
||||
font-size: 0.875em;
|
||||
}
|
||||
|
||||
h6 {
|
||||
font-size: .75em;
|
||||
font-size: 0.75em;
|
||||
}
|
||||
|
||||
b, optgroup, strong {
|
||||
b,
|
||||
optgroup,
|
||||
strong {
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
@ -50,7 +70,7 @@
|
||||
padding: 0 $padding-4;
|
||||
background: $gray-200;
|
||||
border-radius: $border-radius;
|
||||
font-size: .875em;
|
||||
font-size: 0.875em;
|
||||
}
|
||||
|
||||
pre {
|
||||
@ -72,8 +92,12 @@
|
||||
border-inline-start: $padding-4 solid $gray-200;
|
||||
border-radius: $border-radius;
|
||||
|
||||
:first-child { margin-top: 0; }
|
||||
:last-child { margin-bottom: 0; }
|
||||
:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
table {
|
||||
@ -84,7 +108,8 @@
|
||||
margin-top: $padding-16;
|
||||
margin-bottom: $padding-16;
|
||||
|
||||
tr th, tr td {
|
||||
tr th,
|
||||
tr td {
|
||||
padding: $padding-8 $padding-16;
|
||||
border: $padding-1 solid $gray-200;
|
||||
}
|
||||
@ -100,7 +125,8 @@
|
||||
background: $gray-200;
|
||||
}
|
||||
|
||||
ul, ol {
|
||||
ul,
|
||||
ol {
|
||||
padding-inline-start: $padding-16 * 2;
|
||||
}
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
{"Target":"book.min.e161f1fe2b283b6a43c29a52fde96e2387fade573e78efa6701d44c8499da76b.css","MediaType":"text/css","Data":{"Integrity":"sha256-4WHx/isoO2pDwppS/eluI4f63lc+eO+mcB1EyEmdp2s="}}
|
||||
{"Target":"book.min.947656565f9248015f7b2c792cb8b8c13ad749e25295c0634f4c7f1d1bde6a0a.css","MediaType":"text/css","Data":{"Integrity":"sha256-lHZWVl+SSAFfeyx5LLi4wTrXSeJSlcBjT0x/HRveago="}}
|
4
layouts/_default/_markup/render-heading.html
Normal file
4
layouts/_default/_markup/render-heading.html
Normal file
@ -0,0 +1,4 @@
|
||||
<h{{ .Level }} id="{{ .Anchor | safeURL }}">
|
||||
{{ .Text | safeHTML }}
|
||||
<a class="anchor" href="#{{ .Anchor | safeURL }}">#</a>
|
||||
</h{{ .Level }}>
|
@ -6,7 +6,7 @@
|
||||
|
||||
{{- define "portable-link" -}}
|
||||
{{- $destination := .Destination }}
|
||||
{{- $isRemote := or (in .Destination "://") (strings.HasPrefix .Destination "//") }}
|
||||
{{- $isRemote := or (in .Destination ":") (strings.HasPrefix .Destination "//") }}
|
||||
{{- if not $isRemote }}
|
||||
{{- $url := urls.Parse .Destination }}
|
||||
{{- $path := strings.TrimSuffix "/_index.md" $url.Path }}
|
||||
|
Loading…
Reference in New Issue
Block a user