Skip to content

Commit

Permalink
feat: show heading anchors on hover
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang committed Jul 6, 2022
1 parent a05fc97 commit 1440a36
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions assets/main/scss/post/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@

h6, .h6, h5, .h5, h4, .h4, h3, .h3, h2, .h2, h1, .h1 {
margin-bottom: 1rem;

&:hover {
.anchor {
display: inline-block !important;
}
}
}

ol, ul {
Expand Down
2 changes: 1 addition & 1 deletion layouts/_default/_markup/render-heading.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
{{- $anchor := printf "<a class=\"anchor ms-1\" href=\"#%s\">#</a>" .Anchor | safeHTML -}}
{{- $anchor := printf "<a class=\"anchor ms-1 d-none\" href=\"#%s\">#</a>" .Anchor | safeHTML -}}
{{ printf "<h%d id=\"%s\">%s%s</h%d>" .Level .Anchor .PlainText $anchor .Level | safeHTML }}

0 comments on commit 1440a36

Please sign in to comment.