hediet / vscode-drawio

This unofficial extension integrates Draw.io (also known as diagrams.net) into VS Code.
https://marketplace.visualstudio.com/items?itemName=hediet.vscode-drawio
GNU General Public License v3.0
9.06k stars 409 forks source link

Mathematical Typesetting Exporting Issue #180

Open xz348 opened 3 years ago

xz348 commented 3 years ago

When the "Mathematical Typesetting" is enabled, the exported images (both .svg and .png) are not correctly formatted. All the texts are shown in plain text (like "$$f(x)$$") but not the stylized way.

hediet commented 3 years ago

This is the explanation for this:

  1. You create/update a math-formatted text in Draw.io.
  2. Draw.io only renders the plain text for now.
  3. Immediately after that, the Draw.io webview sends the current diagram source to VS Code
  4. VS Code keeps that diagram source in an internal buffer
  5. Some time after that, Draw.io renders the text as math-formula.
  6. If you press save, the internal buffer that still has the plain-text rendering is persisted to disk.

Result: VS Code only persists a diagram where the created/updated text is not rendered yet as plain text.

  1. If you change something unrelated to the math-formatted text in the diagram, the Draw.io webview will send the current diagram source to VS Code again - this time however, with the formatted text.

Result: The text in the persisted diagram is rendered as math formula.

This seems like a bug in Draw.io when used in embed-mode. I hope this workaround helps.

I'm unsure how to fix this. The Draw.io export command should wait until all images are rendered.

hedwigz commented 3 years ago

Hello! I am also experiencing this!
I didn't understand the workaround though? I changed something unrelated to the formulas and the exported file is still broken.
BTW this extension is awesome, thank you :)

hediet commented 3 years ago

The workaround is: Change something unrelated in your diagram (like add a node and then remove it). Then save.

dualer commented 3 years ago

@hediet Sorry for my ignorance. What's the meaning of a node? After writing some latex math code, i.e. $$ something$$, I add some elements, e.g. a circle, then save the file, and export to .png or .svg file. I still cannot get the right math output.

hediet commented 3 years ago

Then the workaround no longer works 😞

dualer commented 3 years ago

Then the workaround no longer works 😞

Oh, it's frustrating. Looking forward to other solutions. (☆▽☆)

silviu-oprea commented 2 years ago

Any news about this?

nxphi47 commented 2 years ago

+1

hediet commented 2 years ago

no news here, maybe I will have some time to look into it when I have to go to quarantine/isolation, which I guess will happen soon here :D

viandres commented 2 years ago

@hediet Is there an update on this? I have the same problem right now and I wonder if there is a workaround yet?

hediet commented 2 years ago

Not that I know of. I'll try to investigate as soon as I find some time.

happyTonakai commented 1 year ago

So why not consider to release a new version?