# The SVG based tree render plugin
#### Synopsis
:- use_rendering(svgtree).
:- use_rendering(svgtree, Options).
#### Options supported
- list(Boolean)
It `false`, do not render a list as a tree. Rendering lists as a tree
has didactic values but is otherwise mostly confusing.
- filter(:NodeFilter)
If present, use call(NodeFilter, Term, Label, Children)
to extract the label and children of a term. Operates
on terms for which this call succeeds on the top node.
If the call fails on a child, the child is rendered as
a term.
#### Reconised terms
Any compound term. If a `filter` options is provided, any term that can be
translated by the filter.
## Examples
The [English grammar](example/grammar.pl) provides an example that renders a parse tree. A first usage is explanation of the tree structure of Prolog terms.
:- use_rendering(svgtree).
Tree = a(_, b("hello"), [x,y,z]).
The answer rendering is applied *after* SWISH *removes* cycles from the answer. This means that cyclic terms can be handed to it, but the result might not be what you expected.
Tree = a(Tree).
## Using filters to create a tree from custom data
Suppose the data for our tree is stored in the database, like below and we would like to create a tree from this. We do this by defining a _filter_.
:- use_rendering(svgtree, [filter(myfilter)]).
node('The Netherlands', ['Noord Holland', 'Zuid Holland', 'Utrecht']).
node('Noord Holland', ['Amsterdam', 'Alkmaar', 'Volendam']).
node('Amsterdam', ['Amsterdam Zuid', 'Amsterdam Centrum', 'Amsterdam Noord']).
myfilter(Name, Name, Children) :-
node(Name, Children).
A = 'The Netherlands'.