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
  [![alt](img)](ziel) und startete Links an escapten \[-Klammern.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Dieter Schlüter 2026-10-05 20:24:47 +02:00
commit 0dad1f7b2d

View file

@ -63,3 +63,10 @@ def test_unknown_elements_are_reported_and_keep_html(convert):
kept = convert(Book(docs=[Doc("c.xhtml", body)]), "--keep-html")
assert '<foo-widget data-x="1">Inhalt bleibt</foo-widget>' in kept.chapter("001")
assert "evil" not in kept.chapter("001")
def test_complex_table_anchor_is_emitted_once(convert):
body = ('<h1>T</h1><p><a href="#t1">Tabelle 1</a></p><table id="t1"><tr><td colspan="2">a</td></tr>'
"<tr><td>b</td><td>c</td></tr></table>")
text = convert(Book(docs=[Doc("c.xhtml", body)])).chapter("001")
assert text.count('id="t1"') == 1