Skip to main content

A MkDocs plugin that validates URL in rendered HTML files

Project description

mkdocs-htmlproofer-plugin PyPI - Version

GitHub Actions

A MkDocs plugin that validates URLs, including anchors, in rendered html files.

Installation

  1. Prerequisites
  • Python >= 3.6
  • MkDocs >= 0.17
  1. Install the package with pip:
pip install mkdocs-htmlproofer-plugin
  1. Enable the plugin in your mkdocs.yml:
plugins:
    - search
    - htmlproofer

Optionally, you may raise error and fail the build on bad url status.

plugins:
    - search
    - htmlproofer:
        raise_error: True

That can be switched off for combinations of urls ('*' means all urls) and status codes with raise_error_excludes.

plugins:
    - search
    - htmlproofer:
        raise_error: True
        raise_error_excludes: 
          504: ['https://www.mkdocs.org/']
          404: ['https://github.com/manuzhang/mkdocs-htmlproofer-plugin']
          400: ['*']

Note: If you have no plugins entry in your config file yet, you'll likely also want to add the search plugin. MkDocs enables it by default if there is no plugins entry set, but now you have to enable it explicitly.

To enable cross-page anchor validation, you must set use_directory_urls = False in mkdocs.yml:

use_directory_urls: False

More information about plugins in the MkDocs documentation

Acknowledgement

This work is based on the mkdocs-markdownextradata-plugin project and the Finding and Fixing Website Link Rot with Python, BeautifulSoup and Requests article.

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

mkdocs-htmlproofer-plugin-0.6.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mkdocs_htmlproofer_plugin-0.6.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file mkdocs-htmlproofer-plugin-0.6.0.tar.gz.

File metadata

  • Download URL: mkdocs-htmlproofer-plugin-0.6.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.10

File hashes

Hashes for mkdocs-htmlproofer-plugin-0.6.0.tar.gz
Algorithm Hash digest
SHA256 437e737085dac1aff75cbb8b139316d295dc7296885f6b311d8b9e122b31d04c
MD5 171c79f05ad07f2d652a83cf7b619db4
BLAKE2b-256 09f23a9137a1fc0145ce73e4a05472364f036fab770580855e0c18344931c61c

See more details on using hashes here.

File details

Details for the file mkdocs_htmlproofer_plugin-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: mkdocs_htmlproofer_plugin-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.10

File hashes

Hashes for mkdocs_htmlproofer_plugin-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8245f03b4abdd684bef1df0cd49774a0976fad256d5cec8a0d99d63dfbde6a32
MD5 93426dc06fe86605279fa98bf72937a5
BLAKE2b-256 68fd4526f060a9cc99c534d43e27be7395f76b2d867324c37ecb1ae321473ce8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page