Skip to content

Add JS rendering and lighthtml output format support#32

Merged
simonediroma merged 2 commits into
mainfrom
claude/update-readme-content-negotiation-4MNcJ
Apr 8, 2026
Merged

Add JS rendering and lighthtml output format support#32
simonediroma merged 2 commits into
mainfrom
claude/update-readme-content-negotiation-4MNcJ

Conversation

@simonediroma
Copy link
Copy Markdown
Owner

Summary

This PR adds JavaScript rendering capabilities via Playwright and introduces a new lighthtml output format for minimal HTML output. These features enable better handling of JavaScript-heavy websites and provide a lightweight HTML extraction option.

Key Changes

  • JS rendering support: Added render_js configuration option (global, per-domain, and per-call) to render pages with headless Chromium before content extraction. Requires optional Playwright dependency.
  • lighthtml output format: New output format that strips <style>, <script> tags (except JSON-LD), HTML comments, and all tag attributes to return minimal bare HTML structure.
  • Updated documentation:
    • Added render_js to global configuration schema with default false
    • Added render_js parameter to per-call API documentation
    • Updated output_format descriptions to include lighthtml option
    • Added optional Playwright installation instructions
    • Added new section on Cloudflare's Markdown for Agents feature for LLM-optimized content negotiation
  • Response summary enhancement: Added JS rendering field to the structured response summary to indicate whether JS rendering was applied

Implementation Details

  • JS rendering is opt-in by default (disabled globally) to avoid unnecessary overhead
  • Can be configured at three levels: globally, per-domain, or per-call (with per-call taking precedence)
  • Playwright is an optional dependency; JS rendering gracefully requires it when enabled
  • The lighthtml format complements existing formats by providing a middle ground between raw HTML and markdown/trafilatura extraction

https://claude.ai/code/session_01HfKd1qWzkoJqxnVAPfNFmA

claude added 2 commits April 8, 2026 10:21
… negotiation use case

Add documentation for two recently shipped features (render_js via
Playwright and lighthtml output format) across the Features table,
YAML reference, Tool API, and response summary example. Add a new
use case showing how to leverage Cloudflare's "Markdown for Agents"
Accept: text/markdown content negotiation to get LLM-ready Markdown
directly from the edge.

https://claude.ai/code/session_01HfKd1qWzkoJqxnVAPfNFmA
mypy reports that BeautifulSoup's tag.get() returns
str | AttributeValueList, which has no .lower(). Wrapping with str()
resolves the union-attr error on line 829.

https://claude.ai/code/session_01HfKd1qWzkoJqxnVAPfNFmA
@simonediroma simonediroma merged commit 652f08c into main Apr 8, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants