Hi –
I need to get the SVG generation of graphviz to work better for the macos obsidian app. The problem appear to be that html anchor elements ("<a …>") use “xlink:href” instead of plain old “href=”, and that the graphviz “class=” directives need to annotate the
Mermaid generates this, which does the url correctly, but apparently can’t be correctly css styled:
<g class="node default internal-link" id="flowchart-C-3586" transform="translate(297.81249237060547, 36.0000057220459)">
<rect class="basic label-container" style="" rx="0" ry="0" x="-85.75" y="-28.0000057220459" width="171.5" height="56.0000114440918"></rect>
<g class="label" style="" transform="translate(-78.25, -20.5000057220459)">
<foreignObject width="156.5" height="41.0000114440918">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;">
<a class="internal-link" href="cooperation">cooperation</a>
</div></foreignObject></g></g>
Graphviz generates this, which does annotate the url correctly, but has all the correct css styling:
<g id="node21" class="node">
<title>OUT2</title>
<g id="a_node21"><a xlink:href="cooperation" xlink:title=" BASIC CATEGORY THEORY " target="_top">
<polygon fill="none" stroke="red" stroke-width="3" points="720.07,-647.48 510.07,-647.48 510.07,-611.48 720.07,-611.48 720.07,-647.48"></polygon>
<text text-anchor="middle" x="615.07" y="-625.78" font-family="Times,serif" font-size="14.00" fill="blue"> BASIC CATEGORY THEORY </text>
</a>
</g>
</g>
Hacking the graphviz generated SVG to this worked:
<g id="node21" class="node **default internal-link**">
<title>OUT2</title>
<g id="a_node21"><a xlink:title=" BASIC CATEGORY THEORY " target="_top" **class="internal-link"** **href**="cooperation">
<polygon fill="none" stroke="red" stroke-width="3" points="720.07,-647.48 510.07,-647.48 510.07,-611.48 720.07,-611.48 720.07,-647.48"></polygon>
<text text-anchor="middle" x="615.07" y="-625.78" font-family="Times,serif" font-size="14.00" fill="blue"> BASIC CATEGORY THEORY </text>
</a>
</g>
</g>
where the changes are in **bold**.
How should I go about making this change? Where in the source code should I look?
Thanks!
– Perry