All Projects → manuzhang → mkdocs-htmlproofer-plugin

manuzhang / mkdocs-htmlproofer-plugin

Licence: MIT License
A MkDocs plugin that validates URL in rendered html files

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to mkdocs-htmlproofer-plugin

mkdocs-literate-nav
MkDocs plugin to specify the navigation in Markdown instead of YAML
Stars: ✭ 19 (+11.76%)
Mutual labels:  mkdocs, mkdocs-plugin
mkdocs-section-index
MkDocs plugin to allow clickable sections that lead to an index page
Stars: ✭ 36 (+111.76%)
Mutual labels:  mkdocs, mkdocs-plugin
mkdocs-git-revision-date-localized-plugin
MkDocs plugin to add a last updated date to your site pages
Stars: ✭ 73 (+329.41%)
Mutual labels:  mkdocs, mkdocs-plugin
mkdocs-static-i18n
MkDocs i18n plugin using static translation markdown files
Stars: ✭ 78 (+358.82%)
Mutual labels:  mkdocs, mkdocs-plugin
mkdocs-exclude-search
🔎 A mkdocs plugin that lets you exclude selected chapters from the search index.
Stars: ✭ 16 (-5.88%)
Mutual labels:  mkdocs, mkdocs-plugin
mkdocs-markdownextradata-plugin
A MkDocs plugin that injects the mkdocs.yml extra variables into the markdown template
Stars: ✭ 48 (+182.35%)
Mutual labels:  mkdocs, mkdocs-plugin
mkdocs-print-site-plugin
MkDocs Plugin that adds an additional page that combines all pages, allowing easy exports to PDF and standalone HTML.
Stars: ✭ 38 (+123.53%)
Mutual labels:  mkdocs, mkdocs-plugin
mkdocs-rss-plugin
MkDocs plugin to generate a RSS feeds for created and updated pages, using git log and YAML frontmatter (page.meta).
Stars: ✭ 43 (+152.94%)
Mutual labels:  mkdocs, mkdocs-plugin
mkdocs-table-reader-plugin
MkDocs plugin that adds a {{ read_csv('table.csv') }} markdown tag to directly insert CSV files as a table into a page.
Stars: ✭ 60 (+252.94%)
Mutual labels:  mkdocs, mkdocs-plugin
mkdocs-git-authors-plugin
MkDocs plugin to display git authors of a page.
Stars: ✭ 27 (+58.82%)
Mutual labels:  mkdocs, mkdocs-plugin
python-package-template
Easy to use template for great PyPi packages
Stars: ✭ 19 (+11.76%)
Mutual labels:  mkdocs
DietPi-Docs
Source repository for the DietPi OS documentation
Stars: ✭ 74 (+335.29%)
Mutual labels:  mkdocs
mkdocs-material
Documentation that simply works
Stars: ✭ 10,955 (+64341.18%)
Mutual labels:  mkdocs
mkapi
A documentation generation tool for MkDocs.
Stars: ✭ 68 (+300%)
Mutual labels:  mkdocs-plugin
persianthinkpython
a fork from thinkpythonpersian in markdown
Stars: ✭ 14 (-17.65%)
Mutual labels:  mkdocs
kotlin-rev-solution
Kotlin reference site in Japanese.
Stars: ✭ 46 (+170.59%)
Mutual labels:  mkdocs
mkdocs-windmill-dark
Outstanding mkdocs theme with a focus on navigation and usability
Stars: ✭ 24 (+41.18%)
Mutual labels:  mkdocs
markdown-i18n
i18n extension for Python Markdown
Stars: ✭ 13 (-23.53%)
Mutual labels:  mkdocs
doxybook2
Doxygen XML to Markdown (or JSON)
Stars: ✭ 140 (+723.53%)
Mutual labels:  mkdocs
Documentation
Kodular Documentation
Stars: ✭ 41 (+141.18%)
Mutual labels:  mkdocs

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

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.

plugins:
    - search
    - htmlproofer

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

use_directory_urls: False

Configuring

enabled

True by default, allows toggling whether the plugin is enabled. Useful for local development where you may want faster build times.

plugins:
  - htmlproofer:
      enabled: !ENV [ENABLED_HTMLPROOFER, True]

Which enables you do disable the plugin locally using:

export ENABLED_HTMLPROOFER=false
mkdocs serve

raise_error

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

plugins:
  - htmlproofer:
      raise_error: True

raise_error_excludes

When specifying raise_error: True, it is possible to ignore errors 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: ['*']

validate_external_urls

Avoids validating any external URLs (i.e those starting with http:// or https://). This will be faster if you just want to validate local anchors, as it does not make any network requests.

plugins:
  - htmlproofer:
      validate_external_urls: False

validate_rendered_template

Validates the entire rendered template for each page - including the navigation, header, footer, etc. This defaults to off because it is much slower and often redundant to repeat for every single page.

plugins:
  - htmlproofer:
      validate_rendered_template: True

Improving

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].