lib/toc.js
function (headerText, prevToken) {
        if (prevToken && prevToken.type === 'paragraph' && utils.isHtml(prevToken.text)) {
            var anchorFromHtml = utils.getAnchorFromHtml(prevToken.text);
            if (anchorFromHtml) {
                return anchorFromHtml;
            }
        }

        var anchor = utils.getAnchorFromHeader(headerText, prevToken);

        if (this._cache.hasOwnProperty(anchor)) {
            anchor += '-' + this._cache[anchor]++;
        } else {
            this._cache[anchor] = 1;
        }

        return anchor;
    }
function (headerText, prevToken) {
        if (prevToken && prevToken.type === 'paragraph' && utils.isHtml(prevToken.text)) {
            var anchorFromHtml = utils.getAnchorFromHtml(prevToken.text);
            if (anchorFromHtml) {
                return anchorFromHtml;
            }
        }

        var anchor = utils.getAnchorFromHeader(headerText, prevToken);

        if (this._cache.hasOwnProperty(anchor)) {
            anchor += '-' + this._cache[anchor]++;
        } else {
            this._cache[anchor] = 1;
        }

        return anchor;
    }
function ( headerText , prevToken ) { if ( prevToken && prevToken . type === 'paragraph' && utils . isHtml ( prevToken . text ) ) { var anchorFromHtml = utils . getAnchorFromHtml ( prevToken . text ) ; if ( anchorFromHtml ) { return anchorFromHtml ; } } var anchor = utils . getAnchorFromHeader ( headerText , prevToken ) ; if ( this . _cache . hasOwnProperty ( anchor ) ) { anchor += '-' + this . _cache [ anchor ] ++ ; } else { this . _cache [ anchor ] = 1 ; } return anchor ; }
Returns an anchor for a given header
@param {String} headerText
@returns {String}
Returns an anchor for a given header