UmbrellaDocs / linkspector

Uncover broken links in your content.
Apache License 2.0
63 stars 9 forks source link

Section links not checked in md files #26

Closed marcindulak closed 4 months ago

marcindulak commented 7 months ago

The example below uses docker https://github.com/UmbrellaDocs/linkspector/pull/23

  1. build the image of the latest linkspector from source
    git clone https://github.com/UmbrellaDocs/linkspector
    cd linkspector
    docker build --build-arg LINKSPECTOR_PACKAGE= -t umbrelladocs/linkspector .
  2. run linkspector check on a test directory
    mkdir test
    cp .gitignore test  # due to https://github.com/UmbrellaDocs/linkspector/issues/24
    echo '[my-section](#my-section-missing)' > test/test.md
    echo '## My section' >> test/test.md
    docker run --rm -it -v $PWD/test:/app --name linkspector umbrelladocs/linkspector bash -c 'linkspector check'

Output

⠋ Configuration file not found. Using default configuration.
✨ Success: All hyperlinks in the specified files are valid.

An error due to a missing section link is expected.

marcindulak commented 5 months ago

It does not appear to me that this is fixed using https://github.com/UmbrellaDocs/linkspector/commit/c35eb55f29e74bf3161d66e352a21f49e7d4e0f3.

Please use the test instructions provided in the issue description (cp .gitignore test is no longer needed), and reopen the issue if needed.

marcindulak commented 5 months ago

It still seems not working for me as expected with https://github.com/UmbrellaDocs/linkspector/commit/9dc2d13c83a83394b97acc06c0c4edc7e0a59137

gaurav-nelson commented 5 months ago

Section links in the same file are not checked.

marcindulak commented 5 months ago

I hope this could be implemented. This is a popular functionality looking at the number of linked issues under https://github.com/tcort/markdown-link-check/issues/304, which used to implement it, but broke recently.

gaurav-nelson commented 5 months ago

Top level / links are still broken. Hopefully they are fixed. @marcindulak Let me know if you still find any issues.

marcindulak commented 5 months ago

The test case from the issue does not fail as expected for me using https://github.com/UmbrellaDocs/linkspector/commit/9524b584790dc1b830c80486086456b80961a066, using the Dockerfile from https://github.com/UmbrellaDocs/linkspector/pull/23

docker build --no-cache --pull --build-arg LINKSPECTOR_PACKAGE= -t umbrelladocs/linkspector .
rm -rf test
mkdir test
echo '[my-section](#my-section-missing)' > test/test.md
echo '## My section' >> test/test.md
docker run --rm -it -v $PWD/test:/app --name linkspector umbrelladocs/linkspector bash -c 'linkspector check'

Output

⠋ Configuration file not found. Using default configuration.
✨ Success: All hyperlinks in the specified files are valid.