Reference

Renderer port

The Renderer, RenderTargetInfo and RenderInput types, the render routes and events, and the createRenderer and markdownTarget adapter.

The server types come from packages/editor/src/server/ports.ts (@skaile/forge-editor/server), the wire types from packages/editor/src/core/backend-types.ts (@skaile/forge-editor/core), the adapter from @skaile/forge-editor/adapters/render. For how to add a target and what the editor shows, see Render.

Renderer

EditorPorts.render (capability render). The result is stored through EditorPorts.assets; without it POST /api/editor/render answers 501.

MemberTypeMeaning
targets(user: object) => Promise<RenderTargetInfo[]>The targets this user may use.
render(target, input, user, progress, signal) => Promise<{ data: Uint8Array, mime: string, fileName: string }>Renders input to target. progress is a RenderProgressReporter ((p: RenderProgress) => void); signal aborts when the client goes away. Throw to fail the render: the message reaches the client.

RenderTargetInfo

FieldTypeMeaning
idstringUnique among the targets of one renderer.
labelstringAlready in the user's language.
acceptsreadonly string[]Block type ids, or 'document' for a whole Document.
mimestringMIME type of the result.

RenderInput

FieldTypeMeaning
documentIdstringThe Document the result is stored under.
blockIdstring?Set for a Block; absent for the whole Document.
contentJSONContentThe Block's TipTap JSON, or the whole Document without blockId.
optionsRecord<string, unknown>?Target specific options.

Routes

Route (API key)RequestAnswer
GET /api/editor/render/targets (renderTargets)noneRenderTargetInfo[]
POST /api/editor/render (renderPost){ target: string, input: RenderInput }SSE: progress { phase: string, percent?: number }, then done { asset: string, fileName: string, mime: string } or error { message: string }

Both routes are served only when ports.render is present. Refusals before the stream starts: 400, 401, 403, 404 (unknown target), 422 (the target does not accept the Block type), 501 (no assets port).

EditorBackend['render']

MemberTypeMeaning
targets(signal?) => Promise<RenderTargetInfo[]>The targets of the user.
render(target, input, { onProgress?, signal? }?) => Promise<RenderResult>Streams one render. RenderResult is RenderDone (asset, fileName, mime) plus url of the stored asset. Rejects with the server's message when the render fails.

@skaile/forge-editor/adapters/render

ExportMeaning
createRenderer(targets)A Renderer over a list of RenderTargets. A repeated id keeps the first; render rejects with 404 for an unknown id.
RenderTargetRenderTargetInfo plus run(input, progress, signal).
markdownTarget(options?)The built-in target markdown (text/markdown); options schema, blockTypes, label.
Copyright © 2026