Add support for UML rendering #1756

Closed
opened 2025-11-02 04:12:22 -06:00 by GiteaMirror · 11 comments
Owner

Originally created by @OmarAssadi on GitHub (May 5, 2018).

Hey, a bit of a feature request.

It would be great to get UML support in Gitea—PlantUML, especially. Unfortunately, I'm not aware of any native Go library for this, though. And, it seems the consensus is to minimize external dependencies.

For a rough idea as to what the final outcome might look like, it's worth taking a look at Gitlab's PlantUML integration - which can be found here.

Originally created by @OmarAssadi on GitHub (May 5, 2018). Hey, a bit of a feature request. It would be great to get UML support in Gitea—PlantUML, especially. Unfortunately, I'm not aware of any native Go library for this, though. And, it seems the consensus is to minimize external dependencies. For a rough idea as to what the final outcome might look like, it's worth taking a look at Gitlab's PlantUML integration - which can be found [here](https://docs.gitlab.com/ee/administration/integration/plantuml.html#creating-diagrams).
GiteaMirror added the type/proposaltype/feature labels 2025-11-02 04:12:22 -06:00
Author
Owner

@OmarAssadi commented on GitHub (May 5, 2018):

Here's a tiny starting bounty. If anyone else wants to contribute: bountysource issue

@OmarAssadi commented on GitHub (May 5, 2018): Here's a tiny starting bounty. If anyone else wants to contribute: [![bountysource issue](https://api.bountysource.com/badge/issue?issue_id=57996863)](https://www.bountysource.com/issues/57996863-add-support-for-uml-rendering)
Author
Owner

@OmarAssadi commented on GitHub (May 8, 2018):

Bumped the current bounty to $30.

@OmarAssadi commented on GitHub (May 8, 2018): Bumped the current bounty to $30.
Author
Owner

@lafriks commented on GitHub (May 8, 2018):

There is no go renderer so only possibility would be to use external renderer with plantuml Java command line tool

@lafriks commented on GitHub (May 8, 2018): There is no go renderer so only possibility would be to use external renderer with plantuml Java command line tool
Author
Owner

@OmarAssadi commented on GitHub (May 8, 2018):

Yeah, unfortunately, that seems to be the case. Personally, I'm not against having an optional integration with an external renderer, though. Not sure how everyone else feels, though.

@OmarAssadi commented on GitHub (May 8, 2018): Yeah, unfortunately, that seems to be the case. Personally, I'm not against having an optional integration with an external renderer, though. Not sure how everyone else feels, though.
Author
Owner

@markuman commented on GitHub (Jun 8, 2018):

There is no go renderer so only possibility would be to use external renderer with plantuml Java command line tool

java (jre) as an additional runtime dependency? Sounds not so good (also with the promise that gitea use less ressources and can be run on a raspberry pi).

@markuman commented on GitHub (Jun 8, 2018): > There is no go renderer so only possibility would be to use external renderer with plantuml Java command line tool java (jre) as an additional runtime dependency? Sounds not so good (also with the promise that gitea use less ressources and can be run on a raspberry pi).
Author
Owner

@OmarAssadi commented on GitHub (Jun 8, 2018):

@markuman if we went the route of using an external renderer like that, I would imagine this would be an optional feature

@OmarAssadi commented on GitHub (Jun 8, 2018): @markuman if we went the route of using an external renderer like that, I would imagine this would be an optional feature
Author
Owner

@techknowlogick commented on GitHub (Sep 11, 2018):

Closing due to external rendering support.

@techknowlogick commented on GitHub (Sep 11, 2018): Closing due to external rendering support.
Author
Owner

@karlredman commented on GitHub (Dec 5, 2018):

Hi, I'm sorry if there was a better place to comment. I guess this is just fyi....

[edited for additional info]

I wanted to add to the conversation that plantuml, for instance, could be supported via localhost. obviously this would mean installing graphviz and running a plantuml-server. In that sense a plantuml code block could be post processed via javascript that points to the local server. This would be a similar approach like highlight.js uses.

