#391

@json-render/image: pass extra options through to Satori

Openindividual11opened 1mo ago

renderToSvg and renderToPng call Satori with only width, height and fonts, so the rest of Satori's options aren't available.

My usecase is selectable text in SVGs. I'm using json-render in tsquare, which renders wireframes from text to SVG for docs and Notion. Satori's embedFont: false keeps text as <text> elements instead of outlines, so it can be selected and searched (for example, in a PDF). Today the only way to use it is to copy buildTree and call Satori directly.

The same pass-through would also cover non-Latin text and emoji. Satori draws a box for any character the given fonts don't cover, and its fix, loadAdditionalAsset (as in @vercel/og), can't be passed through either.

Would you accept either of these?

  1. An optional satori or satoriOptions field in the options, spread into the Satori call:
    renderToSvg(spec, { fonts, satori: { embedFont: false } })
  2. Exporting buildTree, so callers can run Satori themselves.

Happy to send a PR for whichever you prefer.

Activity

0

No activity yet.