docs: def gendocs(ctx,
              source=None,
              outputpath="",
              extra=False,
              lib=False,
              type="",
              title="",
              theme="",
              showthemes=False,
              showtypes=False):
      """GENDOCS: generate documentation in html or markdown format.
      """
      verbose = ctx.obj['VERBOSE']
      sTime = ctx.obj['STIME']
      print_opts = {
          'labels': verbose,
      }
  
      from .ontodocs.builder import show_themes, random_theme, show_types
  
      try:
          # check that we have the required dependencies
          import django
      except:
          click.secho(
              "WARNING: this functionality requires the Django package and other extra dependecies.",
              fg="red")
          click.secho("Install with `pip install ontospy[HTML] -U`")
          sys.exit(0)
  
      if not source and not showthemes and not showtypes and not lib:
          click.echo(ctx.get_help())
          return
  
      if showthemes:
          show_themes()
          sys.exit(0)
  
      if showtypes:
          show_types()
          sys.exit(0)
  
      if theme and theme == "random":
          theme = random_theme()
  
      if outputpath:
          if not (os.path.exists(outputpath)) or not (os.path.isdir(outputpath)):
              click.secho(
                  "WARNING: the -o option must include a valid directory path.",
                  fg="red")
              sys.exit(0)
  
      if source and len(source) > 1:
          click.secho(
              'Note: currently only one argument can be passed', fg='red')
  
      if lib:
          click.secho("Local library => '%s'" % get_home_location(), fg='white')
          ontouri = action_listlocal(all_details=False)
          if ontouri:
              source = [os.path.join(get_home_location(), ontouri)]
          else:
              raise SystemExit(1)
  
      # note: the local ontospy library gets displayed via this method too
      url = action_visualize(
          source,
          fromshell=False,
          path=outputpath,
          title=title,
          viztype=type,
          theme=theme,
          verbose=verbose)
  
      if url:  # open browser
          import webbrowser
          webbrowser.open(url)
  
      eTime = time.time()
      tTime = eTime - sTime
      printDebug("\n-----------\n" + "Time:	   %0.2fs" % tTime, "comment")