sphinxcontrib-nwdiag

sphinxcontrib-nwdiag is sphinx extension for embedding nwdiag diagrams. You can embed block diagrams with nwdiag directive.

.. nwdiag::

    nwdiag {
      network dmz {
          web01;
          web02;
      }
    }

None

Setting

You can get archive file at http://bitbucket.org/birkenfeld/sphinx-contrib/

Install

$ sudo easy_install sphinxcontrib-nwdiag

Configure Sphinx

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'

Directive

.. nwdiag:: [filename]

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

None

Name Description
A web server01
B web server02
C database server

Configuration File Options

nwdiag_fontpath

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.

nwdiag_antialias

If nwdiag_antialias: is True, nwdiag generates images with anti-alias filter.

nwdiag_html_image_format

You can specify image format on converting docs to HTML using nwdiag_html_image_format . nwdiag_html_image_format accepts ‘PNG’ or ‘SVG’ .

nwdiag_tex_image_format

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 .

Table Of Contents

Previous topic

Sample diagams: packetdiag

Next topic

Demo - interactive shell for nwdiag

This Page