File format
A .nifdi.svg file is an augmented SVG: one file contains both a rendered vector image and the
structured diagram data nifdi needs for editing.
Why SVG
Section titled “Why SVG”The visible part of the file is standard SVG. You can view it in a browser, embed it in a web page or README, and use it in software that accepts SVG without first exporting a separate image.
The .nifdi.svg suffix makes the file’s second purpose explicit and helps tools distinguish an
editable nifdi diagram from an ordinary SVG asset.
What nifdi adds
Section titled “What nifdi adds”Inside the SVG’s metadata element, nifdi stores a namespaced description of the diagram: its
blocks, paths, hierarchy, placements, styles, and title. nifdi reads that model when it reopens the
file and regenerates the rendered SVG from it when the diagram is saved.
A text block’s words are stored as markdown in its <text> element, one
line per line of text, so a multi-line block reads as it was written.
The rendered image and editable model therefore travel together. There is no separate source file to keep in sync, and the file can be stored, shared, or committed to version control like any other project file.
What travels with the file
Section titled “What travels with the file”A .nifdi.svg is self-contained, so it looks the same on a machine that has never run nifdi:
- the fonts its text uses are embedded;
- images and graphics you imported are embedded;
- each third-party icon carries its author, licence and attribution.
In version control
Section titled “In version control”Commit .nifdi.svg files alongside the code they describe. GitHub and other hosts show them as
images wherever an image can go: in the file browser, in a README or wiki page, and in pull request
comments. To edit one, open it from your checkout in nifdi; in Chrome it is saved back to the same
file as you work (see local-file).
The @nifdi/mcp package includes a nifdi-mcp command
for Git workflows. It needs no nifdi account. Install it in your project, so that Git and CI run the
same version without downloading it each time:
npm install --save-dev @nifdi/mcpIt has three subcommands:
npx nifdi-mcp render <file>...regenerates the picture from the diagram after you edit the embedded XML by hand. With--checkit changes nothing and fails if any picture is out of date, which suits a CI step.npx nifdi-mcp textconv <file>prints the diagram’s canonical XML. As a Git diff driver it makesgit diffshow changes to the diagram rather than to the drawing.npx nifdi-mcp merge <base> <current> <other>is a Git merge driver. It merges the canonical XML and redraws the picture. If the XML conflicts, it leaves the conflicting XML in the file: resolve it, then runrender.
To use the last two, add this line to .gitattributes:
*.nifdi.svg diff=nifdi merge=nifdiThen configure the drivers in each clone:
git config diff.nifdi.textconv "npx nifdi-mcp textconv"git config merge.nifdi.driver "npx nifdi-mcp merge %O %A %B"Git runs the drivers from the top of the repository, where npx finds the installed command.
Handle the file as an editable document
Section titled “Handle the file as an editable document”Software that only understands SVG will ignore nifdi’s metadata and display the picture normally. However, an SVG optimiser or editor may remove that metadata, or may change only the rendered picture without updating the nifdi model. Those changes can make the file non-editable or disappear the next time nifdi saves it.
Keep the metadata intact and make lasting diagram changes in nifdi or through its
MCP tools. If you only need a final image for software that rewrites
SVG, work on a copy so the .nifdi.svg original remains editable.