Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update anchor.js and small hack to ignore some anchors #10

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from
32 changes: 32 additions & 0 deletions anchors.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,39 @@ public function onTwigSiteVariables()
$class
$truncate
};
// LO Hack: allow content to be hidden from the anchor
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put this in the README.md, not in the comments in the code. Also people don't like to see the word "hack" as it has negative connotations :)

// usefull for instance when anchor is used with the prettyprint plugin activated
// juste add the css class 'hideFromAnchorJS' to the elements to hide

// store and empty every content that need to be hidden in anchorJS
/*
var content=[];
$('.hideFromAnchorJS').each( function(){
content.unshift($(this).html());
$(this).empty();
} );
*/
/*
anchors.add('.e-content > h1');
anchors.add('.e-content > h2');
anchors.add('.e-content > h3');
anchors.add('.e-content > h4');

anchors.add('.list-blog-header > h1');
anchors.add('.list-blog-header > h2');
anchors.add('.list-blog-header > h3');
anchors.add('.list-blog-header > h4');
*/

// we generate the anchor list
anchors.add('$selectors');

/*
// restore the deleted content
$('.hideFromAnchorJS').each( function(){
$(this).html(content.shift());
} );
*/
});";


Expand Down
2 changes: 1 addition & 1 deletion blueprints.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Anchors
name: Anchors (FORKED)
version: 1.5.1
description: "This plugin provides automatic header anchors via the [anchorjs](http://bryanbraun.github.io/anchorjs) jQuery plugin."
icon: anchor
Expand Down
6 changes: 3 additions & 3 deletions js/anchor.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.