src/transformers/toc.js
function getTocNode (tree) {
  const tocNode = toc(tree, { maxDepth: 3, loose: false })

  if (!tocNode.map || !tocNode.map.children[0] || !tocNode.map.children[0].children[1]) {
    return
  }

  return {
    type: 'TocNode',
    data: {
      hName: 'div',
      hProperties: {
        className: ['toc-container']
      }
    },
    children: [
      {
        type: 'TocTitleNode',
        data: {
          hName: 'h2'
        },
        children: [{ type: 'text', value: 'Table of contents' }]
      },
      tocNode.map.children[0].children[1]
    ]
  }
}
function getTocNode (tree) {
  const tocNode = toc(tree, { maxDepth: 3, loose: false })

  if (!tocNode.map || !tocNode.map.children[0] || !tocNode.map.children[0].children[1]) {
    return
  }

  return {
    type: 'TocNode',
    data: {
      hName: 'div',
      hProperties: {
        className: ['toc-container']
      }
    },
    children: [
      {
        type: 'TocTitleNode',
        data: {
          hName: 'h2'
        },
        children: [{ type: 'text', value: 'Table of contents' }]
      },
      tocNode.map.children[0].children[1]
    ]
  }
}
function getTocNode ( tree ) { const tocNode = toc ( tree , { maxDepth : 3 , loose : false } ) if ( ! tocNode . map || ! tocNode . map . children [ 0 ] || ! tocNode . map . children [ 0 ] . children [ 1 ] ) { return } return { type : 'TocNode' , data : { hName : 'div' , hProperties : { className : [ 'toc-container' ] } } , children : [ { type : 'TocTitleNode' , data : { hName : 'h2' } , children : [ { type : 'text' , value : 'Table of contents' } ] } , tocNode . map . children [ 0 ] . children [ 1 ] ] } }
Returns the node for TOC

@method getTocNode

@param  {Object}   tree

@return {Object}
Returns the node for TOC