Skip to content

Commit

Permalink
Adds htmlproofer plugin for mkdocs
Browse files Browse the repository at this point in the history
This is intended to catch bad anchors and broken external links.

It does also significantly increase build time, though, because of all
the checking.

Because of that, two environment variables have been included in the
`mkdocs.yml` file:

```
DOCS_ENABLE_HTMLPROOFER=True
DOCS_FAIL_ON_BAD_LINK=False
```

This lets you easily change whether these are enabled, for testing and
local builds.
  • Loading branch information
ikirker committed May 28, 2024
1 parent 0ff8c80 commit bc2e3e1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mkdocs-project-dir/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ plugins:
- search
- awesome-pages
# https://github.com/lukasgeiter/mkdocs-awesome-pages-plugin
- htmlproofer:
enabled: !ENV [DOCS_ENABLE_HTMLPROOFER, True]
validate_external_urls: true
raise_error: !ENV [DOCS_FAIL_ON_BAD_LINK, False]
# ^-- ideally we would change the default here once all the initial problems have been fixed


# Customization
extra:
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ mkdocs-awesome-pages-plugin
pygments
requests
Mako
mkdocs-htmlproofer-plugin

0 comments on commit bc2e3e1

Please sign in to comment.