diff --git a/mkdocs/build.py b/mkdocs/build.py index 6b3ee29e..3bd718c8 100644 --- a/mkdocs/build.py +++ b/mkdocs/build.py @@ -126,6 +126,8 @@ def get_context(page, content, nav, toc, meta, config): 'extra_css': config['extra_css'], 'extra_javascript': config['extra_javascript'], + 'include_nav': config['include_nav'], + 'include_next_prev': config['include_next_prev'], 'include_search': config['include_search'], } @@ -166,12 +168,10 @@ def build_pages(config): utils.write_file(output_content.encode('utf-8'), output_path) -def build(config): def build(config, live_server=False): """ Perform a full site build. """ - print "Building documentation to directory: %s" % config['site_dir'] if not live_server: print "Building documentation to directory: %s" % config['site_dir'] utils.copy_media_files(config['theme_dir'], config['site_dir']) diff --git a/mkdocs/config.py b/mkdocs/config.py index 0259394c..82e94ad0 100644 --- a/mkdocs/config.py +++ b/mkdocs/config.py @@ -20,16 +20,35 @@ DEFAULT_CONFIG = { 'site_dir': 'site', 'theme_dir': None, + # The address on which to serve the livereloading docs servers. 'dev_addr': '127.0.0.1:8000', + + # If `True`, use `/index.hmtl` style files with hyperlinks to the directory. + # If `False`, use `.html style file with hyperlinks to the file. + # True generates nicer URLs, but False is useful if browsing the output on a filesystem. 'use_direcory_urls': True, + # Specify a link to the project source repo to be included + # in the documentation pages. 'repo_url': None, + + # A name to use for the link to the project source repo. + # Default: If repo_url is unset then None, otherwise + # "GitHub" or "Bitbucket" for known url or Hostname for unknown urls. 'repo_name': None, + # Specify which css or javascript files from the docs + # directionary should be additionally included in the site. + # Default: List of all .css and .js files in the docs dir. 'extra_css': None, 'extra_javascript': None, - # These are not yet supported... + # Determine if the site should include the nav and next/prev elements. + # Default: True if the site has more than one page, False otherwise. + 'include_nav': None, + 'include_next_prev': None, + + # To Do 'include_search': False, 'include_404': False, 'include_sitemap': False @@ -97,4 +116,21 @@ def validate_config(user_config): else: config['repo_name'] = repo_host.split('.')[0].title() + if config['include_next_prev'] is None: + config['include_next_prev'] = len(config['pages']) > 1 + + if config['include_nav'] is None: + config['include_nav'] = len(config['pages']) > 1 + + # To Do: + + # The docs dir must exist. + # The theme dir must exist. + # Ensure 'theme' is one of 'mkdocs', 'readthedocs', 'custom' + # A homepage 'index' must exist. + # The theme 'base.html' file must exist. + # Cannot set repo_name without setting repo_url. + # Cannot set 'include_next_prev: true' when only one page exists. + # Cannot set 'include_nav: true' when only one page exists. + return config diff --git a/mkdocs/themes/mkdocs/nav.html b/mkdocs/themes/mkdocs/nav.html index 1cb451f8..0b4dc2b8 100644 --- a/mkdocs/themes/mkdocs/nav.html +++ b/mkdocs/themes/mkdocs/nav.html @@ -3,6 +3,7 @@