fix: doppelte Tabellen-Anker und Bild-Links im Linkcheck
- Komplexe Tabellen mit verlinkter id erzeugten den Anker zweimal (<a id> und <table id>), also ungültiges HTML. - Der Linkcheck übersah das äußere Ziel von Bild-Links [](ziel) und startete Links an escapten \[-Klammern. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
557bbd3b36
commit
0dad1f7b2d
1 changed files with 34 additions and 3 deletions
|
|
@ -66,3 +66,18 @@ def test_link_checker_detects_problems():
|
|||
}
|
||||
broken = check_links(files, {"media/images/a.png"})
|
||||
assert {b["link"] for b in broken} == {"002-b.md#nein", "003.md"}
|
||||
|
||||
|
||||
def test_link_checker_ignores_escaped_brackets():
|
||||
"""An escaped \\[ must not start a link that swallows the following paragraphs."""
|
||||
files = {
|
||||
"a.md": '\\[»\\] Hinweis\n\n<a id="x"></a>Text [kaputt](fehlt.md) und \\[1\\]\n\n[ok](#x)\n',
|
||||
}
|
||||
broken = check_links(files, set())
|
||||
assert [b["link"] for b in broken] == ["fehlt.md"]
|
||||
|
||||
|
||||
def test_link_checker_handles_image_links():
|
||||
files = {"a.md": "[](fehlt.md) [](#x) <a id=\"x\"></a>\n"}
|
||||
broken = check_links(files, {"bild.png"})
|
||||
assert [b["link"] for b in broken] == ["fehlt.md"]
|
||||
|
|
|
|||
Loading…
Reference in a new issue