diff --git a/setup.cfg b/setup.cfg index fcfbd3b..0be252e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = linkcheckmd -version = 1.1.1 +version = 1.1.2 author = Michael Hirsch, Ph.D. author_email = scivision@users.noreply.github.com url = https://github.com/scivision/linkchecker-markdown diff --git a/src/linkcheckmd/base.py b/src/linkcheckmd/base.py index 6f6d817..43e27a0 100644 --- a/src/linkcheckmd/base.py +++ b/src/linkcheckmd/base.py @@ -29,6 +29,7 @@ def check_local(path: Path, ext: str) -> T.Iterable[T.Tuple[str, str]]: if {"/", "."}.intersection(url.strip("/")): continue yield fn.name, url + continue if {"/", "."}.intersection(url.strip("/")): continue diff --git a/src/linkcheckmd/tests/badlink.md b/src/linkcheckmd/tests/badlink.md index 0e7a8bf..8c6a5e6 100644 --- a/src/linkcheckmd/tests/badlink.md +++ b/src/linkcheckmd/tests/badlink.md @@ -1,3 +1,10 @@ [bad root link](https://github.invalid) [bad full link](http://github.invalid/foo/index.html) -github.invalid \ No newline at end of file +github.invalid + +[local self link](/badlink) +[local bad link](/notexist) +[local ignored](/foo.txt) +[local bad format](notexist) +[local tag](/tag/foo) +[local id](#foo) diff --git a/src/linkcheckmd/tests/test_script.py b/src/linkcheckmd/tests/test_script.py index ffaa640..eeb9f55 100644 --- a/src/linkcheckmd/tests/test_script.py +++ b/src/linkcheckmd/tests/test_script.py @@ -9,6 +9,12 @@ Rs = R.parents[1] +def test_local(): + path = R / "badlink.md" + urls = list(lc.check_local(path, ext=".md")) + assert len(urls) == 2 + + @pytest.mark.parametrize( "mode,path", [("sync", R), ("sync", R / "badlink.md"), ("coro", R), ("coro", R / "badlink.md")] )