Generates an anchor for a markdown header.

npm install anchor-markdown-header
5 downloads in the last day
71 downloads in the last week
200 downloads in the last month

anchor-markdown-header build status

Generates an anchor for a markdown header.


var anchor = require('anchor-markdown-header');

anchor('"playerJoined" (player)'); 
// --> ["playerJoined" (player)](#playerjoined-player)

anchor('fs.rename(oldPath, newPath, [callback])', '', 'fs') 
// --> [fs.rename(oldPath, newPath, [callback])](#fs_fs_rename_oldpath_newpath_callback)

// mode is default
anchor('"playerJoined" (player)') === anchor('"playerJoined" (player)', ''); 
// --> true


anchor(header[, mode] [, moduleName] [, repetition)

 * @name anchorMarkdownHeader
 * @function
 * @param header      {String} The header to be anchored.
 * @param mode        {String} The anchor mode (''|'|').
 * @param repetition  {Number} The nth occurrence of this header text, starting with 0. Not required for the 0th instance.
 * @param moduleName  {String} The name of the module of the given header (required only for '' mode).
 * @return            {String} The header anchor that is compatible with the given mode.
npm loves you