Imports
If your diagram imports other D2 files, pass their paths and
contents to renderSVG() in fs. Set inputPath to the file to render.
In the getting started example, replace the renderSVG()
call with this one.
const svg = await d2.renderSVG({
fs: {
"main.d2": "client -> db\ndb: @database",
"database.d2": "shape: cylinder",
},
inputPath: "main.d2",
});
Here, db takes its cylinder shape from database.d2.