1
0
mirror of https://github.com/bigchaindb/site.git synced 2024-12-24 02:16:10 +01:00

auto-link markdown headings

This commit is contained in:
Matthias Kretschmann 2016-01-17 16:43:46 +01:00
parent ba11e3f50c
commit fbd195a460
2 changed files with 30 additions and 0 deletions

View File

@ -28,4 +28,18 @@ jQuery(function($) {
}
);
//
// Automatically add header links to all Markdown headings
//
$('.content--page--markdown h1, .content--page--markdown h2').each(function(i, el) {
var $el, icon, id;
$el = $(el);
id = $el.attr('id');
icon = '<i class="header-icon">#</i>';
if (id) {
return $el.prepend($('<a />').addClass('header-link').attr('href', '#' + id).html(icon));
}
});
});

View File

@ -17,5 +17,21 @@
padding-bottom: $spacer;
margin-bottom: ($spacer * 2);
text-align: center;
.header-link {
@extend .transition;
transition-timing-function: $timing-bounce;
display: inline-block;
padding: 0 .5rem;
opacity: 0;
transform: translate3d(20px,0,0) scale(0);
.header-icon { font-style: normal; }
}
&:hover .header-link {
opacity: 1;
transform: translate3d(0,0,0) scale(.8);
}
}
}