add anchor links to content sub-headings

forked anchor-js: https://github.com/jakejarvis/simple-anchor
This commit is contained in:
jake committed 2021-08-30 14:01:13 -04:00
1 parent 5e3507a594
commit 1ed75bb763
6 files changed
+108 -69

No files matched your search

+1
View File
@@ -2,6 +2,7 @@ import "./src/dark-mode.js";
import "./src/emoji.js";
import "./src/counter.js";
import "./src/clipboard.js";
import "./src/anchor.js";
import "./src/projects.js";
export default () => {};
+7
View File
@@ -0,0 +1,7 @@
import SimpleAnchor from "simple-anchor";
const anchors = new SimpleAnchor({
icon: "",
});
anchors.add("article #content h2, article #content h3, article #content h4");
+29
View File
@@ -55,6 +55,35 @@ div#content {
padding-left: 0.25em;
}
}
// AnchorJS styles
h2,
h3,
h4 {
a.anchorjs-link {
display: inline-block;
margin-left: 0.25em;
padding-left: 0.25em;
padding-right: 0.5em;
opacity: 0;
font-weight: 300;
background: none;
&::before {
content: "\0023"; // pound sign
}
@include themes.themed(color, "medium-light");
&:hover {
@include themes.themed(color, "links");
}
}
&:hover > a.anchorjs-link {
opacity: 1;
}
}
}
// Responsive