feat(file): name html as a file type, without a renderer for it - #769
Merged
Conversation
andiwand
force-pushed
the
html-file-type
branch
from
August 29, 2026 20:55
0124828 to
a109a5f
Compare
`.html` had no `FileType`, so a well formed one decoded as xml and a host that trusted the answer showed the page's source. Both apps had to keep their own list to route around it — exactly the kind of list the format table exists to remove. The row names html, htm, xhtml, text/html and application/xhtml+xml, and declares nothing: no `open`, no `translate_html`. A passthrough renderer would be of no use to a host that has a web view already, and it would put the library in the business of rewriting a page's own links and assets. Detection is by name, as it is for markdown — html has no dependable signature. Closes #763 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UCM9ja9LbjNPPZGJZSw2xL
andiwand
force-pushed
the
html-file-type
branch
from
August 29, 2026 20:59
a109a5f to
36d2222
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 Generated with Claude Code
Closes #763.
There is no
FileTypefor html today, so an.htmldecodes asxmlwhen ithappens to be well formed and as text when it is not — and a host that trusts
the answer shows the page's source instead of the page. iOS routes around it by
matching
UTTypeagainst.htmland.xhtml; Android has no such route andopens an
.htmlas an xml source tree.This adds the row, and nothing else.
html,htm,xhtmltext/html,application/xhtml+xmltextcapabilities_by_file_type(hypertext_markup_language)declares noopenand notranslate_html, so a host reads it as "the core names this and will not drawit" and hands the file to the web view it already has — the shape
psd,jp2,wmfandemftook in 6.11.0. A passthrough renderer that emitted the file asits own output would be of no use to such a host, and it would put the library
in the business of rewriting a page's document-relative links and assets.
Detection is by name:
detect_by_contentis false, as it is for markdown, sincehtml has no dependable signature and a probe for one is a probe for prose. What
matters is that
file_type_by_file_extension("html")answers something otherthan
unknown. Detection from bytes is unchanged — a well formed.htmlstilllists as
[text_file, xml].FileType::hypertext_markup_languageis appended to the enum, so the bindingsthat mirror it by ordinal (jni, apple, python) gain the constant in the same
place; wasm derives its enum from the table already.
Test
FileTypeTable.html_is_named_but_not_decodedpins the aliases, the category,the empty capabilities, and that opening a page as this type throws. The
table-wide invariants (one row per type, unique aliases, capabilities that do
not exceed the engines) cover the new row automatically.
Full
odr_testsuite: 1253 passed, 6 skipped (the pre-existing svm / encrypteddoc / wpd skips). Reference output is unchanged.