html标签中的graphviz自动式TD宽度

发布于 2025-02-04 15:19:59 字数 1374 浏览 3 评论 0原文

使用以下dot

digraph structs {
node [shape=plaintext]
struct1 [label=<
<table border="1">
    <tr>
        <td align="left">
            <TABLE  border="1">
                <TR>
                    <TD align="left">one</TD>
                    <TD align="left">long text here</TD>
                    <TD align="left">c</TD>
                </TR>
            </TABLE>
        </td>
    </tr>
    <tr>
        <td align="left">
            <TABLE  border="1">
                <TR>
                    <TD align="left">very long text present here</TD>
                    <TD align="left">colb</TD>
                    <TD align="left">colc</TD>
                </TR>
            </TABLE>
        </td>
    </tr>
</table>
>];
}

graphViz产生下面的图像(我的笔记为红色):

< img src =“ https://i.sstatic.net/bjhkr.png” alt =“在此处输入映像说明”>

现在,如果我从上方拿出表HTML并在浏览器中渲染,我会得到我也希望从GraphViz:

​?

如果不可能,我如何输入节点标签,以便获得与浏览器返回相同的结果?

谢谢。

With the following dot

digraph structs {
node [shape=plaintext]
struct1 [label=<
<table border="1">
    <tr>
        <td align="left">
            <TABLE  border="1">
                <TR>
                    <TD align="left">one</TD>
                    <TD align="left">long text here</TD>
                    <TD align="left">c</TD>
                </TR>
            </TABLE>
        </td>
    </tr>
    <tr>
        <td align="left">
            <TABLE  border="1">
                <TR>
                    <TD align="left">very long text present here</TD>
                    <TD align="left">colb</TD>
                    <TD align="left">colc</TD>
                </TR>
            </TABLE>
        </td>
    </tr>
</table>
>];
}

Graphviz yields the image below (my notes with red):

enter image description here

Now, if I take the table HTML from above and render it in the browser, I get what I would also expect from Graphviz:

enter image description here

Question: how can i get Graphviz to render the table same as the browser does (no extra-space inside the columns, but instead have it after the last column) ?

If it's not possible, how do I input the node label so that I get the same result as the browser returns?

Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

○闲身 2025-02-11 15:19:59

可能的解决方法:

digraph structs {
node [shape=plaintext]
struct1 [label=<
<table border="1">
    <tr>
        <td align="left">
            <TABLE border="0" width="1" fixedsize="true" align="left" cellpadding="0" cellsborder="0" CELLSPACING="0">
                <TR>
                    <TD align="left">
            <TABLE  border="1" >
                <TR>
                    <TD align="left">one</TD>
                    <TD align="left">long text here</TD>
                    <TD align="left">c</TD>
                </TR>
            </TABLE>
                    </TD>
                </TR>
            </TABLE>
        </td>
    </tr>
    <tr>
        <td align="left">
            <TABLE  border="1">
                <TR>
                    <TD align="left">very long text present here</TD>
                    <TD align="left">colb</TD>
                    <TD align="left">colc</TD>
                </TR>
            </TABLE>
        </td>
    </tr>
</table>
>];
}

呈现: http://viz-js.com/

Possible workarounds:

digraph structs {
node [shape=plaintext]
struct1 [label=<
<table border="1">
    <tr>
        <td align="left">
            <TABLE border="0" width="1" fixedsize="true" align="left" cellpadding="0" cellsborder="0" CELLSPACING="0">
                <TR>
                    <TD align="left">
            <TABLE  border="1" >
                <TR>
                    <TD align="left">one</TD>
                    <TD align="left">long text here</TD>
                    <TD align="left">c</TD>
                </TR>
            </TABLE>
                    </TD>
                </TR>
            </TABLE>
        </td>
    </tr>
    <tr>
        <td align="left">
            <TABLE  border="1">
                <TR>
                    <TD align="left">very long text present here</TD>
                    <TD align="left">colb</TD>
                    <TD align="left">colc</TD>
                </TR>
            </TABLE>
        </td>
    </tr>
</table>
>];
}

rendered on: http://viz-js.com/

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文