feat: Pretext SVG text rendering for pixel-perfect typography - #44
Merged
Conversation
Integrates @chenglou/pretext as an optional text rendering engine.
When enabled, headline and subheadline text is measured with Pretext's
layout calculations and rendered as SVG <text> elements instead of
CSS-styled HTML divs, giving pixel-perfect control over line breaking
and text positioning.
- New pretext_utils.py with CDN loader and bootstrap script
- New pretext_renderer.py with slot markup and SVG text helpers
- BaseGenerator gains use_pretext flag, injects bootstrap in _wrap_html()
- Export pipeline waits for __pretextReady before screenshot
- Hero layout pilot: headline + subheadline use pretext-slot when enabled
- Theme integration via fill:currentColor inheriting from parent CSS
- MCP tool gains text_render param ("css" | "pretext"), default "css"
- CLI gains --text-render flag on create command
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
text_render: "pretext"is passed, headline and subheadline text is measured with Pretext's layout calculations and rendered as SVG<text>elements instead of CSS-styled HTML divstext_render: "css") is completely unchanged — this is an opt-in feature flagpretext_slot()helper incrementallyWhat changed
pretext_utils.pypretext_renderer.pypretext_slot()markup helper +svg_text_block()for static SVGbase.pyuse_pretextflag + script injection in_wrap_html()export.py__pretextReadybefore Playwright screenshotmodern_hero.pycolor_scheme.pyfill: currentColorrule for SVG text theme inheritancemcp_server.pytext_renderparam ongenerate_graphictoolrendering.py+cli.py+cli_create.pyTest plan
--theme arcadehero renders identically to before--text-render pretext --theme arcadehero renders with SVG text🤖 Generated with Claude Code