sphinxcontrib-nwdiag is sphinx extension for embedding nwdiag diagrams. You can embed block diagrams with nwdiag directive.
.. nwdiag::
nwdiag {
network dmz {
web01;
web02;
}
}
You can get archive file at http://bitbucket.org/birkenfeld/sphinx-contrib/
$ sudo easy_install sphinxcontrib-nwdiag
To enable this extension, add sphinxcontrib.nwdiag module to extensions option at conf.py.
# Enabled extensions
extensions = ['sphinxcontrib.nwdiag']
# Fontpath for nwdiag (truetype font)
nwdiag_fontpath = '/usr/share/fonts/truetype/ipafont/ipagp.ttf'
This directive insert a netuence diagram into the generated document. If filename is specified, sphinx reads external file as source script of blockfile. In another case, nwdiag directive takes code block as source script.
Examples:
.. nwdiag:: foobar.diag
.. nwdiag::
nwdiag {
// some diagrams are here.
}
This directive is able to generate thumbnail images using maxwidth option. maxwidth option takes pixel-size of image’s width.
Examples:
.. nwdiag::
:maxwidth: 240
nwdiag {
// some diagrams are here.
}
New in version 0.2.0.
This directive is able to generate description table using desctable option and description attribute
Input:
.. nwdiag::
:desctable:
nwdiag {
network {
A [address = 192.168.0.1, description = "web server01"];
B [address = 192.168.0.2, description = "web server02"];
}
network {
A [address = 172.0.0.1];
C [address = 172.0.0.2, description = "database server"];
}
}
Output
| Name | Description |
|---|---|
| A | web server01 |
| B | web server02 |
| C | database server |
This is a path for renderring fonts. You can use truetype font (.ttf) file path. You can specify single path with string, or multiple paths using array.
New in version 0.1.1.
If nwdiag_antialias: is True, nwdiag generates images with anti-alias filter.
You can specify image format on converting docs to HTML using nwdiag_html_image_format . nwdiag_html_image_format accepts ‘PNG’ or ‘SVG’ .
You can specify image format on converting docs to TeX using nwdiag_html_image_format . nwdiag_html_image_format accepts ‘PNG’ or ‘PDF’ .
If you set PDF, you will get clear diagram images as vector format. (*) reportlab is needed .