Simple check/command-line tool that parses, validates and loads configuration, builds the mkdocs project documentation, and serves it via a web server
Project description
check-mkdocs
Check if MkDocs is configured correctly
This is a simple .pre-commit-config.yaml hook to check if MkDocs is configured correctly.
Installation via Pip
You can install this tool via pip:
pip install check-mkdocs
Local Installation
This tool is packaged with Poetry. To install it, you can clone the repository and use Poetry to install the dependencies:
git clone https://github.com/RodrigoGonzalez/check-mkdocs.git
cd check-mkdocs
poetry install
Features
- Validates the MkDocs configuration file (default is
mkdocs.yml
). - Builds the MkDocs project documentation via
mkdocs build
. - Checks the built documentation via
mkdocs 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 Usage
Add this to your .pre-commit-config.yaml
, where mkdocs.yml
is the name of your MkDocs YAML configuration file:
repos:
- repo: https://github.com/RodrigoGonzalez/check-mkdocs
rev: v1.1.4
hooks:
- id: check-mkdocs
name: check-mkdocs
args: [--config=mkdocs.yml] # Optional, mkdocs.yml is the default
Command-Line Usage
To run this hook, you can use the following command:
check-mkdocs --config=mkdocs.yml
This works as well:
check-mkdocs mkdocs.yml
And if mkdocs.yml
is the name of your MkDocs YAML
configuration file, this works too:
check-mkdocs
These 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-build
Argument
The --generate-build
argument 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 the
site_dir
directory specified in the configuration. If the
site_dir
directory is not specified in the configuration,
the tool will use the MkDocs default location as the
site_dir
(i.e., site/
).
Here's how you can use this argument:
check-mkdocs --config=mkdocs.yml --generate-build
This 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.
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
Built Distribution
File details
Details for the file check_mkdocs-1.1.4.tar.gz
.
File metadata
- Download URL: check_mkdocs-1.1.4.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.4 Darwin/22.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bef4f76a6827985446c25a14eed5947100160132a45d03360cabafb3e06b2c26 |
|
MD5 | 45e0a0fce47f969db9496c68f38222fa |
|
BLAKE2b-256 | a9aa2a8cef31c2d3dfe8fea91f70e0be136d5deb830a7adde49ea34e5d10d682 |
Provenance
File details
Details for the file check_mkdocs-1.1.4-py3-none-any.whl
.
File metadata
- Download URL: check_mkdocs-1.1.4-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.4 Darwin/22.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e0e7a5433ee07879c1d16fe505599fc3f6a9c605fc333fc75a2039cea36b6c8 |
|
MD5 | ab3a15394f64286a5405cf59cb4fdd1a |
|
BLAKE2b-256 | 48d10f247c585e7f6e2397ce4421de2eb96c458fc06f11eff31b6180d93f424c |