Skip to main content

This is a small plugin for the excellent MkDocs project which makes some enhancements to the navigation.

Project description

MkDocs Nav Enhancements

This is a small plugin for the excellent MkDocs project which makes some enhancements to the navigation.

Features

Enhanced titles

By default, MkDocs looks for a level 1 atx-style header found at the top of the document and uses that for the page title.

If you are dealing with documentation from third-party sources you may find that some of them start their titles at level 2 (possibly for aesthetic reasons), or use setext-style headers instead.

This plugin will try to help by looking through each Markdown document and using the following rules to detect a page title instead:

  • Use the first atx-style header found in the document at any level between 1 to 6, which is any line beginning with between 1 to 6 '#' characters.

  • Or use the first setext-style header, which is any line where the line immediately after contains only '=' or '-' characters, effectively 'underlining' the line.

It will also remove any additional markup that is found in the title, such as image or link tags, which would otherwise be rendered as string literals in the generated HTML.

Reduced folders

In order to de-clutter the navigation, the plugin looks for any sections containing only one page, and tries to collapse that page up a level into its parent. This helps deal with navigation bars filled with single-page folders to keep things looking tidy.

Usage

Install the plugin:

pip install mkdocs-nav-enhancements

Add the plugin to your mkdocs.yml MkDocs configuration file:

plugins:
  - mkdocs-nav-enhancements

Known issues

When changing the page title, or collapsing single-page folders, this can sometimes result in the effective page title being quite different. Currently this plugin does not re-sort the nav bar alphabetically when this happens.

A second issue is that these options are not independently controllable, at least not in the first version; it's all or nothing for now!

Contributing

Source code is hosted at GitHub.

Please report issues and feature requests on GitHub Issues.

Pull Requests are also welcome!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mkdocs-nav-enhancements-0.9.1.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

mkdocs_nav_enhancements-0.9.1-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file mkdocs-nav-enhancements-0.9.1.tar.gz.

File metadata

  • Download URL: mkdocs-nav-enhancements-0.9.1.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.4

File hashes

Hashes for mkdocs-nav-enhancements-0.9.1.tar.gz
Algorithm Hash digest
SHA256 379c8724d06a979c191e0f479981cd7af9ae88affc596dba87976e84deabdb64
MD5 ecdf8850e5ecaa35248e0706cb00e339
BLAKE2b-256 131b07a6df922832bf13df3aaed03b9dfc24b2defe97668fbe3b5c75a8551916

See more details on using hashes here.

File details

Details for the file mkdocs_nav_enhancements-0.9.1-py3-none-any.whl.

File metadata

  • Download URL: mkdocs_nav_enhancements-0.9.1-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.4

File hashes

Hashes for mkdocs_nav_enhancements-0.9.1-py3-none-any.whl
Algorithm Hash digest
SHA256 62d9e8a82e6f0dedb883ba64a75302778f71b09a16aee2a98c0c32f6c8ac70c4
MD5 b7e1bb6d255257c1a78a4ba5283dad2b
BLAKE2b-256 8ac5b4c74847ad8806182ea6f0995de4b1ef99a53c9b05314da62ecb1cb1c58c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page