Commit 9abe67fb authored by alexandre's avatar alexandre

toc in the help

parent ea23a88d
......@@ -28,6 +28,33 @@
.nextUntil("h3, h2, h1")
.wrapAll('<div class="help__inner"></div>');
});
// Taken from <https://gist.github.com/mathewbyrne/1280286>
function slugify(text) {
return text
.toString()
.toLowerCase()
.normalize('NFD').replace(/[\u0300-\u036f]/g, "") // strip accents
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
var $toc = $('<ol class="help__toc"></ol>')
$("h2").each(function() {
var txt = $(this).text();
var id = slugify(txt);
$(this).attr('id', id);
var $li = $('<li></li>');
var $a = $('<a></a>').attr('href', '#' + id).text(txt);
$li.append($a);
$toc.append($li);
});
$toc.insertBefore($("h2").first());
</script>
</body>
</html>
......@@ -1199,6 +1199,35 @@ li .icon--tag { color: white } */
max-width: 100%;
}
.help__toc {
/* position: sticky; */
/* top: 0; */
/* background-color: white; */
border-bottom: 2px solid;
margin-left: 84pt!important;
padding-bottom: 14pt;
/* padding-top: 14pt; */
margin-bottom: 28pt;
text-indent: 0!important;
font-weight: bold;
/* background-color: #173a42; */
/* color: white; */
/* padding: 14pt; */
}
.help__toc li {
display: inline-block;
margin-right: 1em;
}
.help__toc li::before {
content: "";
}
.help__toc li + li::before {
/* content: " | "; */
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment