A MkDocs plugin that validates URL in rendered HTML files
Project description
mkdocs-htmlproofer-plugin
A MkDocs plugin that validates URLs, including anchors, in rendered html files.
Installation
- Prerequisites
- Python >= 3.6
- MkDocs >= 0.17
- Install the package with pip:
pip install mkdocs-htmlproofer-plugin
- 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 thesearch
plugin. MkDocs enables it by default if there is noplugins
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
Release history Release notifications | RSS feed
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
Hashes for mkdocs-htmlproofer-plugin-0.6.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 437e737085dac1aff75cbb8b139316d295dc7296885f6b311d8b9e122b31d04c |
|
MD5 | 171c79f05ad07f2d652a83cf7b619db4 |
|
BLAKE2b-256 | 09f23a9137a1fc0145ce73e4a05472364f036fab770580855e0c18344931c61c |
Hashes for mkdocs_htmlproofer_plugin-0.6.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8245f03b4abdd684bef1df0cd49774a0976fad256d5cec8a0d99d63dfbde6a32 |
|
MD5 | 93426dc06fe86605279fa98bf72937a5 |
|
BLAKE2b-256 | 68fd4526f060a9cc99c534d43e27be7395f76b2d867324c37ecb1ae321473ce8 |