You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(markdown): the tag end in the link pre-pass comes from a separate hand-written scan #233
P2Wrong behaviour in an edge casebugSomething isn't workingcorrectnessProduces wrong output or wrong behaviouroperatorAn operator would hit this in normal use; ranks above dev, test and edge cases
The markdown pre-pass finds where each start tag ends with a hand-written scan (start_tag_end in crates/crawlberg/src/html/link_targets.rs), while the rest of the pass now takes tags from the html5ever tree builder (#232). Nothing checks that the hand-written scan agrees with html5ever about where a tag ends, for example with quotes inside unquoted values, / before >, or attributes without values.
Fix
Take the tag end offset from the html5ever scan the pass already runs, or add a differential test of the scan against html5ever over a corpus of start tags.
The hand-written tag-end scan ends 5,800 of 283,305 corpus start tags where html5ever does not. <a href=b ="x>z</a><a href="y"> gives the first link the second link's address, and <img src="data:..." ="x>"> leaks the payload into the markdown.
Where tl and html5ever read a different attribute value (<img == src="data:...">, <img alt=<TAB>"x src=data:...">), the payload that tl sees reaches the markdown.
The hand-written tag-end scan exists only to serve the pre-pass, and the pre-pass's URL-joining half is now redundant: ConversionOptions::base_url (html-to-markdown-rs 3.15, plus blockquote cite in 3.15.1) resolves the same target set TARGETS mirrors — a href, img src and its lazy fallbacks, srcset, graphic, iframe/audio/video/sourcesrc — inside the converter's own html5ever parse.
Bump Cargo.toml:84 and adopt it (#190) rather than building a differential test for a second reading of the page. The data: payload leak in the measured examples is the one part that survives, and it is itself an upstream ask (#97).
P2Wrong behaviour in an edge casebugSomething isn't workingcorrectnessProduces wrong output or wrong behaviouroperatorAn operator would hit this in normal use; ranks above dev, test and edge cases
Activity
Goldziher commentedon Sep 27, 2026
The hand-written tag-end scan exists only to serve the pre-pass, and the pre-pass's URL-joining half is now redundant:
ConversionOptions::base_url(html-to-markdown-rs 3.15, plusblockquote citein 3.15.1) resolves the same target setTARGETSmirrors —a href,img srcand its lazy fallbacks,srcset,graphic,iframe/audio/video/sourcesrc— inside the converter's own html5ever parse.Bump
Cargo.toml:84and adopt it (#190) rather than building a differential test for a second reading of the page. Thedata:payload leak in the measured examples is the one part that survives, and it is itself an upstream ask (#97).tobocop2 commentedon Oct 1, 2026
Closing as not real.
start_tag_endcame from closed PRs #123 and #232, andgit grep start_tag_endat b632f34 finds nothing on main.