The main API of ShowGraphviz.jl is @deriveall
. Given a type that defines
show
on DOT language MIME typetext/vnd.graphviz
, it defines show
methods
for various image types such as PNG, GIF, SVG, PDF, etc.
struct HelloWorld end
Base.show(io::IO, ::MIME"text/vnd.graphviz", ::HelloWorld) =
print(io, "digraph G {Hello->World}")
using ShowGraphviz
ShowGraphviz.@deriveall HelloWorld
svg = sprint(show, "image/svg+xml", HelloWorld())
occursin("<svg", svg)
# output
true
All top level functions and types (but not modules) defined in ShowGraphviz
are public API.
ShowGraphviz.@derive type mimes...
: Similar to@deriveall
but only define the methods with specifiedmimes
.ShowGraphviz.show(io, mime, x)
: showx
as an image of MIME typemime
usingdot
command line program.ShowGraphviz.setoption(io, option)
: Set command line option fordot
program viaIOContext
.ShowGraphviz.addoption(io, option)
: Append option.ShowGraphviz.getoption(io)
: Get option.
ShowGraphviz.DOT(source)
: a wrapper object that converts DOTsource
ShowGraphviz.dot"source"
: createDOT
using a string macroShowGraphviz.CONFIG.dot
:dot
commandShowGraphviz.CONFIG.dot_option
: globaldot
command option