Skip to main content

MkDocs plugin to get the latest git tag from the local repository

Project description

MkDocs Plugin : latest-git-tag

PyPI version

This is a simple MkDocs plugin that just gets the most recent Tag from the local Git repository and makes it available as a markdown tag in the template.

The idea behind this is that GitHub uses the Tag to name the release and, therefore we can use it to display the version of the documentation that corresponds to the release.

The Tag is just returned as a string with no formatting applied. If none is found, it returns "No Tags found"

There is a Demo Site

Installation

Install the package with pip:

pip install mkdocs-latest-git-tag-plugin

or, if you are using Poetry:

poetry add mkdocs-latest-git-tag-plugin --group dev

Usage

Activate the plugin in your mkdocs.yml:

plugins:
  - latest-git-tag

If you have no plugins entry in your config file yet, you'll likely also want to add the search plugin. MkDocs enables it by default if here is no plugins entry set.

Then, in your template, you can use the {{ latest_git_tag }} variable:

# My Project

Version: {{ latest_git_tag }}

The spaces around the tag are optional and it is case insensitive.

Configuration

At this time there are no configuration options.

License

This is released under the MIT License. See the bundled LICENSE file for more details.

TODO

  • Add tests

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_latest_git_tag_plugin-0.1.2.tar.gz (3.9 kB view hashes)

Uploaded Source

Built Distribution

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