Repository navigation
Add an SVG export to the Card Builder - #344
Merged
Merged
Conversation
The card as the browser laid it out — the measurement the PDF already takes — written as SVG: vector text, figures embedded, and each link kept as an <a>, live where the file is opened or embedded inline. cardpdf.js's text ops now carry the width of the whole line, not its first character. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
|
Preview: https://ee539fb3.nstarkman-space.pages.dev Built from |
1 task done
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.
Changing code or schema
What and why: an SVG format beside PNG and PDF in the Card Builder, so a card can be exported as vector text with its link buttons intact.
src/lib/cardsvg.js(pure): writes the measured card — the same modelcardpdf.jshands Typst — as SVG. Text is vector withtextLengthpinned to the measured line, figures are embedded as data URIs, each linked part sits in an<a>.cardpdf.js: text ops now carry the width of the whole line (before, only the first character's), which the SVG needs and the PDF ignores.Builder:
svgis a format (settings, file name…-light.svg, download button, note). Both themes when following the reader, as for PNG.Caveat, stated in the builder's note: links are live when the SVG is opened or inlined, but a browser never runs links in an
<img>— GitHub READMEs included.Checked in a browser: the SVG of the unxt lead card against the CSS card (same layout; Plex falls back to the reader's fonts where not installed).
npm run test:schemapasses; 575 unit tests and the build pass;tests/cardsvg.test.jsrenders the output with sharp to prove it parses🤖 Generated with Claude Code