Repository navigation
html: deep pages, text in other scripts, every element of the standard, and a byte order mark - #177
Conversation
…d, and a byte order mark Four new settings for the html format, each off by default, so files made with the earlier settings keep their bytes. - nesting puts the content inside up to 100 000 div elements, the label outside them. lxml drops the content of a page about 250 deep, Chromium flattens past 511, and jsdom, parse5 and DOMPurify can run out of stack writing out a page from about 2 000 deep. - characters=international adds paragraphs in Polish, Russian, Japanese and Arabic (right to left), emoji, a letter in two code points and entities. - elements=every adds a block using every element of the HTML standard but script, all 22 kinds of input, and pictures and a sound written into the page as data. The Nu HTML Checker finds nothing wrong with it. - bom puts a UTF-8 byte order mark in front, from the shared text encoding axis. Content sniffing as the WHATWG describes it then reads the page as plain text. The structural check is told every setting and checks each one from the bytes. Four golden cases pin the new paths. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📜 Recent review details
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
…eads nesting safely The parity guard classifies html.bom, characters, elements and nesting as reachable from the window. The structural check accepts only ASCII digits up to 100000 for nesting before converting it, and asks for the page skeleton with one literal pattern. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Four new settings for the
htmlformat. Each is off by default, so files made with the earlier settings keep their bytes (the golden values are unchanged).nesting- the content of a page inside up to 100 000divelements, each inside the last, with the label outside them. Readers part ways early: lxml drops everything but the label from a page about 250 deep, Chromium keeps 511 levels and moves the deeper ones out, and jsdom, parse5 and DOMPurify can run out of stack writing out a page from about 2 000 deep. The Nu HTML Checker calls a page past 513 elements deep an error.characters=international- paragraphs in Polish, Russian, Japanese and Arabic (right to left), emoji with a ZWJ sequence, a letter written as two code points, and named and numbered entities.elements=every- a block that uses every element of the HTML standard butscriptat least once (114 of the 115 names in its index), all 22 kinds ofinput, and pictures and a sound written into the page asdata:, so opening it fetches nothing. The Nu HTML Checker finds nothing wrong with it. A fragment has no head, so it leaves out the eight elements only a whole page holds, and the manifest carries a note saying so.bom- a UTF-8 byte order mark in front, from the shared text encoding axis. Chromium andfilestill see HTML. Content sniffing as the WHATWG describes it, which Go'snet/httpfollows, reads it as plain text.Around it
htmlfilesplit intosettings.go,page.go,blocks.go(bytes unchanged),catalogue.goandcharacters.go. The bytes that close the levels, the body and the document stay in the last record. The minimum is summed from lengths, so a deep page keeps 600 KB out of every plan.strict.pycheck_htmlis told all five settings and checks each from the bytes. It no longer takes<header>for<head>.Checked by
htmlsettings_test.go,htmlcatalogue_test.go), four new golden values.🤖 Generated with Claude Code
Summary by CodeRabbit