# SerializeOptions

Import it from `@grafloria/renderer`.

```ts
interface SerializeOptions
```

**Properties**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `fidelity?` | `SerializeFidelity` |  | Who reads the output. Default `'file'`. See {@link SerializeFidelity}. |
| `standalone?` | `boolean` |  | Stamp `xmlns` on the root element (needed for a standalone `.svg` file). |
| `classStyles?` | `ClassStyleResolver` |  | Resolves an element's classes to the presentation attributes the renderer's stylesheet would have painted. Omit for a tree rendered in programmatic mode (there is no stylesheet there — every value is already on the element). Ignored under `fidelity: 'dom'` — the client has the real stylesheet. |
| `foreignObject?` | `ForeignObjectMode` |  | How to handle `<foreignObject>` subtrees. Default `'serialize'`. |
| `captureForeignObject?` | `(vnode: VNode) => string \| undefined` |  | Faithful foreignObject export. The VNode tree does NOT contain the HTML a framework mounted into a foreignObject (the patcher treats those subtrees as opaque and never touches their children) — so a headless serializer CANNOT know what is in there. A browser-side caller that has the live DOM can hand the markup back through this hook (e.g. |
| `warnings?` | `string[]` |  | Collector for fidelity caveats hit while serializing. |
| `extraDefs?` | `Map<string, string>` |  | Collector for `<defs>` elements the serializer had to synthesize (blur filters). |
| `html?` | `boolean` |  | This subtree is XHTML, not SVG (i.e. it is inside a `<foreignObject>`). Set automatically when recursing into one — HTML has no presentation attributes, so there the `style` attribute is kept verbatim and no class flattening is attempted (the host's own CSS, which we do not own, styles that content). |
