Package: check-mkdocs
check-mkdocsCheck if MkDocs is configured correctlyThis is a simple .pre-commit-config.yaml hook to check if MkDocs
is configured correctly.Installation via PipYou can install this tool via pip:pipinstallcheck-mkdocsLocal InstallationThis tool is packaged with Poetry. To install it, you can clone the
repository and use Poetry to install the dependencies:gitclonehttps://github.com/RodrigoGonzalez/check-mkdocs.gitcdcheck-mkdocs
poetryinstallFeaturesValidates the MkDocs configuration file (default ismkdocs.yml).Builds the MkDocs project documentation viamkdocs build.Checks the built documentation viamkdocs serve.Can be used as a pre-commit hook.Optionally, it can generate a build of the MkDocs documentation.Documentation:https://rodrigogonzalez.github.io/check-mkdocs/Pre-Commit UsageAdd this to your.pre-commit-config.yaml, wheremkdocs.ymlis the name of your MkDocs YAML configuration file:repos:-repo:https://github.com/RodrigoGonzalez/check-mkdocsrev:v1.2.0hooks:-id:check-mkdocsname:check-mkdocsargs:["--config","mkdocs.yml"]# Optional, mkdocs.yml is the default# If you have additional plugins or libraries that are not included in check-mkdocs, add them hereadditional_dependencies:['mkdocs-material']Command-Line UsageTo run this hook, you can use the following command:check-mkdocs--config=mkdocs.ymlThis works as well:check-mkdocsmkdocs.ymlAnd ifmkdocs.ymlis the name of your MkDocs YAML
configuration file, this works too:check-mkdocsThese commands will validate the MkDocs configuration
file, build the project documentation, and start the
server. If there's an error in any of these steps, the
tool will print an error message and return an error code.The--generate-buildArgumentThe--generate-buildargument is a command-line flag that
you can use to instruct the check_mkdocs tool to generate a
build of the MkDocs documentation. This argument is
optional, and its default value is False, which means that
by default, the tool will not generate a build.When you provide this argument, the tool will call the
build function from mkdocs.commands.build with the loaded
configuration. This function will build the project
documentation and place the built documentation in thesite_dirdirectory specified in the configuration. If thesite_dirdirectory is not specified in the configuration,
the tool will use the MkDocs default location as thesite_dir(i.e.,site/).Here's how you can use this argument:check-mkdocs--config=mkdocs.yml--generate-buildThis command will validate the MkDocs configuration file,
build the project documentation, and start the server. If
there's an error in any of these steps, the tool will print
an error message and return an error code.Known IssuesMissing MkDocs PluginsGiven the enormous number of plugins available for MkDocs,
it's possible that some plugins are not included in this
tool. In this case you will see an error message similar to
this:check-mkdocs.............................................................Failed
-hookid:check-mkdocs
-exitcode:1Configvalue'theme':Unrecognisedthemename:'material'.Theavailableinstalledthemesare:mkdocs,readthedocs
Configvalue'markdown_extensions':Failedtoloadextension'pymdownx.snippets'.
ModuleNotFoundError:Nomodulenamed'pymdownx'Configvalue'plugins':The"mkdocstrings"pluginisnotinstalled

make:***[pre-commit]Error1If you have additional plugins or libraries that are not
included in check-mkdocs, add them here:repos:-repo:https://github.com/RodrigoGonzalez/check-mkdocshooks:-id:check-mkdocs# If you have additional plugins or libraries that are not included in check-mkdocs, add them hereadditional_dependencies:['mkdocs-material','mkdocstrings']