# Possible to put port attribute on \<tr\>?

**URL:** <https://forum.graphviz.org/t/possible-to-put-port-attribute-on-tr/1948>\
**Category:** Help\
**Created:** [December 26, 2023, 3:42am UTC](https://forum.graphviz.org/t/possible-to-put-port-attribute-on-tr/1948 "2023-12-26T03:42:58Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmjdev](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/cmjdev/32/1295_2.png) [@cmjdev](https://forum.graphviz.org/u/cmjdev)\
**Post date:** [December 26, 2023, 3:42am UTC](https://forum.graphviz.org/t/possible-to-put-port-attribute-on-tr/1948/1 "2023-12-26T03:42:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![scnorth](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/scnorth/32/89_2.png) [@scnorth](https://forum.graphviz.org/u/scnorth)\
**Post date:** [December 26, 2023, 1:14pm UTC](https://forum.graphviz.org/t/possible-to-put-port-attribute-on-tr/1948/2 "2023-12-26T13:14:08Z")

</div>

You’re correct. The parsing of table rows happens around [here](https://gitlab.com/graphviz/graphviz/-/blob/main/lib/common/htmlparse.y?ref_type=heads#L535). Any implementation of ports on rows would probably have to be done under [portToTbl](https://gitlab.com/graphviz/graphviz/-/blob/main/lib/common/htmltable.c?ref_type=heads#L900). The [rows of HTML tables](https://gitlab.com/graphviz/graphviz/-/blob/main/lib/common/htmltable.h?ref_type=heads#L110) 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.

---

<div class="post-metadata">

**Author:** ![steveroush](https://avatars.discourse-cdn.com/v4/letter/s/a9adbd/32.png) [@steveroush](https://forum.graphviz.org/u/steveroush)\
**Post date:** [December 26, 2023, 2:48pm UTC](https://forum.graphviz.org/t/possible-to-put-port-attribute-on-tr/1948/3 "2023-12-26T14:48:00Z")

</div>

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:

```auto
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](https://global.discourse-cdn.com/graphviz/original/2X/7/7d3a3274710f594b64ba9d7fc92a2fdecb49ed38.png)

---

<div class="post-metadata">

**Author:** ![bthorsted](https://avatars.discourse-cdn.com/v4/letter/b/5daacb/32.png) [@bthorsted](https://forum.graphviz.org/u/bthorsted)\
**Post date:** [March 5, 2025, 10:07am UTC](https://forum.graphviz.org/t/possible-to-put-port-attribute-on-tr/1948/4 "2025-03-05T10:07:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mark](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/mark/32/84_2.png) [@mark](https://forum.graphviz.org/u/mark)\
**Post date:** [March 5, 2025, 10:21am UTC](https://forum.graphviz.org/t/possible-to-put-port-attribute-on-tr/1948/5 "2025-03-05T10:21:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![smattr](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/smattr/32/85_2.png) [@smattr](https://forum.graphviz.org/u/smattr)\
**Post date:** [March 7, 2025, 3:04am UTC](https://forum.graphviz.org/t/possible-to-put-port-attribute-on-tr/1948/6 "2025-03-07T03:04:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![scnorth](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/scnorth/32/89_2.png) [@scnorth](https://forum.graphviz.org/u/scnorth)\
**Post date:** [March 7, 2025, 1:15pm UTC](https://forum.graphviz.org/t/possible-to-put-port-attribute-on-tr/1948/7 "2025-03-07T13:15:16Z")

</div>

That would be nice, though it sounds nontrivial.

---

<div class="post-metadata">

**Author:** ![steveroush](https://avatars.discourse-cdn.com/v4/letter/s/a9adbd/32.png) [@steveroush](https://forum.graphviz.org/u/steveroush)\
**Post date:** [March 7, 2025, 9:36pm UTC](https://forum.graphviz.org/t/possible-to-put-port-attribute-on-tr/1948/8 "2025-03-07T21:36:44Z")

</div>

- 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

---

<div class="post-metadata">

**Author:** ![scnorth](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/scnorth/32/89_2.png) [@scnorth](https://forum.graphviz.org/u/scnorth)\
**Post date:** [March 9, 2025, 7:48pm UTC](https://forum.graphviz.org/t/possible-to-put-port-attribute-on-tr/1948/9 "2025-03-09T19:48:33Z")

</div>

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.
