A typst wasm plugin to use graphviz directly inside documents
C
155
281 commits
updated Apr 3, 2026
A simple Graphviz binding for Typst using the WebAssembly plugin system.
[!NOTE] If you want to access the layouts engines without having to use dot language, there is now a new plugin called diagraph-layout. This plugin is more low level and doesn't comes with a renderer.
This plugin is quite simple to use, you just need to import it:
#import "@preview/diagraph:0.3.7": *
You can render a Graphviz Dot string to a SVG image using the render function:
#render("digraph { a -> b }")
Alternatively, you can use raw-render to pass a raw instead of a string:
#raw-render(
```dot
digraph {
a -> b
}
```
)

For more information about the Graphviz Dot language, you can check the official documentation.
Check the manual for more information about the plugin.
This project was built with emscripten 3.1.46. Apart from that, you just need to run make wasm to build the wasm file. All libraries are downloaded and built automatically to get the right version that works.
There are also some other make commands:
make link: Link the project to the typst plugin foldermake clean: Clean the build folder and the linkmake clean-link: Only clean the linkmake compile_database: Generate the compile_commands.json filemake module: It copy the files needed to run the plugin in a folder called graphviz in the current directorymake manual: Generate the manual pdfmake wasi-stub: Build the wasi stub executable, it require a rust toolchain properly configuredSomme functions need to be stubbed to work with the webassembly plugin system. The wasi-stub executable is a spetial one fitting the needs of the typst plugin system. You can find the source code here. It is important to use this one as the default subbed functions are not the same and the makefile is suited for this one.
This package also uses a protocol generator to generate the wasm interface. You can find the source code here. It is a required dependency to build this project.
This project is licensed under the MIT License - see the LICENSE file for details
adjacency functionalt parameter to the render and raw-render functions to specify an alternative text for the imagestretch to containfontcolor, fontsize and fontname nodes attributeswidth and height argumentsraw-render-rule show rule because it doesn't allow use of custom font and the render / raw-render functions are more flexiblebackground parameter to the render and raw-render typst functions and default it to transparent instead of whiterender c functionInitial working version
C
60.6%
Typst
36.2%
Makefile
3.2%
A typst wasm plugin to use graphviz directly inside documents
C
155
281 commits
updated Apr 3, 2026
A simple Graphviz binding for Typst using the WebAssembly plugin system.
[!NOTE] If you want to access the layouts engines without having to use dot language, there is now a new plugin called diagraph-layout. This plugin is more low level and doesn't comes with a renderer.
This plugin is quite simple to use, you just need to import it:
#import "@preview/diagraph:0.3.7": *
You can render a Graphviz Dot string to a SVG image using the render function:
#render("digraph { a -> b }")
Alternatively, you can use raw-render to pass a raw instead of a string:
#raw-render(
```dot
digraph {
a -> b
}
```
)

For more information about the Graphviz Dot language, you can check the official documentation.
Check the manual for more information about the plugin.
This project was built with emscripten 3.1.46. Apart from that, you just need to run make wasm to build the wasm file. All libraries are downloaded and built automatically to get the right version that works.
There are also some other make commands:
make link: Link the project to the typst plugin foldermake clean: Clean the build folder and the linkmake clean-link: Only clean the linkmake compile_database: Generate the compile_commands.json filemake module: It copy the files needed to run the plugin in a folder called graphviz in the current directorymake manual: Generate the manual pdfmake wasi-stub: Build the wasi stub executable, it require a rust toolchain properly configuredSomme functions need to be stubbed to work with the webassembly plugin system. The wasi-stub executable is a spetial one fitting the needs of the typst plugin system. You can find the source code here. It is important to use this one as the default subbed functions are not the same and the makefile is suited for this one.
This package also uses a protocol generator to generate the wasm interface. You can find the source code here. It is a required dependency to build this project.
This project is licensed under the MIT License - see the LICENSE file for details
adjacency functionalt parameter to the render and raw-render functions to specify an alternative text for the imagestretch to containfontcolor, fontsize and fontname nodes attributeswidth and height argumentsraw-render-rule show rule because it doesn't allow use of custom font and the render / raw-render functions are more flexiblebackground parameter to the render and raw-render typst functions and default it to transparent instead of whiterender c functionInitial working version
C
60.6%
Typst
36.2%
Makefile
3.2%