Skip to content

Instantly share code, notes, and snippets.

@desero
Created March 19, 2019 13:46
Show Gist options
  • Select an option

  • Save desero/1eedebbc4339193e57656acc9fd72945 to your computer and use it in GitHub Desktop.

Select an option

Save desero/1eedebbc4339193e57656acc9fd72945 to your computer and use it in GitHub Desktop.
import Sticky from 'sticky-js'
const sticky = new Sticky('.sticky')
<div class="toc" data-sticky-container>
<aside class="toc-content sticky">
{{ if .Params.toc }}
<p class="b">What's on this Page</p>
{# thanks to https://stackoverflow.com/a/50919835 #}
{{ .TableOfContents | replaceRE "<ul>[[:space:]]*<li>[[:space:]]*<ul>" "<ul>" | replaceRE "</ul>[[:space:]]*</li>[[:space:]]*</ul>" "</ul>" | safeHTML }}
{{ end }}
{# ... #}
</aside>
</div>
$cyan: #0092FF;
.toc-content {
width: 100%;
padding-top: 20px;
.b {
font-weight: 700;
}
a {
font-size: 14px;
line-height: 20px;
text-decoration: none;
&:hover {
text-decoration: underline;
.particle {
text-decoration: none;
}
}
}
nav {
border-left: 3px solid lighten($cyan, 55%);
margin-top: 20px;
padding-left: 20px;
}
ul {
list-style: none;
margin-bottom: 20px;
li {
margin-bottom: 10px;
line-height: 20px;
}
ul {
margin-left: 10px;
margin-top: 10px;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment