Example: https://gemstone.github.io/expressions/Test
Add the default.html
file, below, to the myrepo/docs/_layouts/
folder, creating the folder if needed.
This requires the anchor_headings.html
in the myrepo/docs/_includes/
folder from here:
Key components are:
<style>
h1 {
margin-left: -20px;
padding-left: 10px;
}
h2 {
margin-left: -18px;
padding-left: 10px;
}
h3 {
margin-left: -16px;
padding-left: 10px;
}
h4 {
margin-left: -14px;
padding-left: 10px;
}
h5 {
margin-left: -12px;
padding-left: 10px;
}
h6 {
margin-left: -10px;
padding-left: 10px;
}
h1 .octicon, h2 .octicon, h3 .octicon, h4 .octicon, h5 .octicon, h6 .octicon {
visibility: hidden;
}
h1:hover .octicon, h2:hover .octicon, h3:hover .octicon, h4:hover .octicon, h5:hover .octicon, h6:hover .octicon {
visibility: visible;
}
.octicon {
fill: currentColor;
padding: 0;
margin-left: -16px;
vertical-align: middle;
}
</style>
And anchorBody
like so:
{% include anchor_headings.html html=content beforeHeading=true anchorBody="<svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg>" %}
Is it possible to get this working nicely with underlined headings? E.g.,
Also, when the
<div>
around the heading has padding, the alignment of the heading breaks: