> ## Documentation Index
> Fetch the complete documentation index at: https://docs.docdiagram.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Repo sync

> How DocDiagram publishes diagrams into your docs repo.

When you attach a diagram to a docs page, the binding lives in DocDiagram until you **sync** it. Sync writes the rendered SVG into your connected GitHub repo so the diagram actually appears in your published docs (Mintlify, Docusaurus, plain MDX, etc.).

## States you'll see

On a docs page, each attached diagram shows one of three states:

* **Synced** (no label) — the SVG in your repo matches the current diagram.
* **Behind** — you've edited the diagram since the last push; the repo still has the old SVG.
* **Not synced** — the diagram has never been pushed. Your repo has no SVG file for it yet, so the page renders without it.

A "Sync" action appears on the diagram chip whenever the state is **behind** or **not synced**.

## What a sync does

Sync opens (or updates) a pull request on your repo that:

1. Writes the rendered SVG to a sidecar path next to the MDX page.
2. Leaves your MDX file untouched on the first attach (you reference the SVG yourself), or updates the existing reference on subsequent syncs.

Nothing is force-pushed and nothing lands on your default branch without your review.

## Slots

Most pages have one diagram, which uses the slot name `default`. If you attach more than one diagram to the same page, give each a distinct slot (`hero`, `architecture`, `data-flow`) so their SVG filenames don't collide.

## When to sync

* **Right after attaching** a new diagram, so the page stops rendering without it.
* **After edits**, when the chip shows "behind."
* Skip syncing if you're still iterating and don't want PR churn — bindings are safe to leave in the "not synced" state as long as you want.

## Next

<Card title="Projects" icon="folder" href="/concepts/projects">
  How DocDiagram organizes diagrams within a connected repo.
</Card>
