Skip to content

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

Open

Description

@individual11

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions