layout icon indicating copy to clipboard operation
layout copied to clipboard

Supporting html labels

Open drahnr opened this issue 2 years ago • 7 comments

Hey, thank you for writing the crate. I am currently working with an svg generation library that makes use of html like labels (https://graphviz.org/doc/info/shapes.html#html) which this crate does not support just yet.

Would you be interested in accepting a PR for support?

drahnr avatar Sep 21 '23 12:09 drahnr

Thank you for reaching out. This feature is indeed missing. Can you tell me more how you plan to implement this feature?

nadavrot avatar Sep 22 '23 04:09 nadavrot

My initial idea would be to add < and > as bracket like enclosings, and using the content inbetween as input to either https://crates.io/crates/hard-xml or https://crates.io/crates/xml-rs and defining all supported items manually. Text is natively supported in SVGs: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/text

Rendering tables is the most tricky part, so I'd punt on that for now, https://tink.uk/accessible-svg-tables/ outlines a path to get there, but it requires a few more moving parts, i.e. how to size the table elements - I am not yet sure if one can avoid to do text and glyph placement to obtain i.e. the width of a column.

drahnr avatar Sep 22 '23 08:09 drahnr