EFanZh / Graphviz-Preview

Extension for Visual Studio Code to preview Graphviz (DOT) files.
https://marketplace.visualstudio.com/items?itemName=EFanZh.graphviz-preview
MIT License
69 stars 5 forks source link

The "stylesheet" attribute doesn't seem to work #82

Open vkargov opened 1 day ago

vkargov commented 1 day ago

Hi,

I've noticed that the stylesheet attribute doesn't seem to work with the extension. If I have the following 2 files:

dotty_style.css:

.vegan {
    fill: green;
}

example.dot:

digraph {
    stylesheet="dotty_style.css"
    hello [class=vegan]
}

If I place the two files in the same directory and run dotty from the command line as follows:

dot -Tsvg example.dot -o example.svg && open example.svg

I will see green text (which is expected - that means the CSS style was applied to the hello node). However, if I open the same .dot file with this extension, the text remains black.

At first I thought maybe it was a cwd problem so I tried providing the same path in a few different ways, but it doesn't seem to help.

Is this a bug? Or was it intentionally disabled?

Anyway, thanks for the extension!

EFanZh commented 1 day ago

@vkargov: It is not intentionally disabled. I’ll take a look at it later.

vkargov commented 1 day ago

Thank you for confirming!! I think it might have to do with CSP. But I'm pretty clueless about how the Internet works so I may be getting this wrong.