Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move mkdocstrings-macros integration to a library #349

Open
wants to merge 16 commits into
base: v0.x.x
Choose a base branch
from

Conversation

llucax
Copy link
Contributor

@llucax llucax commented Feb 4, 2025

This PR moves the documentation macros functionality from individual template repositories into a central location, making it available as a macros pluglet. Key improvements include:

  • Removes duplicated boilerplate code
  • Adds a modular macros pluglet with common functionality
  • Simplifies template setup by using git-aware version info
  • Includes migration script for existing repositories
  • Updates release notes and documentation

The PR also bumps template dependencies and repository configuration versions in preparation for the 0.12 release.

Fixes #179.

@llucax llucax requested a review from a team as a code owner February 4, 2025 15:33
@llucax llucax requested a review from shsms February 4, 2025 15:33
@github-actions github-actions bot added the part:template Affects the cookiecutter template files label Feb 4, 2025
@llucax llucax added this to the v0.12.0 milestone Feb 4, 2025
@llucax llucax added type:enhancement New feature or enhancement visitble to users type:tech-debt Improves the project without visible changes for users part:mkdocs Affects the configuration of mkdocs labels Feb 4, 2025
@llucax llucax self-assigned this Feb 4, 2025
@llucax llucax requested a review from Marenz February 4, 2025 15:34
llucax added 12 commits February 4, 2025 16:37
This module is basically documentation, but there is some relationship
to macros as we'll provide the `CODE_ANNOTATION_MARKER` as a macro
variable, so we take the opportunity to unify the documentation in one
place.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
This module provides the required hooking, so macros can be used inside
docstrings properly when using `mkdocstrings`.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
This commit adds a new utility function to retrieve version information
from the repository and expose it as a couple of macro variables.

This function is also called from the convenience `define_env()`
function, so the variables are provided by default.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
The new function `hook_env_with_everything()` will do all the default
hooking, so it is easier to define a custom `define_env()` where only
a few macros are added, but still gets all the variables macros and
filters provided by this module.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
For the basic usage we can actually use the module itself as a
*pluglet*:
https://mkdocs-macros-plugin.readthedocs.io/en/latest/pluglets/

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
With this, there is no need for customization unless you want to define
your own macros.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
The macros plugin already offer easy access to git info, so we can do a
last resort try of getting the current sha from there.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
This completely removes the macros script.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
We now use the *pluglet* for templates too.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
part:mkdocs Affects the configuration of mkdocs part:template Affects the cookiecutter template files type:enhancement New feature or enhancement visitble to users type:tech-debt Improves the project without visible changes for users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move mkdocs-macros boilerplate from the template to the library
1 participant