Reputation: 1471
I've got a graphviz (2.38.0 (20140413.2041)) graph where each node contains a few lines of text and I'd like the different lines to be styled differently. Currently I have:
digraph G{
stylesheet = "styles.css";
graph[rankdir=BT];
node[shape=box];
Andrew[label=<
Andrew
<br />Red
<br />34
>];
James[label=<
James
<br />Yellow
<br />26
>];
Andrew -> James;
}
With stylesheet:
.name {
font-weight: bold;
}
.age{
color: blue;
}
And I'm hoping to be able to use a feature such as:
Andrew[label=<
<font class="name">Andrew</font>
<br />Red
<br /><font class="age">34</font>
>];
But unfortunately dot gives me:
Warning: Illegal attribute class in <FONT> - ignored
Warning: Illegal attribute class in <FONT> - ignored
I've had a search and couldn't find anything, so I'm not sure if there is preferred way of accomplishing what I'm trying to achieve (such as some sort of macro to generate repeated formatting) that I've missed.
Upvotes: 3
Views: 5757
Reputation: 2946
It looks like the subset of HTML that graphviz accepts doesn't include class
attribute inside <font>
<!-- Font specification -->
<FONT
COLOR="color"
FACE="fontname"
POINT-SIZE="value"
>
(from https://www.graphviz.org/doc/info/shapes.html#html)
And as you pointed in a comment,
dot complains about Unknown HTML element for div, p and span
They talk about it:
NOTE: The features and syntax supported by these labels are modeled on HTML. However, there are many aspects that are relevant to Graphviz labels that are not in HTML and, conversely, HTML allows various constructs which are meaningless in Graphviz. We will generally refer to these labels as "HTML labels" rather than the cumbersome "HTML-like labels" but the reader is warned that these are not really HTML. The grammar below describes precisely what Graphviz will accept.
Upvotes: 7