sphinx-contrib / plantuml

BSD 2-Clause "Simplified" License
113 stars 42 forks source link

Feature Request: use Web service interface of plantuml #21

Open perrinjerome opened 5 years ago

perrinjerome commented 5 years ago

Instead of spawning a subprocess, it would be nice to use the "Web service mode" as described on https://plantuml.com/server . This could simplify the setup, instead of having to install java and plantuml locally, we could just use a plantuml installed in a central place. People who don't want to bother with installing their own plantuml server can probably use https://www.plantuml.com/plantuml/

This could be a new configuration option, like plantuml_webservice_url ( default https://www.plantuml.com/plantuml/ )

About implementation detail, plantuml web service mode works by encoding the diagram source code in the URL string, like https://www.plantuml.com/plantuml/png/SyfFKj2rKt3CoKnELR1Io4ZDoSa70000

It's described in https://plantuml.com/text-encoding and theres's a python implementation on pypi ( https://pypi.org/project/plantuml/ ) Implementation is a bit complex, so I guess it's better to depend on that package instead of reimplementing it, even if it looks trivial according to the doc.

PS: Even in html mode, I believe the image should be downloaded in _static dir and not included from the plantuml server as https://www.plantuml.com/plantuml/png/SyfFKj2rKt3CoKnELR1Io4ZDoSa70000 .

yuja commented 5 years ago

Seems fine as an optional feature. Patches are welcome.

tomghyselinck commented 4 years ago

Hi,

This would be a great feature!

I also suppose using https://github.com/dougn/python-plantuml would be the way to go. Dependencies are probably best optional and thus managed with 'extras_require'.

tomghyselinck commented 4 years ago

I hav some proof-of-concept in use at https://github.com/tomghyselinck/sphinxcontrib-plantuml/tree/feature-plantuml-server

MikeSmithEU commented 4 years ago

FYI For those seeking to generate diagrams on a remote server I've just added a Gravizo Sphinx extension to sphinx-contrib that may fit your use-case (or be a temporary work-around):

https://github.com/sphinx-contrib/gravizo

It was written as a pragmatic solution to easily allow PlantUML rendering on readthedocs.io without having to pre-render locally and polluting the git repository with auto-generated files.