Skip to content
/ hanchor Public

⚓️ Autogenerate links to header tags from header text

License

Notifications You must be signed in to change notification settings

rod/hanchor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hanchor

Build Status David David

Autogenerate links to header tags from header text

Installation

$ npm install --save hanchor

Usage

The quickest way to begin using hanchor is to include it in the <head> of your HTML document.

<head>
  <script src="https://unpkg.com/[email protected]" />
</head>
<html>
  ...
  <script type="text/javascript">
    (function() {
      hanchor.init('article');
    })();
  </script>
  ...
</html>

API

hanchor(scope, [options])

scope

Type: stringor object, Default: 'body'

The DOM element that header linking is scoped to.

options.content

Type: string, Default: '#'

The content of the header tag link.

options.className

Type: string or false, Default: false

Class to be assigned to the header tag links.

options.position

Type: string, Default: 'beforeend'

Position the link 'beforebegin', 'afterbegin', 'beforeend' or 'afterend' in reference to the the header tag.

License

MIT © Rodney Dennis

About

⚓️ Autogenerate links to header tags from header text

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published