packages/vremark-toc/mdast-util-toc/lib/index.js
function toc(node, options) {
    var settings = options || {};
    var heading = settings.heading ? toExpression(settings.heading) : null;
    var result = search(node, heading, settings.maxDepth || 6);
    var map = result.map;

    result.map = map.length === 0 ? null : contents(map, settings.tight);

    /* No given heading */
    if (!heading) {
        result.index = null;
        result.endIndex = null;
    }

    return result;
}
function toc(node, options) {
    var settings = options || {};
    var heading = settings.heading ? toExpression(settings.heading) : null;
    var result = search(node, heading, settings.maxDepth || 6);
    var map = result.map;

    result.map = map.length === 0 ? null : contents(map, settings.tight);

    /* No given heading */
    if (!heading) {
        result.index = null;
        result.endIndex = null;
    }

    return result;
}
function toc ( node , options ) { var settings = options || { } ; var heading = settings . heading ? toExpression ( settings . heading ) : null ; var result = search ( node , heading , settings . maxDepth || 6 ) ; var map = result . map ; result . map = map . length === 0 ? null : contents ( map , settings . tight ) ; /* No given heading */ if ( ! heading ) { result . index = null ; result . endIndex = null ; } return result ; }
Get a TOC representation of `node`.

@param {Mdast} node - MDAST.
@param {Object} options - Configuration.
@return {Array} - TOC Markdown.
Get a TOC representation of node .