Possible to put port attribute on <tr>?

The documentation states there’s no attributes on TR tags (Html like labels). This seems odd to me. It’s rough managing the left/right ports when I start adding data to a row. It seems like it would be easier to implement this on a row level vs a cell level. Am I missing some reason as to why this is the case?

Any input is much appreciated.

You’re correct. The parsing of table rows happens around here. Any implementation of ports on rows would probably have to be done under portToTbl. The rows of HTML tables are somehow implemented using the cdt dictionaries that we use a lot in other places in graphviz, so this representation would have to be extended somehow to have port identifiers. It looks like a lot of little details. @erg might be able to give more specific advice since he wrote this code.

Maybe this accomplishes what you want. You can embed an HTML table within another HTML table (cell : <TD> label </TD>).
If you can explicitly set cell widths (admittedly a big if), this might work for you:

digraph {
 
    node [shape=plain]
    { rank=same
      a b c
      Foo [label=<
       <table border="0" cellborder="1" cellspacing="0"  cellpadding="0">
         <tr>  <td port="1">
           <table border="0" cellborder="1" cellspacing="0">
             <tr>  <td port="66" width="100">six</td> <td width="100"> two </td></tr>
           </table>
        </td></tr>
        <tr>  <td port="2">
          <table border="0" cellborder="1" cellspacing="0">
            <tr>  <td port="77" width="100">seventeen</td> <td width="100"> million </td></tr>
          </table>
        </td></tr>
        <tr>  <td port="3">two</td></tr>
      </table>>];
    }
    a -> Foo:1:w
    b -> Foo:1:e
    c -> Foo:2
}

Giving:
tableInTable

Any chance of this feature being implemented? It seems like an obvious place to improve functionality of graphviz :slight_smile:

we are a bit low on volunteers right now; pull requests welcome?

If someone was going to do this, I would vote for a full rip-and-replace, subbing in a full HTML parser making ~all of HTML supported.

That would be nice, though it sounds nontrivial.

1 Like
  • not voting on this, intriguing but daunting
  • if replacing w/ complete HTML parser, would that include CSS?
  • how long would we need to support both old & new versions?
  • all-in-all not going to hold my breath

Just guessing, the proposal is probably initially plug in a full HTML parser, then extract parse tree components that graphviz currently recognizes and can process. Then perhaps this could be further enhanced. I agree, introducing a full web renderer in graphviz seems really ambitious.