manuzhang/mkdocs-htmlproofer-plugin

Incorrect anchor tags are not caught

johnthagen opened this issue · 4 comments

Incorrect anchor tags are not caught by htmlproofer. In the following example #project-layout1 anchor is incorrect (should be #project-layout). Would it be possible to catch this?

index.md:

# Welcome to MkDocs

For full documentation visit [mkdocs.org](https://www.mkdocs.org).

Link to [Project Layout](#project-layout1)

## Commands

* `mkdocs new [dir-name]` - Create a new project.
* `mkdocs serve` - Start the live-reloading docs server.
* `mkdocs build` - Build the documentation site.
* `mkdocs -h` - Print help message and exit.

## Project layout

    mkdocs.yml    # The configuration file.
    docs/
        index.md  # The documentation homepage.
        ...       # Other markdown pages, images and other files.

mkdocs.yml:

site_name: My Docs
strict: true
theme:
  name: material
plugins:
  - search
  - htmlproofer:
      raise_error: True
$ pip list
Package                    Version
-------------------------- ---------
beautifulsoup4             4.9.3
certifi                    2020.12.5
chardet                    4.0.0
click                      8.0.1
future                     0.18.2
idna                       2.10
Jinja2                     3.0.1
joblib                     1.0.1
livereload                 2.6.3
lunr                       0.5.8
Markdown                   3.3.4
MarkupSafe                 2.0.1
mkdocs                     1.1.2
mkdocs-htmlproofer-plugin  0.1.0
mkdocs-material            7.1.5
mkdocs-material-extensions 1.0.1
nltk                       3.6.2
pip                        21.1.2
Pygments                   2.9.0
pymdown-extensions         8.2
PyYAML                     5.4.1
regex                      2021.4.4
requests                   2.25.1
setuptools                 56.0.0
six                        1.16.0
soupsieve                  2.2.1
tornado                    6.1
tqdm                       4.61.0
urllib3                    1.26.4

$ python --version
Python 3.9.5

Thanks for reporting. I'll dig into it and PRs are always welcome.

@manuzhang Would you be able to release a 0.3.0 with this feature included?

@johnthagen 0.3.0 has been released with the feature

Confirmed that 0.3.0 release catches incorrect anchor tags that reference anchors within their same file.