Skip to main content

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.6
      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

check_mkdocs-1.1.6.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

check_mkdocs-1.1.6-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file check_mkdocs-1.1.6.tar.gz.

File metadata

  • Download URL: check_mkdocs-1.1.6.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.4 Darwin/22.6.0

File hashes

Hashes for check_mkdocs-1.1.6.tar.gz
Algorithm Hash digest
SHA256 b36daf41fe01dc813dfb232d0da6961cd46b06ab2b523c58362106c03b79a482
MD5 41fb3d2d383017ca6e3c60e17b4978cc
BLAKE2b-256 e374b2310167575e78f1c230a21b157dd5aa1af41e975a7e9ddbd2c9760e33b0

See more details on using hashes here.

Provenance

File details

Details for the file check_mkdocs-1.1.6-py3-none-any.whl.

File metadata

  • Download URL: check_mkdocs-1.1.6-py3-none-any.whl
  • Upload date:
  • Size: 8.5 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

Hashes for check_mkdocs-1.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 72f1d6017f2a4e2a58f315566025006a8a68d61899800f129c8e6a5fd09ea5db
MD5 ea1398974914733ec0d102978a3da891
BLAKE2b-256 8eabd7819b91986503b844dade1a8c3b974cbb31893c80bcd5c9888eed56d069

See more details on using hashes here.

Provenance

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