Repository navigation
feat(html): extract page metadata from meta, Open Graph and JSON-LD - #20
Merged
Merged
Conversation
extract_document on HTML fills Extraction::title and new Extraction::metadata (description, author, published, language, canonical URL, site name, image). Values are cleaned and capped, URL fields drop non-http(s) schemes, JSON-LD reading is bounded. CLI --json includes format, title and metadata for files and stdin. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CEs5BsitrunoTsYY5SYtFy
chaliy
added a commit
that referenced
this pull request
Oct 26, 2026
This was referenced Oct 26, 2026
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.
Requested by Михайло · project thread
What changed
extract_documenton HTML now fillsExtraction::title(was alwaysNonefor HTML) and a newExtraction::metadata: description, author, published date, language, canonical URL, site name, lead image.<meta>(name/property/itemprop), Open Graph, Twitter cards, Dublin Core,<link rel=canonical>,<html lang>, JSON-LD (incl.@graph, article types preferred). Fixed precedence table inknowledge/formats/html-extraction.md.markkit extract --jsonincludesformat,title,metadatafor--fileand stdin. (URL path stays Markdown-only; it gets the same in the follow-up URL-resolution PR.)Metadataexported from the crate root;Extractionis#[non_exhaustive], so additive.First of three PRs for the roadmap's "Readability and metadata" item; next are relative URL resolution and main-content detection.
Why
Web pages carry title/author/date/canonical in head tags that the Markdown drops. LLM/RAG callers need them as structured fields.
Before / After
Before:
{"markdown": "x\n", "source": "<stdin>"}After:
{"format": "html", "markdown": "x\n", "source": "<stdin>", "title": "Hi", "metadata": {"description": "D", "language": "en", "author": null, "canonical_url": null, "image": null, "published": null, "site_name": null}}Markdown output unchanged.
Risk
http(s)schemes (javascript:,data:); JSON-LD bounded (16 scripts, 1 MiB each, 256 nodes, serde_json depth 128), invalid JSON ignored. Threat model T1 + new T2e.Checklist
tests/html_metadata.rsincl. security cases, proptestmetadata_values_single_line, unit tests)Generated by Claude Code