Skip to content
This repository has been archived by the owner on Sep 13, 2022. It is now read-only.

Commit

Permalink
Release v1.0.3
Browse files Browse the repository at this point in the history
* line-height: 0;
  • Loading branch information
1v9 committed Aug 4, 2019
1 parent cce8ce9 commit 6fba86b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion anchor.styl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ margin = unquote(hexo-config('anchor.margin'));

a.heading-anchor {
color: unquote(hexo-config('anchor.color'));
line-height: normal;
line-height: 0;
border-bottom: none;
}
11 changes: 5 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ hexo.extend.filter.register('after_post_render', data => {
if (!theme.anchor.enable) return;

const $ = cheerio.load(data.content, { decodeEntities: false });

let headings = $('h1, h2, h3, h4, h5, h6');
if (!headings.length) return data;
const headings = $('h1, h2, h3, h4, h5, h6');
if (!headings.length) return;

const position = theme.anchor.position;

headings.each((x, y) => {
let id = $(y).attr('id');
let p = $(y).addClass('heading-control');
Array.from(headings).forEach(x => {
let id = $(x).attr('id');
let p = $(x).addClass('heading-control');
if (position === 'left') {
p.prepend('<a class="heading-anchor" href="#' + id + '" aria-hidden="true"></a>');
} else if (position === 'right') {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hexo-theme-next-anchor",
"version": "1.0.2",
"version": "1.0.3",
"description": "A NexT plugin that adds an anchor to every heading.",
"main": "index.js",
"repository": {
Expand Down

0 comments on commit 6fba86b

Please sign in to comment.