PlantUML Server integration with IDE

0 votes
asked Jun 11, 2016 in To be sorted by krasa (820 points)

Hello, 

Regarding IntelliJ plugin feature request https://github.com/esteinberg/plantuml4idea/issues/119

Use platuml's server (http://plantuml.com/plantuml/uml/IybCBqeio51mLwZcIbJGjLD8uge50000) is very convenient.I always edit plantuml in idea, and copy paste to plantuml's server to generate the link, then change the png to svg, then use this link in markdown.

 

plantuml4idea can generate the svg ,png or form link will be very useful.

 

I would like to ask how is the link generated?

I know I could just POST the content, and then open browser to the location returned in a header, but perhaps I could save you some bandwidth by generating the link myself...

Cheers.

1 Answer

0 votes
answered Jun 11, 2016 by plantuml (295,000 points)
selected Jun 11, 2016 by krasa
 
Best answer

The URL is generated using "PlantUML Text Encoding". You can indeed generate the link yourself. You have to:

  • Encode your text in UTF-8
  • Compress it using standard Deflate algorithm
  • Reencode the result in ASCII using a non-standard transformation (but close to base64) : bytes are grouped by 3, and each group of 3 bytes gives a 4 characters string. That's what the methods encode64() are doing in the PHP or Javascript example. Encoding this with other language should be easy.

See http://plantuml.com/codejavascript.html or http://plantuml.com/codephp.html

If you are using Java, you can even reuse the code from https://github.com/plantuml/plantuml/blob/master/src/net/sourceforge/plantuml/code/TranscoderUtil.java

Tell us if it helps!

Regards,

 

commented Jun 11, 2016 by krasa (820 points)
Perfect, I will use TranscoderUtil.java. Thanks!
commented Jul 31, 2023 by anonymous
According to https://plantuml.com/text-encoding, simple hex encoding ought to work too, but the sample on the page fails.
...