function buildNav(members, navTypes = null, betterDocs) {
  const href = betterDocs.landing ? 'docs.html' : 'index.html'
  var nav = navTypes ? '' : `<h2><a href="${href}">Documentation</a></h2>`

  var categorised = {}
  var rootScope = {}

  var types = navTypes || ['modules', 'externals', 'namespaces', 'classes',
    'components', 'interfaces', 'events', 'mixins', 'globals']
  types.forEach(function(type) {
    if (!members[type]) { return }
    members[type].forEach(function(element) {
      if (element.access && element.access === 'private') {
        return
      }
      if (element.category) {
        if (!categorised[element.category]){ categorised[element.category] = [] }
        if (!categorised[element.category][type]){ categorised[element.category][type] = [] }
        categorised[element.category][type].push(element)
      } else {
        rootScope[type] ? rootScope[type].push(element) : rootScope[type] = [element]
      }
    })
  })
    
  nav += buildGroupNav(rootScope)
  Object.keys(categorised).sort().forEach(function (category) {
    nav += buildGroupNav(categorised[category], category)
  })

  return nav
}
Create the navigation sidebar.
@param {object} members The members that will be used to create the sidebar.
@param {array<object>} members.classes
@param {array<object>} members.components
@param {array<object>} members.externals
@param {array<object>} members.globals
@param {array<object>} members.mixins
@param {array<object>} members.modules
@param {array<object>} members.namespaces
@param {array<object>} members.tutorials
@param {array<object>} members.events
@param {array<object>} members.interfaces
@return {string} The HTML for the navigation sidebar.