Skip to main content

A simple mkdocs plugin, enables to organize Navigation in a more markdownic way.

Project description

mkdocs-nav-weight

A simple mkdocs plugin, enables to organize Navigation in a more markdownic way.

This plugin tries to read markdown resources before mkdocs, which may add some performance overhead on building.

Usage

Four additional keys can be configured in Markdown Metadata ( also known as "front-matter", see metadata).

  • weight: number

    • Value: number, eg: -1, 2.3 ..., if unset, it goes 0.
    • like weight in Hugo but has some differences, used for ordering your sections/pages. Lower weight gets higher precedence. So content with lower weight will come first.
    • weight in an index will be offered to its parent section, there is a fixed value for itself, and the value is configurable, see: index_weight.
  • headless: bool

    • Value: bool, true or false, if unset, it goes false.
    • like headless in Hugo, pages/sections with headless: true will be hidden from nav, but these contents will still be rendered and accessible via URL.
    • headless in an index will be offered to its parent section.

For index only:

  • retitled: bool

    • Value: bool, true or false, if unset, it goes false.
    • A metadata version of section_renamed which only applies this index's title to its parent section, it only works when section_renamed is false.
  • empty: bool

    • Value: bool, true or false, if unset, it goes false.
    • If there is an index only used to offer metadata for its parent section and without any meaningful content, setting empty to true can help you to hide this index itself.

Installation

Install with pip:

pip install mkdocs-nav-weight

Add the following lines to mkdocs.yml

plugins:
  - search
  - mkdocs-nav-weight

Options

Configure in mkdocs.yml:

plugins:
  - search
  - mkdocs-nav-weight:
      section_renamed: false
      index_weight: -10
      warning: true
      reverse: false

section_renamed

Default: false:

  • If true, section name will use the title of its index instead of the folder name.

  • For compatibility we have to name a folder like "C#" as "CSharp", but what we actually want is "C#" , that's what this option does

index_weight

Default: -10:

  • The weight value for index itself, to ensure it's always the first at the same level

warning

Default: true:

  • Controls whether to send a Warning when invalid values are detected in markdown metadata

reverse

Default: false:

  • If true, sort nav by weight from largest to smallest.

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-weight-0.0.7.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mkdocs_nav_weight-0.0.7-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file mkdocs-nav-weight-0.0.7.tar.gz.

File metadata

  • Download URL: mkdocs-nav-weight-0.0.7.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for mkdocs-nav-weight-0.0.7.tar.gz
Algorithm Hash digest
SHA256 8004060f7537fcd9965bfdee512ac28e8fd3faba9d2253242a7f374e30e06e9d
MD5 e4289ef0c4702f24e79442a6500e78b6
BLAKE2b-256 a1ec55bc6328bd509a82cd2c0071e6a39eaece763e8c5a39e4615d2c2f69d9d6

See more details on using hashes here.

File details

Details for the file mkdocs_nav_weight-0.0.7-py3-none-any.whl.

File metadata

File hashes

Hashes for mkdocs_nav_weight-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 aceaf6949a77dbca8042a0dec8e384f7a60382f23956d13706b592eaa01b361a
MD5 007e6d17d0ad9c2922a8edea2e974ad3
BLAKE2b-256 22fcb9b538644c55eaf63f905ef6b4d11a5b524abdfa5ff953a4e1458b99378d

See more details on using hashes here.

Supported by

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