fralau / mkdocs-macros-plugin

Create richer and more beautiful pages in MkDocs, by using variables and calls to macros in the markdown code.
https://mkdocs-macros-plugin.readthedocs.io
Other
318 stars 50 forks source link

Add a git attribute to only show the tag name, without suffixes #184

Closed marcospereira closed 10 months ago

marcospereira commented 10 months ago

The current git.tag attribute shows the full description of the tag, with a suffix including the number of additional commits on top of the tagged object and the abbreviated object name of the most recent commit. The current output would be:

3.1.2-beta5-17-g7c2d387

Where -17-g7c2d387 is the suffix.

While this is useful in some cases, having only the tag name with no suffix is useful when showing the latest release. The abbreviated tag name would be:

3.1.2-beta5

And this can later be used when linking to code in that tag:

See the [setup](https://github.com/fralau/mkdocs_macros_plugin/blob/{{ git.short_tag }}/setup.py) code.

To the release itself:

See the [release notes for the latest release](https://github.com/fralau/mkdocs_macros_plugin/releases/tag/{{ git.short_tag }}).

Or, depending on the tag name, even adding code snippets such as:

Add it as a requirement:

    extras_require={
        'test': ["some-package>={{ git.short_tag }}],
    }
github-actions[bot] commented 10 months ago

Welcome to this project and thank you!' first issue

fralau commented 10 months ago

From a first examination, it makes sense.

Where would you use that statement?

    extras_require={
        'test': ["some-package>={{ git.short_tag }}],
    }
marcospereira commented 10 months ago

Where would you use that statement?

In a markdown doc that describes how to use a dependency. I copied from this project itself. But think about this doc here:

https://jte.gg/#getting-started

The markdown source would be:

<dependency>
    <groupId>gg.jte</groupId>
    <artifactId>jte</artifactId>
    <version>{{ git.short_tag }}</version>
</dependency>