In the current v1.6.0 gitea manages direct server calls just fine (i.e here's an example without server routing but you get the point):

![local works](http://localhost:8989/plantuml/png/itBBB2ekKN1CBialikAoSipBByb8BOh9ImGBA2GMA_YcvXbnWRaWfZ6KQUMJ2DI6eie40000)

![remote not allowed](http://plantuml.com:80/plantuml/png/itBBB2ekKN1CBialikAoSipBByb8BOh9ImGBA2GMA_YcvXbnWRaWfZ6KQUMJ2DI6eie40000)

As I mentioned already, you could use server routing in such a way as to have a standardized FQDN that would be allowed as well. Anyway, I'm doing something like this on my personal server.

Note that via a local plantuml server this works too via proxy (note the offsite text file being referenced):

![local proxy to remote file](http://localhost:8989/plantuml/proxy?src=https://raw.github.com/plantuml/plantuml-server/master/src/main/webapp/resource/test2diagrams.txt)

[edit]
Additionally you can just generate the static images from the command line with the plantuml server jar file. Check out the cli instructions for plantuml.

# command that outputs png files to `images/`
java -jar ~/3rdparty/bin/plantuml.jar ./*.puml  -o images/
@karlredman commented on GitHub (Dec 5, 2018): Hi, I'm sorry if there was a better place to comment. I guess this is just fyi.... [edited for additional info] I wanted to add to the conversation that plantuml, for instance, could be supported via localhost. obviously this would mean installing graphviz and running a plantuml-server. In that sense a `plantuml` code block could be post processed via javascript that points to the local server. This would be a similar approach like highlight.js uses. In the current v1.6.0 gitea manages direct server calls just fine (i.e here's an example without server routing but you get the point): ``` ![local works](http://localhost:8989/plantuml/png/itBBB2ekKN1CBialikAoSipBByb8BOh9ImGBA2GMA_YcvXbnWRaWfZ6KQUMJ2DI6eie40000) ![remote not allowed](http://plantuml.com:80/plantuml/png/itBBB2ekKN1CBialikAoSipBByb8BOh9ImGBA2GMA_YcvXbnWRaWfZ6KQUMJ2DI6eie40000) ``` As I mentioned already, you could use server routing in such a way as to have a standardized FQDN that would be allowed as well. Anyway, I'm doing something like this on my personal server. Note that via a local plantuml server this works too via proxy (note the offsite text file being referenced): ``` ![local proxy to remote file](http://localhost:8989/plantuml/proxy?src=https://raw.github.com/plantuml/plantuml-server/master/src/main/webapp/resource/test2diagrams.txt) ``` [edit] Additionally you can just generate the static images from the command line with the plantuml server jar file. Check out the [cli instructions](http://plantuml.com/command-line) for `plantuml`. ```sh # command that outputs png files to `images/` java -jar ~/3rdparty/bin/plantuml.jar ./*.puml -o images/ ```
Author
Owner

@davidsvantesson commented on GitHub (Dec 29, 2019):

The way Gitlab support this is by using a plantuml server to generate the image (a public or private set up server). Thus they only need to compress and encode the text in base64. The resulting rendered page in GL looks like this:

<img src="http://www.plantuml.com/plantuml/png/[zlib-b64-encoded-string]" >

A more generic way to add support for this would be to add support for the following features:

  • Allow external renders to output content other than html (images and possibly other formats that can be displayed directly like pdfs). It would be possible already now by having a wrapper script that generates an html img tag for the output from the renderer.
  • Allow external render/highligher for code blocks. So you specify that code blocks for plantuml shall be using an external command to generate the output (can be html or image)
@davidsvantesson commented on GitHub (Dec 29, 2019): The way Gitlab support this is by using a plantuml server to generate the image (a public or private set up server). Thus they only need to compress and encode the text in base64. The resulting rendered page in GL looks like this: ``` <img src="http://www.plantuml.com/plantuml/png/[zlib-b64-encoded-string]" > ``` A more generic way to add support for this would be to add support for the following features: - Allow external renders to output content other than html (images and possibly other formats that can be displayed directly like pdfs). It would be possible already now by having a wrapper script that generates an html img tag for the output from the renderer. - Allow external render/highligher for code blocks. So you specify that code blocks for `plantuml` shall be using an external command to generate the output (can be html or image)
Author
Owner

@zeripath commented on GitHub (Dec 29, 2019):

I think mermaid js has some way of doing this

@zeripath commented on GitHub (Dec 29, 2019): I think mermaid js has some way of doing this
Author
Owner

@juergenhoetzel commented on GitHub (May 8, 2020):

Just for the record. I'm using the following external-renderer setup.

Required Software

  1. pandoc: Available via package manager
  2. plantuml
  3. pandoc-plantuml-filter: Installed via pip

Gitea Config

[markup.markdown]                                                                                                                     
ENABLED                = true                                                                                                         
FILE_EXTENSIONS = .md,.markdown                                                                                                       
RENDER_COMMAND  = pandoc -f markdown -t html --filter pandoc-plantum

Apache Rewerse Proxy

A RewriteRule is required to fix the URL-Path of the generated images :

<Directory "PATH_TO_GITEA_INSTALLATION/plantuml-images">                                                                                             
       AllowOverride None                                                                                                                
       Require all granted                                                                                                               
</Directory>                                                                                                                          
                                                                                                                                       
Alias /plantuml-images/ /PATH_TO_GITEA_INSTALLATION/plantuml-images/                                                                                    
RewriteEngine On                                                                                                                      
RewriteRule "^/.+/plantuml-images/([a-z0-9]*).svg$" "/plantuml-images/$1.svg" [R,L]                                                   
ProxyPass /plantuml-images !        
ProxyPass / http://127.0.0.1:3000/ nocanon
AllowEncodedSlashes NoDecode
ProxyPassReverse / http://127.0.0.1:3000/

@juergenhoetzel commented on GitHub (May 8, 2020): Just for the record. I'm using the following external-renderer setup. Required Software ============== 1. [pandoc](https://pandoc.org/): Available via package manager 2. [plantuml](https://plantuml.com/de/download) 3. [pandoc-plantuml-filter](https://github.com/timofurrer/pandoc-plantuml-filter): Installed via `pip` Gitea Config ========== ``` [markup.markdown] ENABLED = true FILE_EXTENSIONS = .md,.markdown RENDER_COMMAND = pandoc -f markdown -t html --filter pandoc-plantum ``` Apache Rewerse Proxy =================================== A `RewriteRule` is required to fix the URL-Path of the generated images : ``` <Directory "PATH_TO_GITEA_INSTALLATION/plantuml-images"> AllowOverride None Require all granted </Directory> Alias /plantuml-images/ /PATH_TO_GITEA_INSTALLATION/plantuml-images/ RewriteEngine On RewriteRule "^/.+/plantuml-images/([a-z0-9]*).svg$" "/plantuml-images/$1.svg" [R,L] ProxyPass /plantuml-images ! ProxyPass / http://127.0.0.1:3000/ nocanon AllowEncodedSlashes NoDecode ProxyPassReverse / http://127.0.0.1:3000/ ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#1756