Skip to main content

mkdocs-material tag plugin with free enhanced versions of some insiders features

Project description

Bettertags

bettertags is an enhanced version of the mkdocs-material built-in tags plugin with FREE versions of all Insiders-only tags features, and some minor improvements.

This plugin is originally based on the MIT-licensed source from mkdocs-material, but many parts have been heavily refactored/rewritten (and weren't written without any knowledge of the Material Insiders source). If you have suggestions of extra enhancements, please open an issue.

Installation and usage

  1. Run pip install bettertags
  2. Replace the tags configruation option of your mkdocs.yml with bettertags
  3. If you use Material-provided functions for tags_compare or tags_pages_compare, replace material.plugins.tags with bettertags

You can now use any insiders-only features described in the Material docs. I've also added a few features to tags_extra_files, described below.

tags_extra_files

Use this option to add additional tag lists to your wiki:

plugins:
  - bettertags:
      tags_extra_files:
        extra-1.md: [allowed-tag-1, allowed-tag-2, ...]
        extra-2.md: "*subfolder"
        extra-3.md: "*"
        "folder/extra-4.md":
            - rule: "*subfolder"
            - priority: 3

Each tag index can have one of the following types of rules:

  • [allowed-tag-1, ...]: only include tags from the given list
  • *subfolder: only include tags and pages from files contained within the same parent folder (or any descendants) as this index
  • *: include all tags and pages

An index may also have an associated priority. By default, all extra indexes have priority 0, and the primary index (from tags_file option) has priority 1. When a tag on a wiki page is linked back to a tag index, it is linked to the index with the highest priority that contains the page. By default, this means a tag will always link back to the primary tags index. In the above example, pages in folder/ will have tags linking to folder/extra-4.md, since folder/ has a priority 3 > 1. If a tag is shown in two indices with the same priority, it will link back to the index with the longest shared prefix between its file path and the path of the file containing the tag. That is, if indices /tags.md and /folder/tags.md both have priority 1, a tag in /folder/subfolder/file.md will link to /folder/tags.md. It is considered undefined behavior to have multiple indexes that tie for having the highest priority and longest shared prefix for a given page/tag pair.

tags_extra_files can also be replaced with indexes in your config for improved clarity.

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

bettertags-1.1.0.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

bettertags-1.1.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file bettertags-1.1.0.tar.gz.

File metadata

  • Download URL: bettertags-1.1.0.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for bettertags-1.1.0.tar.gz
Algorithm Hash digest
SHA256 cd50ec65517eabed090e074c6a88452d3398b7677e5e4ae6f3e3982677f84f3d
MD5 c3e98f8e1bffbda3784969a433510712
BLAKE2b-256 e4e6889306ed2621b122dacbe288aab1e73086f4663bd787748e5e5b200f9977

See more details on using hashes here.

File details

Details for the file bettertags-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: bettertags-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for bettertags-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 311096cf53235bbda7c31aee444ce2ae2267f08d422aa1f6839d15c6ac73a431
MD5 59ed67eab3600ad32ea8b48324b95a21
BLAKE2b-256 cec649297214bf8f1948da1da12e4f000472a927325ca130524dc6f4477541a2

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