Display PlantUML diagrams in Bitbucket Server/DC UI using Markdown

Still need help?

The Atlassian Community is here for you.

Ask the community


Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

PlantUML is a tool that allows users to create diagrams from plain text. Sometimes users want PlantUML diagrams to be displayed on their Readme files on the Bitbucket Server UI. Currently external plugins for rendering PlantUML diagrams are only available for Bitbucket cloud.

In this document we will explore how we can display PlantUML diagrams in Bitbucket Server/DC UI using Markdown.


Solution

  • For on-prem Bitbucket server you can insert PlantUML diagrams in Markdown. In order to do this you first need a PlantUML rendering server.
  • You can install your own PlantUML server as described here: https://github.com/plantuml/plantuml-server
  • Once you have the PlantUML server check if you can access its web service <<platuml_server_url>>/uml. Here you can write the PlantUML DSL code to generate the diagram. The web service will also provide you the png URL along with the diagram encoding. See below screenshot.

















PlantUML uses a standardised encoding which is unique for each diagram. This encoding facilitates communication of diagrams through URL. (Reference : PlantUML Text Encoding

In the above screenshot the ENCODING for the shown diagram is : "SyfFKj2rKt3CoKnELR1Io4ZDoSa70000". Each diagram will have a universally unique encoding that can be rendered by the PlantUML server.


  • You can render a png image for your diagram using the <<platuml_server_url>>/png/ENCODING url.
  • Commit the png url in your Markdown file in Bitbucket. Make sure the plantUML server url is accessible from your browser. See below screenshot to show the source of the markdown.











If everything else is fine, once you click on "Show rendered" the markdown will render the image from the PlantUML server using the encoding in the URL and show the image.












Reference Document for PlantUML Server : https://plantuml.com/server 

Last modified on Mar 4, 2022

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.