Repository navigation
Conversation
92f566b to
9d1ea82
Compare
StateBase is The one red check, Changelog: entry is under
|
|
Thanks for the review. Every point is answered below, and the changes are in StateAgreed on all three. The branch is behind main and deletes no changelog entry, and the vendored header check also fails on main (#162). The
|
…ext-base-graphic The data: rule now covers #105's full media list (img, video, audio, iframe, source) plus graphic, and removes the attribute on every one of them rather than emptying it. The two raw-text sentences #105 dropped from its #97 changelog entry move into the #102 entry, in both changelogs.
|
Correct and well tested — ship it — but it bundles a second, undocumented behaviour change that is security-relevant and needs a changelog line before merge.
A good fix, and a real one — but this PR's changelog entry covers only #97, and the same behaviour is claimed by open PRs #123 ( Two notes on #114, which this PR is filed against: Severity is lower than #114 implies. #114's architectural reason is wrong, though its conclusion stands. #114 says the pre-pass "only rewrites attribute spans and cannot delete an element". It can: Separately, |
|
Triage note: the approach here is a workaround for a converter defect, and it is the one thing blocking Emptying |
e86bbc8 to
416fd29
Compare
An <img> whose address is a data: URL copied its whole encoded payload into the markdown. Before conversion, the relative-link rewrite now empties data: addresses in src and the lazy-load attributes (data-src, data-lazy-src, data-original), and drops data: candidates from srcset and data-srcset. The converter then writes the alt text with an empty address. A real URL in a lazy-load attribute or srcset still wins. The markdown, fit_content and wasm output all come from the same conversion, so all three follow the rule. The images list already skipped data: sources. data: links on <a> and media stay as written.
The merge from main placed it after the relative-links entries, which main keeps under Added.
The markdown pre-pass parsed the raw page, so markup inside script, style, title and textarea text could steer it: a <base> inside a title replaced the page's base address, and a "<!--" inside a script hid every later tag, which left relative links unresolved and let an inline image's data payload through. It now parses the masked copy that link extraction already uses and reads each attribute value from the original page at the same span. Masking keeps the byte length, and reading from the original keeps a value exact where the masking scan disagrees with the parser about quotes.
…e too The pre-pass emptied a data: address only on images, so a data: video, audio, iframe or source address was written into the markdown in full. These elements now get the same treatment, and a video or audio element falls back to a real nested source. The scrape test now asserts that fit_content keeps the image line, which the PR claimed and no test checked, and the changelog entry for #97 no longer describes the raw-text fix, which belongs to #123.
416fd29 to
2e84da7
Compare
…mage-data # Conflicts: # CHANGELOG.md # docs-site/src/content/docs/changelog.md
|
Agreed on the direction. The markdown half of this stack waits for the converter fixes rather than landing as a rewrite of the HTML. The data image payload is now xberg-io/html-to-markdown#528, an option for what to print instead of the payload, and it covers the graphic element too. When that ships, crawlberg adopts it and this PR keeps only the parts that belong to crawlberg. The base-in-title fix gets its changelog line in whichever PR keeps the raw-text masking, so it is credited once. |
|
The data payload fix now lives in html-to-markdown, which gained an option for what to print for an inline data image (xberg-io/html-to-markdown#566), and the base-in-title fix is there too (xberg-io/html-to-markdown#527). crawlberg adopts both through the version bump (#405) and the |
I'm planning to replace crawl4ai with crawlberg, and I need saved markdown to stay a reasonable size on ordinary pages.
Problem
An
<img>whose address is adata:URL wrote its whole encoded payload into the markdown. The page from the issue produced 319 bytes of markdown for two sentences and one small icon.Fix
The address of an inline image is now left empty before conversion, so the markdown keeps the alt text as
and the payload stays out. The same page now produces 67 bytes. This applies tosrc, the lazy-load attributes, anddata:candidates insrcsetanddata-srcset. When a lazy-load attribute orsrcsethas a real URL, the markdown still uses that URL.fit_contentfollows the same rule, and it now keeps theselines where it used to prune them.Video, audio, iframe and source
A
data:address on a<video>,<audio>,<iframe>or<source>is emptied the same way, so a video or audio element falls back to a real nested source when it has one.Raw text
The pre-pass now reads link targets from the page with script, style, title and textarea text masked, so a
<base>written inside a title or a<!--inside a script no longer steers it.Refs #120
Closes #97