Skip to content

Commit

Permalink
feat(title): add anchor
Browse files Browse the repository at this point in the history
  • Loading branch information
olOwOlo committed Nov 5, 2018
1 parent f4bcf93 commit 8d39099
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/css/_iconfont.scss
Expand Up @@ -137,6 +137,9 @@
.icon-close:before {
content: "\e60f";
}
.icon-link:before {
content: "\e909";
}

/* Admonition Icon */
/*
Expand Down
26 changes: 26 additions & 0 deletions src/css/_partial/_post/_content.scss
Expand Up @@ -9,6 +9,32 @@
h#{$i} {
font-weight: 400;
font-family: $global-serif-font-family;

.anchor {
float: left;
line-height: 1;
margin-left: -20px;
padding-right: 4px;

&:hover {
border-bottom: initial;
}

.icon-link {
visibility: hidden;
font-size: 16px;

&:before {
vertical-align: middle;
}
}
}

&:hover {
.icon-link {
visibility: visible;
}
}
}
}

Expand Down
Binary file modified src/fonts/iconfont/iconfont.eot
Binary file not shown.
1 change: 1 addition & 0 deletions src/fonts/iconfont/iconfont.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/fonts/iconfont/iconfont.ttf
Binary file not shown.
Binary file modified src/fonts/iconfont/iconfont.woff
Binary file not shown.
2 changes: 1 addition & 1 deletion src/js/even.js
Expand Up @@ -213,7 +213,7 @@ Even._linkToc = function() {
const headers = document.querySelectorAll('.post-content>h' + num);
for (let i = 0; i < headers.length; i++) {
const header = headers[i];
header.innerHTML = `<a href="#${header.id}" class="headerlink"></a>${header.innerHTML}`;
header.innerHTML = `<a href="#${header.id}" class="headerlink anchor"><i class="iconfont icon-link"></i></a>${header.innerHTML}`;
}
}
};
Expand Down

0 comments on commit 8d39099

Please sign in to comment.